JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix: 修复OpenAI账号未连接时模型配置报错文案误导问题
cjh_jinduoxiab7111b571185
diff --git a/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx b/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsxindex aa057faffd..f89f8a1461 100644--- a/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx@@ -1646,7 +1646,13 @@ function OpenAIAccountAuthPanel({}, [modelOptions]);const currentModelName = (model.model_name || "").trim();const selectedModelName = visibleModelOptions.includes(currentModelName) ? currentModelName : "";- const hasUnavailableConfiguredModel = Boolean(currentModelName && !selectedModelName && !loadingModels);+ const hasStoredAuth = Boolean(status?.authenticated);+ const hasUnavailableConfiguredModel = Boolean(+ currentModelName && !selectedModelName && !loadingModels && hasStoredAuth,+ );+ const needsLoginForConfiguredModel = Boolean(+ currentModelName && !selectedModelName && !loadingModels && !hasStoredAuth,+ );const handleModelSelectChange = (modelName: string) => {if (!visibleModelOptions.includes(modelName)) return;@@ -1654,7 +1660,6 @@ function OpenAIAccountAuthPanel({void onModelPatch({ model_name: modelName });};- const hasStoredAuth = Boolean(status?.authenticated);const authenticated = Boolean(hasStoredAuth && !status?.needs_refresh);const statusLabel = authenticated? t("config.openaiAccount.connected")@@ -1766,7 +1771,11 @@ function OpenAIAccountAuthPanel({<option key={modelId} value={modelId}>{modelId}</option>))}</select>- {hasUnavailableConfiguredModel ? (+ {needsLoginForConfiguredModel ? (+ <div className="mt-1 text-[11px] text-warn">+ {t("config.openaiAccount.needLoginForModel")}+ </div>+ ) : hasUnavailableConfiguredModel ? (<div className="mt-1 text-[11px] text-warn">{t("config.openaiAccount.configuredModelUnavailable", { model: currentModelName })}</div>diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.jsonindex 0b8ca29f82..4e3c4305eb 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json@@ -916,6 +916,7 @@"modelsLoadFailed": "Failed to refresh OpenAI model list","noModelsAvailable": "No OpenAI models were returned. Refresh after authorization completes.","configuredModelUnavailable": "Configured model \"{{model}}\" is not in the OpenAI account model list.",+ "needLoginForModel": "Please connect your OpenAI account first.","modelNameUseDropdown": "Use the OpenAI model dropdown below","apiBaseManaged": "Managed by the OAuth provider. No manual change is needed.","autoSaving": "Login completed. Saving configuration...",diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.jsonindex 874ba3f17c..15983d09c7 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json@@ -916,6 +916,7 @@"modelsLoadFailed": "刷新 OpenAI 模型列表失败","noModelsAvailable": "未返回可用 OpenAI 模型,请在授权完成后刷新。","configuredModelUnavailable": "当前配置的模型“{{model}}”不在 OpenAI 账号模型列表中。",+ "needLoginForModel": "请先连接 OpenAI 账号。","modelNameUseDropdown": "请使用下方 OpenAI 模型下拉框选择","apiBaseManaged": "OAuth Provider 自动维护,无需手动修改","autoSaving": "登录完成,正在自动保存配置...",