myagent-ai 1.15.47 → 1.15.48
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.
|
Binary file
|
package/agents/main_agent.py
CHANGED
|
@@ -585,7 +585,24 @@ class MainAgent(BaseAgent):
|
|
|
585
585
|
response = await self._call_llm(messages)
|
|
586
586
|
|
|
587
587
|
if not response.success:
|
|
588
|
-
|
|
588
|
+
_llm_error = response.error or ""
|
|
589
|
+
logger.error(f"[{task_id}] LLM 调用失败: {_llm_error}")
|
|
590
|
+
|
|
591
|
+
# 特殊处理审查拦截 (451 censorship_blocked)
|
|
592
|
+
if "451" in _llm_error or "censorship" in _llm_error.lower() or "blocked" in _llm_error.lower():
|
|
593
|
+
_censor_msg = "抱歉,当前对话内容触发了安全审查,无法继续处理。请尝试修改您的请求内容后重试。"
|
|
594
|
+
logger.warning(f"[{task_id}] 内容审查拦截,终止当前请求")
|
|
595
|
+
context.working_memory["final_response"] = _censor_msg
|
|
596
|
+
await self._emit_v2_event("v2_reasoning", {"content": _censor_msg}, stream_callback)
|
|
597
|
+
if self.memory:
|
|
598
|
+
self.memory.add_session(
|
|
599
|
+
session_id=context.session_id,
|
|
600
|
+
role="assistant",
|
|
601
|
+
content=_censor_msg,
|
|
602
|
+
)
|
|
603
|
+
break
|
|
604
|
+
|
|
605
|
+
# 其他 LLM 错误
|
|
589
606
|
error_msg = f"LLM 调用失败: {response.error}"
|
|
590
607
|
context.working_memory["final_response"] = error_msg
|
|
591
608
|
await self._emit_v2_event("v2_reasoning", {"content": error_msg}, stream_callback)
|