feat(chat): 外部Agent(Dify/n8n/Coze)运行期真实远程调用

- _resolve_market_agents 补齐 platform/agent_endpoint/agent_api_key 字段
- 新增 _call_external_agent 及 dify/n8n/coze 分支; Dify 走SSE流式,兼容
  chat/agent(message)与chatflow/workflow(text_chunk/workflow_finished)事件,
  失败时surface真实错误; n8n走webhook POST; coze走v3 chat+轮询
- send_message 选中带endpoint的外部Agent时直接远程调用,跳过本地LLM扮演
- Conversation新增ext_agent_conversation_id维持Dify/Coze多轮(迁移016)
- 出网统一trust_env=False+_proxy_for_url直连,规避坏代理502
This commit is contained in:
qihu-bot committed 2026-07-15 13:55:04 +08:00
1 parent d374d464e8
commit d274733fb3
3 files changed
+318 -8

No files matched your search

+1
View File
@@ -86,6 +86,7 @@ class Conversation(Base):
knowledge_graph_count = Column(Integer, default=0)
knowledge_graph_base_id = Column(String(64), default=None, comment="已生成的知识图谱知识库ID")
source = Column(String(32), default=None, comment="对话来源,如 wechat_bot")
ext_agent_conversation_id = Column(String(128), default=None, comment="外部Agent(Dify/Coze)会话ID,用于维持多轮上下文")
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)