Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/feishu/event-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1744,14 +1744,17 @@ async function executeDirectTask(
}
}

// discussion MCP server:允许 agent 动态创建话题
const discussionMcp = createDiscussionMcpServer({
chatId, userId, messageId, agentId,
onThreadCreated: (info) => {
threadReplyMsgId = info.threadReplyMsgId;
threadId = info.threadId;
},
});
// discussion MCP server:允许 agent 动态创建话题(仅在非话题场景下注入)
// 如果消息已经在一个话题中(eventThreadId 存在),不需要再创建新话题
const discussionMcp = eventThreadId
? null
: createDiscussionMcpServer({
chatId, userId, messageId, agentId,
onThreadCreated: (info) => {
threadReplyMsgId = info.threadReplyMsgId;
threadId = info.threadId;
},
});

const personaPrompt = readPersonaFile(agentId);

Expand Down Expand Up @@ -1782,7 +1785,7 @@ async function executeDirectTask(
// 不需要 workspace-manager 工具(Chat Agent 不切换工作区)
disableWorkspaceTool: true,
// 注入 discussion-tools MCP server
additionalMcpServers: { 'discussion-tools': discussionMcp },
...(discussionMcp ? { additionalMcpServers: { 'discussion-tools': discussionMcp } } : {}),
});

// resume 被跳过时清除 _historyDedup,让下次 query 重新注入完整历史
Expand Down
Loading