fix(iagent): make dingtalk/feishu endpoint separation explicit in system prompt

Add CRITICAL note and clear IF/ELSE branching so Claude never calls
dingtalk endpoints for feishu binding or vice versa.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-09 05:57:38 -07:00
parent 6d1e31dd36
commit d9a785d49d
1 changed files with 11 additions and 8 deletions

View File

@ -79,22 +79,25 @@ export class SystemPromptBuilder {
' wget -q -O- --post-data=\'{"name":"<name>","userId":"<userId>","usePool":true}\' --header="Content-Type: application/json" http://localhost:3002/api/v1/agent/instances\n' +
' Parse JSON to get "id" (instanceId) and "name".\n' +
' Say: "好的,小龙虾「<name>」已经创建好了!接下来把它和你的即时通讯工具绑定,方便直接对话。你想绑定钉钉、飞书,还是都绑定?"\n\n' +
' Step 3 — Channel binding (based on user choice):\n\n' +
' [DingTalk / both]\n' +
`${dingtalkOauthStep}\n\n` +
' DingTalk confirm:\n' +
' Step 3 — Channel binding (based on user choice; NEVER mix up endpoints):\n\n' +
' IF user chose 钉钉 (DingTalk) OR both:\n' +
' *** Use ONLY dingtalk endpoints — /channels/dingtalk/... ***\n' +
`${dingtalkOauthStep}\n` +
' DingTalk confirm (ONLY dingtalk endpoint):\n' +
' wget -q -O- http://localhost:3002/api/v1/agent/channels/dingtalk/status/<instanceId>\n' +
' If { "bound": true }: "钉钉绑定成功!"\n' +
' If still false: "授权还没完成,请确认是否点击了钉钉里的授权按钮。"\n\n' +
' [Feishu / both]\n' +
' Call the bind-code API to get a 6-character code:\n' +
' IF user chose 飞书 (Feishu) OR both:\n' +
' *** Use ONLY feishu endpoints — /channels/feishu/... ***\n' +
' Get bind code (ONLY feishu endpoint):\n' +
' wget -q -O- --post-data="" http://localhost:3002/api/v1/agent/channels/feishu/bind/<instanceId>\n' +
' Parse JSON: { "code": "<CODE>", "expiresAt": <ms> }\n' +
' Say: "飞书绑定验证码是「<CODE>」有效15分钟。请打开飞书找到 iAgent 机器人,把这个验证码发给它,就完成绑定啦。"\n' +
' Then poll every 5s (up to 3 min) to confirm:\n' +
' Poll to confirm (ONLY feishu endpoint, every 5s up to 3 min):\n' +
' wget -q -O- http://localhost:3002/api/v1/agent/channels/feishu/status/<instanceId>\n' +
' If { "bound": true }: "太好了!飞书绑定成功了!"\n\n' +
' [skip / neither]: "好的,之后想绑定随时可以在 IT0 App 里操作。"\n\n' +
' IF user chose skip / neither: "好的,之后想绑定随时可以在 IT0 App 里操作。"\n\n' +
' CRITICAL: dingtalk endpoints (/channels/dingtalk/) and feishu endpoints (/channels/feishu/) are completely separate. Never call a dingtalk endpoint for feishu or vice versa.\n\n' +
' Check/unbind:\n' +
' DingTalk status: wget -q -O- http://localhost:3002/api/v1/agent/channels/dingtalk/status/<instanceId>\n' +
' DingTalk unbind: wget -q -O- --post-data="" http://localhost:3002/api/v1/agent/channels/dingtalk/unbind/<instanceId>\n' +