From 257b60bb63e2eb6c2566057647f9d90c013d29bb Mon Sep 17 00:00:00 2001 From: Chenyme <118253778+chenyme@users.noreply.github.com> Date: Sun, 19 Apr 2026 17:35:55 +0800 Subject: [PATCH] feat: Add auto chat mode fallback configuration and update related translations --- app/products/_account_selection.py | 13 ++++++------- app/statics/admin/config.html | 1 + app/statics/i18n/de.json | 1 + app/statics/i18n/en.json | 4 ++++ app/statics/i18n/es.json | 1 + app/statics/i18n/fr.json | 1 + app/statics/i18n/ja.json | 1 + app/statics/i18n/zh.json | 4 ++++ config.defaults.toml | 2 -- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/products/_account_selection.py b/app/products/_account_selection.py index 5e9c7d65..056583e6 100644 --- a/app/products/_account_selection.py +++ b/app/products/_account_selection.py @@ -52,12 +52,11 @@ async def reserve_account( if lease is not None: return lease, selected_mode_id - if get_config("account.refresh.on_empty_retry_enabled", True): - refresh_svc = get_refresh_service() - if refresh_svc is not None: - await refresh_svc.refresh_on_demand() - lease, selected_mode_id = await _try_reserve() - if lease is not None: - return lease, selected_mode_id + refresh_svc = get_refresh_service() + if refresh_svc is not None: + await refresh_svc.refresh_on_demand() + lease, selected_mode_id = await _try_reserve() + if lease is not None: + return lease, selected_mode_id return None, original_mode_id diff --git a/app/statics/admin/config.html b/app/statics/admin/config.html index bcf2df6a..410d6be1 100644 --- a/app/statics/admin/config.html +++ b/app/statics/admin/config.html @@ -382,6 +382,7 @@ const SCHEMA_DEF = [ { key: 'memory', label: '开启会话记忆', labelKey: 'config.schema.fields.memory.label', type: 'bool', desc: '启用 Grok Memory,允许模型跨会话记忆用户偏好与上下文。', descKey: 'config.schema.fields.memory.desc' }, { key: 'stream', label: '默认流式输出', labelKey: 'config.schema.fields.stream.label', type: 'bool', desc: '请求未显式指定 stream 参数时所采用的默认值。', descKey: 'config.schema.fields.stream.desc' }, { key: 'thinking', label: '默认思考输出', labelKey: 'config.schema.fields.thinking.label', type: 'bool', desc: '请求未显式指定 thinking 参数时所采用的默认值。启用后将在 reasoning_content 字段返回思考过程。', descKey: 'config.schema.fields.thinking.desc' }, + { key: 'auto_chat_mode_fallback', label: 'AUTO 聊天模式回退', labelKey: 'config.schema.fields.autoChatModeFallback.label', type: 'bool', desc: 'AUTO 聊天模型在 auto 额度不可用时,自动尝试 fast 和 expert 聊天额度窗口。', descKey: 'config.schema.fields.autoChatModeFallback.desc' }, { key: 'thinking_summary', label: '思考精简输出', labelKey: 'config.schema.fields.thinkingSummary.label', type: 'bool', desc: '启用后将思考过程提炼为结构化摘要。关闭时输出完整的原始推理过程,支持多 Agent 模型的协作详情与工具调用展示。', descKey: 'config.schema.fields.thinkingSummary.desc' }, { key: 'dynamic_statsig', label: '动态 Statsig', labelKey: 'config.schema.fields.dynamicStatsig.label', type: 'bool', desc: '为每次请求动态生成 Statsig 设备指纹,以降低风控拦截概率。', descKey: 'config.schema.fields.dynamicStatsig.desc' }, { key: 'enable_nsfw', label: '允许 NSFW 生成', labelKey: 'config.schema.fields.enableNsfw.label', type: 'bool', desc: '允许图像生成接口绕过 NSFW 内容过滤。', descKey: 'config.schema.fields.enableNsfw.desc' }, diff --git a/app/statics/i18n/de.json b/app/statics/i18n/de.json index 281a6434..5b8c763a 100644 --- a/app/statics/i18n/de.json +++ b/app/statics/i18n/de.json @@ -372,6 +372,7 @@ "memory": { "label": "Konversationsspeicher" }, "stream": { "label": "Standard-Streaming" }, "thinking": { "label": "Standard-Ausgabe für Reasoning" }, + "autoChatModeFallback": { "label": "AUTO-Chatmodus-Fallback" }, "thinkingSummary": { "label": "Kompakte Reasoning-Ausgabe" }, "dynamicStatsig": { "label": "Dynamisches Statsig" }, "enableNsfw": { "label": "NSFW-Erzeugung zulassen" }, diff --git a/app/statics/i18n/en.json b/app/statics/i18n/en.json index fd54dfd1..67d25e8e 100644 --- a/app/statics/i18n/en.json +++ b/app/statics/i18n/en.json @@ -399,6 +399,10 @@ "label": "Default Reasoning Output", "desc": "Default value applied when the request does not explicitly provide the thinking parameter. When enabled, reasoning steps are returned in reasoning_content." }, + "autoChatModeFallback": { + "label": "AUTO Chat Mode Fallback", + "desc": "When an AUTO chat model has no available auto quota, automatically try the fast and expert chat quota windows." + }, "thinkingSummary": { "label": "Condensed Reasoning", "desc": "When enabled, reasoning steps are condensed into a structured summary. When disabled, the full raw reasoning stream is output, with multi-agent collaboration details and tool call traces." diff --git a/app/statics/i18n/es.json b/app/statics/i18n/es.json index 1e60228d..ad744058 100644 --- a/app/statics/i18n/es.json +++ b/app/statics/i18n/es.json @@ -372,6 +372,7 @@ "memory": { "label": "Memoria de conversación" }, "stream": { "label": "Streaming predeterminado" }, "thinking": { "label": "Salida de razonamiento predeterminada" }, + "autoChatModeFallback": { "label": "Reserva de modo AUTO para chat" }, "thinkingSummary": { "label": "Razonamiento condensado" }, "dynamicStatsig": { "label": "Statsig dinámico" }, "enableNsfw": { "label": "Permitir generación NSFW" }, diff --git a/app/statics/i18n/fr.json b/app/statics/i18n/fr.json index 0ff1d376..fc3486d7 100644 --- a/app/statics/i18n/fr.json +++ b/app/statics/i18n/fr.json @@ -372,6 +372,7 @@ "memory": { "label": "Mémoire conversationnelle" }, "stream": { "label": "Streaming par défaut" }, "thinking": { "label": "Sortie de raisonnement par défaut" }, + "autoChatModeFallback": { "label": "Repli du mode AUTO pour le chat" }, "thinkingSummary": { "label": "Raisonnement condensé" }, "dynamicStatsig": { "label": "Statsig dynamique" }, "enableNsfw": { "label": "Autoriser la génération NSFW" }, diff --git a/app/statics/i18n/ja.json b/app/statics/i18n/ja.json index 94ccacea..244826a3 100644 --- a/app/statics/i18n/ja.json +++ b/app/statics/i18n/ja.json @@ -372,6 +372,7 @@ "memory": { "label": "会話メモリ" }, "stream": { "label": "デフォルトのストリーミング" }, "thinking": { "label": "デフォルトの推論出力" }, + "autoChatModeFallback": { "label": "AUTO チャットモードのフォールバック" }, "thinkingSummary": { "label": "思考要約出力" }, "dynamicStatsig": { "label": "動的 Statsig" }, "enableNsfw": { "label": "NSFW 生成を許可" }, diff --git a/app/statics/i18n/zh.json b/app/statics/i18n/zh.json index 052dac57..cc1acb49 100644 --- a/app/statics/i18n/zh.json +++ b/app/statics/i18n/zh.json @@ -399,6 +399,10 @@ "label": "默认思考输出", "desc": "请求未显式指定 thinking 参数时所采用的默认值。启用后将在 reasoning_content 字段返回思考过程。" }, + "autoChatModeFallback": { + "label": "AUTO 聊天模式回退", + "desc": "AUTO 聊天模型在 auto 额度不可用时,自动尝试 fast 和 expert 聊天额度窗口。" + }, "thinkingSummary": { "label": "思考精简输出", "desc": "启用后将思考过程提炼为结构化摘要。关闭时输出完整的原始推理过程,支持多 Agent 模型的协作详情与工具调用展示。" diff --git a/config.defaults.toml b/config.defaults.toml index 44071988..a85687f8 100644 --- a/config.defaults.toml +++ b/config.defaults.toml @@ -32,8 +32,6 @@ stream = true thinking = true # 聊天类 AUTO 模型在 auto 额度耗尽时,是否自动降级到 fast/expert auto_chat_mode_fallback = true -# 当本地额度缓存判定无可用账号时,是否先触发一次按需刷新再重试 -on_empty_retry_enabled = true # 思考精简输出(false=完整原始推理过程,true=提炼结构化摘要) thinking_summary = false # 是否动态生成 Statsig 指纹