akhaliq HF Staff commited on
Commit
ed9c135
·
1 Parent(s): 62beaf6

Restore working Client connection and positional predict arrays in app.js

Browse files
Files changed (1) hide show
  1. static/app.js +9 -9
static/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import { client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
2
 
3
  // Global Application State Management
4
  const STATE = {
@@ -69,7 +69,7 @@ marked.setOptions({
69
  // Setup Initial State & Event Handlers
70
  async function initializeApp() {
71
  // 1. Connect Gradio Client in background (Non-blocking)
72
- client(window.location.origin)
73
  .then(app => {
74
  STATE.gradioClient = app;
75
  console.log("Successfully connected to Gradio.Server backend.");
@@ -412,13 +412,13 @@ async function triggerPromptSubmission(inputElement) {
412
  const responseId = appendAssistantPlaceholderBubble();
413
  const startTime = Date.now();
414
 
415
- // Call our gradio.Server api endpoint using named object parameters matching Python arguments
416
- const result = await STATE.gradioClient.predict("/chat_with_step", {
417
- messages_json: JSON.stringify(STATE.conversationHistory),
418
- reasoning_effort: STATE.reasoningEffort,
419
- max_tokens: STATE.maxTokens,
420
- temperature: STATE.temperature
421
- });
422
 
423
  const duration = ((Date.now() - startTime) / 1000).toFixed(1);
424
  const rawData = Array.isArray(result.data) ? result.data[0] : result.data;
 
1
+ import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
2
 
3
  // Global Application State Management
4
  const STATE = {
 
69
  // Setup Initial State & Event Handlers
70
  async function initializeApp() {
71
  // 1. Connect Gradio Client in background (Non-blocking)
72
+ Client.connect(window.location.origin)
73
  .then(app => {
74
  STATE.gradioClient = app;
75
  console.log("Successfully connected to Gradio.Server backend.");
 
412
  const responseId = appendAssistantPlaceholderBubble();
413
  const startTime = Date.now();
414
 
415
+ // Call our gradio.Server api endpoint using standard positional array arguments
416
+ const result = await STATE.gradioClient.predict("/chat_with_step", [
417
+ JSON.stringify(STATE.conversationHistory),
418
+ STATE.reasoningEffort,
419
+ STATE.maxTokens,
420
+ STATE.temperature
421
+ ]);
422
 
423
  const duration = ((Date.now() - startTime) / 1000).toFixed(1);
424
  const rawData = Array.isArray(result.data) ? result.data[0] : result.data;