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

@@ -0,0 +1,14 @@
-- 016: 为 conversations 增加 ext_agent_conversation_id 列
-- 用途:外部 Agent(Dify/Coze) 远程调用时保存其平台侧 conversation_id,
-- 以维持多轮上下文。n8n(无平台会话态) 不使用该列。
-- 幂等:列已存在则跳过。
SET @col = (SELECT COUNT(*) FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'conversations'
AND column_name = 'ext_agent_conversation_id');
SET @sql = IF(@col = 0,
'ALTER TABLE conversations ADD COLUMN ext_agent_conversation_id VARCHAR(128) NULL COMMENT \'外部Agent(Dify/Coze)会话ID,用于维持多轮上下文\'',
'SELECT 1');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;