Spaces:
Running
Running
Populate sidebar labels on first paint with full default i18n table
Browse filesThe I18N defaults object only carried ~9 short-alias keys, so every
data-i18n sidebar label (think level, system prompt, temperature, max
tokens, top-p, preserved thinking, functions, validate, etc.) stayed
blank until /config round-tripped — and if /config failed they never
appeared at all. Bake the full English table into the frontend so all
labels render immediately; /config then overrides with the active
locale (en/zh).
Co-Authored-By: Claude <noreply@anthropic.com>
- static/index.html +48 -10
static/index.html
CHANGED
|
@@ -606,17 +606,55 @@ import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client@1.7.1/dist/i
|
|
| 606 |
"use strict";
|
| 607 |
|
| 608 |
// ─── i18n + examples (loaded from /config endpoint) ──────────────
|
|
|
|
|
|
|
|
|
|
| 609 |
const I18N = {
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
};
|
| 621 |
let EXAMPLES = [];
|
| 622 |
let TOOL_CALL_LABEL = "🔧 Call function";
|
|
|
|
| 606 |
"use strict";
|
| 607 |
|
| 608 |
// ─── i18n + examples (loaded from /config endpoint) ──────────────
|
| 609 |
+
// Full English default table so every label is populated on first paint
|
| 610 |
+
// — before /config round-trips. /config then overrides with the active
|
| 611 |
+
// locale (en/zh). Keep these in sync with i18n.py.
|
| 612 |
const I18N = {
|
| 613 |
+
"title": "Hy3 Chat Demo",
|
| 614 |
+
"title.notice_html": "The current demo version is offline; full-featured capabilities will be available on the Tencent HY official website.",
|
| 615 |
+
"examples_heading": "What can I help you with?",
|
| 616 |
+
"msg_placeholder": "Type a message...",
|
| 617 |
+
"sidebar.think_level": "Think level",
|
| 618 |
+
"sidebar.think_level.info": "Control reasoning depth",
|
| 619 |
+
"sidebar.system_prompt": "System prompt",
|
| 620 |
+
"sidebar.system_prompt.placeholder": "You are a helpful AI assistant...",
|
| 621 |
+
"sidebar.temperature": "Temperature",
|
| 622 |
+
"sidebar.temperature.info": "Higher values produce more random outputs",
|
| 623 |
+
"sidebar.temperature.use_default": "Use model default",
|
| 624 |
+
"sidebar.max_tokens": "Max output tokens",
|
| 625 |
+
"sidebar.max_tokens.info": "Maximum tokens per response. Set to 0 to use the model's default.",
|
| 626 |
+
"sidebar.top_p": "Top P",
|
| 627 |
+
"sidebar.top_p.info": "Nucleus sampling probability threshold. Set to 0 to use the model's default.",
|
| 628 |
+
"sidebar.preserved_thinking": "Preserved thinking",
|
| 629 |
+
"sidebar.preserved_thinking.info": "When enabled, the model can retain reasoning content from previous assistant turns in the context, helping maintain reasoning continuity and conversation integrity while improving model performance.",
|
| 630 |
+
"sidebar.preserved_thinking.use_default": "Preserved thinking — Use model default",
|
| 631 |
+
"sidebar.preserved_thinking.use_default.info": "We recommend using \"Use model default\", which automatically enables this option for tool call workflows and disables it for pure text conversations.",
|
| 632 |
+
"sidebar.functions": "🔧 Functions",
|
| 633 |
+
"sidebar.functions.label": "Function definitions (JSON array)",
|
| 634 |
+
"sidebar.validate_btn": "Validate & Format",
|
| 635 |
+
"tool.result_label": "Function result",
|
| 636 |
+
"tool.result_placeholder": "Enter function return value... (Enter to submit)",
|
| 637 |
+
"tool.submit": "Submit",
|
| 638 |
+
"tool.call_header": "Function call ({i}/{n})",
|
| 639 |
+
"tool.call_label": "🔧 Call function",
|
| 640 |
+
"display.thinking": "Thinking...",
|
| 641 |
+
"display.thinking_done": "Thinking complete",
|
| 642 |
+
"display.code_copy": "Copy",
|
| 643 |
+
"display.code_copied": "Copied",
|
| 644 |
+
"warn.empty_msg": "Please enter a message",
|
| 645 |
+
"warn.invalid_fn_json": "Invalid function JSON, please fix or clear before sending: {err}",
|
| 646 |
+
"warn.request_failed": "Request failed, please retry or adjust parameters",
|
| 647 |
+
"warn.model_busy": "Model is still responding. Please wait for it to finish before sending a new message.",
|
| 648 |
+
"info.new_chat": "Start a new chat",
|
| 649 |
+
// short aliases used directly in code below
|
| 650 |
+
"thinking": "Thinking...",
|
| 651 |
+
"thinking_done": "Thinking complete",
|
| 652 |
+
"code_copy": "Copy",
|
| 653 |
+
"code_copied": "Copied",
|
| 654 |
+
"model_busy": "Model is still responding. Please wait for it to finish before sending a new message.",
|
| 655 |
+
"empty_msg": "Please enter a message",
|
| 656 |
+
"request_failed": "Request failed, please retry or adjust parameters",
|
| 657 |
+
"new_chat": "Start a new chat",
|
| 658 |
};
|
| 659 |
let EXAMPLES = [];
|
| 660 |
let TOOL_CALL_LABEL = "🔧 Call function";
|