myagent-ai 1.17.0 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/main_agent.py +9 -3
- package/config.py +14 -1
- package/package.json +1 -1
package/agents/main_agent.py
CHANGED
|
@@ -701,9 +701,15 @@ class MainAgent(BaseAgent):
|
|
|
701
701
|
)
|
|
702
702
|
break
|
|
703
703
|
|
|
704
|
-
# [v1.16.13] 特殊处理模型不支持图片输入 — 去掉图片用纯文本重试
|
|
705
|
-
|
|
706
|
-
|
|
704
|
+
# [v1.16.13→17.0] 特殊处理模型不支持图片输入 — 去掉图片用纯文本重试
|
|
705
|
+
# 支持中英文错误关键词匹配(ModelScope 等国产 API 可能返回中文错误)
|
|
706
|
+
_vision_keywords = [
|
|
707
|
+
"doesn't support image", "does not support image", "model_incompatible",
|
|
708
|
+
"image input", "not support vision", "unsupported multimodal", "image capability",
|
|
709
|
+
"不支持图片", "不支持图像", "图片输入", "图像输入", "不支持多模态",
|
|
710
|
+
"视觉", "image_url", "multimodal", "vision",
|
|
711
|
+
]
|
|
712
|
+
if any(kw.lower() in _llm_error.lower() for kw in _vision_keywords) and context.metadata.get("user_images"):
|
|
707
713
|
logger.warning(f"[{task_id}] 模型不支持图片输入,去掉图片用纯文本重试")
|
|
708
714
|
context.metadata["user_images"] = []
|
|
709
715
|
# 用纯文本消息替换最后一条多模态消息
|
package/config.py
CHANGED
|
@@ -316,8 +316,21 @@ class ConfigManager:
|
|
|
316
316
|
elif isinstance(value, list) and key == "models_library":
|
|
317
317
|
models = []
|
|
318
318
|
for item in value:
|
|
319
|
+
# [v1.17.0] 兼容 "input" → "input_modes" 字段映射
|
|
320
|
+
# 用户配置中常使用 "input": ["text", "image"],内部字段名是 "input_modes"
|
|
321
|
+
normalized = dict(item)
|
|
322
|
+
if "input" in normalized and "input_modes" not in normalized:
|
|
323
|
+
normalized["input_modes"] = normalized.pop("input")
|
|
324
|
+
if "baseUrl" in normalized and "base_url" not in normalized:
|
|
325
|
+
normalized["base_url"] = normalized.pop("baseUrl")
|
|
326
|
+
if "apiKey" in normalized and "api_key" not in normalized:
|
|
327
|
+
normalized["api_key"] = normalized.pop("apiKey")
|
|
328
|
+
if "reasoning" in normalized:
|
|
329
|
+
# 确保 reasoning 是 bool 类型
|
|
330
|
+
v = normalized["reasoning"]
|
|
331
|
+
normalized["reasoning"] = bool(v) if not isinstance(v, bool) else v
|
|
319
332
|
me = ModelEntry(**{
|
|
320
|
-
k: v for k, v in
|
|
333
|
+
k: v for k, v in normalized.items() if k in ModelEntry.__dataclass_fields__
|
|
321
334
|
})
|
|
322
335
|
models.append(me)
|
|
323
336
|
setattr(target, key, models)
|