sync update from LAN repo (source dhk-1 @ 3b1ec5b4)
This commit is contained in:
1 parent
da6521b6cb
commit
264e2200d6
995 files changed
+148105
-13399
No files matched your search
@@ -1,9 +1,11 @@
|
||||
"""圆桌会商「模型自动容错(换下一个模型)」共享助手。
|
||||
|
||||
会商的第二步(leader / seat)与第三步(summary / report / dashboard / structure)单轮执行时,
|
||||
若所用模型出现问题(抛异常 / idle 卡死 / 中间件兜底错误文案 / 交付为空),应自动切到
|
||||
若所用模型出现真实调用问题(抛异常 / idle 卡死 / 中间件兜底错误文案),应自动切到
|
||||
**下一个可用模型**继续,并把「『X』模型异常 → 已切换『Y』模型」告知用户。
|
||||
|
||||
仅有思考、暂时没有可见正文或交付为空不属于模型故障,不得据此切换模型。
|
||||
|
||||
本模块只放**与执行路径无关**的纯逻辑,供前台(``multi_agent.py``)与后台
|
||||
(``roundtable_inprocess_gateway.py``)两条路径共用:
|
||||
|
||||
@@ -55,8 +57,8 @@ def reason_text(reason: str | None) -> str:
|
||||
def model_fallback_enabled() -> bool:
|
||||
"""模型自动容错总开关(默认开;设 ``ROUNDTABLE_MODEL_FALLBACK=0/false/off`` 关闭)。
|
||||
|
||||
关闭时 ``fallback_model_chain`` 只返回单个候选(原模型),即恢复旧行为:模型失败就失败,
|
||||
不再尝试其它模型。
|
||||
该开关只控制真实模型错误后的换模。仅有 reasoning、没有可见正文不再作为换模条件。
|
||||
关闭时 ``fallback_model_chain`` 只返回单个候选(原模型)。
|
||||
"""
|
||||
raw = (os.getenv("ROUNDTABLE_MODEL_FALLBACK", "1") or "1").strip().lower()
|
||||
return raw not in {"0", "false", "no", "off"}
|
||||
@@ -85,7 +87,7 @@ def fallback_model_chain(current: str | None) -> list[str]:
|
||||
- ``current`` 为空/None → 从 ``models[0]`` 起(即后端默认模型),后接其余;
|
||||
- ``current`` 在配置内 → 它排第一,其余按配置顺序补齐;
|
||||
- ``current`` 不在配置内(自定义/未知名)→ 仍排第一,再补齐全部配置模型;
|
||||
- 总开关关闭 → 只返回单个候选(``current`` 或默认模型),等同旧行为;
|
||||
- 总开关关闭 → 只返回单个候选(``current`` 或默认模型);
|
||||
- 拿不到任何配置模型 → 返回 ``[current]``(current 为空则空列表,调用方自行退化为不换模型)。
|
||||
"""
|
||||
all_names = _config_model_names()
|
||||
|
||||
Reference in new issue
Block a user