Files
qihuaiflow/migrations/016_add_conversation_ext_agent.sql
qihu-bot d274733fb3 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
2026-07-15 13:55:04 +08:00

15 lines
746 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 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;