mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 11:00:25 +08:00
feat(settings): show the fallback chain on the language models page
This commit is contained in:
@@ -1,9 +1,45 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { ModelsWorkspace } from "@/components/settings/ModelsWorkspace";
|
||||
import { SettingsPageHeader } from "@/components/settings/shared";
|
||||
import { useSettings } from "@/features/settings/store/SettingsStore";
|
||||
|
||||
/**
|
||||
* The ordered fallback chain (#2693) is configured outside this page for now.
|
||||
* Show it read-only so an operator can tell whether a failover path exists —
|
||||
* an Apply on this page preserves the chain, it does not create one.
|
||||
*/
|
||||
function FallbackChainNotice() {
|
||||
const { t } = useTranslation();
|
||||
const { catalog } = useSettings();
|
||||
const chain = catalog.services.llm.fallbacks ?? [];
|
||||
if (chain.length === 0) return null;
|
||||
return (
|
||||
<div className="mb-6 rounded-xl border border-[var(--border)]/60 bg-[var(--card)] px-4 py-3 text-[12.5px] leading-relaxed">
|
||||
<div className="font-medium">
|
||||
{t("Fallback chain: {{count}} configured", { count: chain.length })}
|
||||
</div>
|
||||
<div className="mt-1 text-[var(--muted-foreground)]">
|
||||
{t(
|
||||
"When the active model fails before any output, DeepTutor tries these in order and returns to the primary once its cooldown ends. Edited in the catalog, not on this page.",
|
||||
)}
|
||||
</div>
|
||||
<ul className="mt-1.5 list-disc pl-5 text-[var(--muted-foreground)]">
|
||||
{chain.map((entry) => (
|
||||
<li key={`${entry.profile_id}:${entry.model_id}`}>
|
||||
{entry.profile_id} / {entry.model_id}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function LlmSettingsPage() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SettingsPageHeader
|
||||
@@ -12,6 +48,7 @@ export default function LlmSettingsPage() {
|
||||
"Manage language models and their context, capabilities, and connection tests.",
|
||||
)}
|
||||
/>
|
||||
<FallbackChainNotice />
|
||||
<ModelsWorkspace page="llm" />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -145,6 +145,11 @@ export type CatalogService = {
|
||||
active_model_id?: string | null;
|
||||
/** `task` only: the tasks that run on something other than the global choice. */
|
||||
overrides?: Record<string, CatalogTaskOverride>;
|
||||
/**
|
||||
* `llm` only: the ordered fallback chain (#2693). Edited outside this page;
|
||||
* the settings UI only displays it, and an Apply without the key preserves it.
|
||||
*/
|
||||
fallbacks?: { profile_id: string; model_id: string }[];
|
||||
profiles: CatalogProfile[];
|
||||
};
|
||||
|
||||
|
||||
@@ -1744,6 +1744,8 @@
|
||||
"Public API base": "Public API base",
|
||||
"Leave blank for local Docker. Use the externally reachable backend URL, including any proxy path.": "Leave blank for local Docker. Use the externally reachable backend URL, including any proxy path.",
|
||||
"CORS origins": "CORS origins",
|
||||
"Fallback chain: {{count}} configured": "Fallback chain: {{count}} configured",
|
||||
"When the active model fails before any output, DeepTutor tries these in order and returns to the primary once its cooldown ends. Edited in the catalog, not on this page.": "When the active model fails before any output, DeepTutor tries these in order and returns to the primary once its cooldown ends. Edited in the catalog, not on this page.",
|
||||
"Only required for authenticated cross-origin deployments. Use frontend origins, not API URLs.": "Only required for authenticated cross-origin deployments. Use frontend origins, not API URLs.",
|
||||
"Comma, semicolon, and newline separators are accepted. Bare host:port values are stored as http://host:port.": "Comma, semicolon, and newline separators are accepted. Bare host:port values are stored as http://host:port.",
|
||||
"Auth is enabled but secure cookies are off. Cross-site HTTPS deployments should set auth.cookie_secure=true and restart so SameSite=None cookies work in modern browsers.": "Auth is enabled but secure cookies are off. Cross-site HTTPS deployments should set auth.cookie_secure=true and restart so SameSite=None cookies work in modern browsers.",
|
||||
|
||||
@@ -1160,6 +1160,8 @@
|
||||
"Public API base": "公共 API base",
|
||||
"Leave blank for local Docker. Use the externally reachable backend URL, including any proxy path.": "本机 Docker 留空即可。远程部署填写浏览器可访问的后端 URL,可包含代理路径。",
|
||||
"CORS origins": "CORS 来源",
|
||||
"Fallback chain: {{count}} configured": "回退链:已配置 {{count}} 个",
|
||||
"When the active model fails before any output, DeepTutor tries these in order and returns to the primary once its cooldown ends. Edited in the catalog, not on this page.": "当前模型在产生输出前失败时,会按顺序尝试这些候选;主模型冷却结束后自动回切。该配置在目录中编辑,不在本页修改。",
|
||||
"Only required for authenticated cross-origin deployments. Use frontend origins, not API URLs.": "仅认证跨域部署需要填写。这里填前端页面来源,不是 API URL。",
|
||||
"Comma, semicolon, and newline separators are accepted. Bare host:port values are stored as http://host:port.": "支持逗号、分号和换行分隔。裸 host:port 会按 http://host:port 保存。",
|
||||
"Auth is enabled but secure cookies are off. Cross-site HTTPS deployments should set auth.cookie_secure=true and restart so SameSite=None cookies work in modern browsers.": "认证已启用,但安全 Cookie 未开启。跨站 HTTPS 部署应设置 auth.cookie_secure=true 并重启,使 SameSite=None Cookie 在现代浏览器中生效。",
|
||||
|
||||
Reference in New Issue
Block a user