feat(iagent): add Feishu to channel binding flow in system prompt

After creating an instance, iAgent now asks user to choose:
钉钉 / 飞书 / 都绑定 / 跳过
- DingTalk: existing OAuth card push flow
- Feishu: bind-code flow (user sends code to Feishu bot)
- Also adds Feishu status/unbind API references

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-09 05:51:21 -07:00
parent 83ed55ce1c
commit 6d1e31dd36
1 changed files with 22 additions and 9 deletions

View File

@ -71,22 +71,35 @@ export class SystemPromptBuilder {
'1. Ask for a name if not given\n' + '1. Ask for a name if not given\n' +
'2. Use the Current User ID from this prompt as userId\n' + '2. Use the Current User ID from this prompt as userId\n' +
'3. Call the create API with Bash and report the result (id, status, containerName)\n\n' + '3. Call the create API with Bash and report the result (id, status, containerName)\n\n' +
'## 招募小龙虾 + 钉钉绑定 (全语音/文字引导)\n' + '## 招募小龙虾 + 渠道绑定 (全语音/文字引导)\n' +
'When a user says "帮我招募一只小龙虾" / "创建小龙虾" / "recruit agent" / "bind DingTalk":\n\n' + 'When a user says "帮我招募一只小龙虾" / "创建小龙虾" / "recruit agent" / "bind DingTalk" / "bind Feishu":\n\n' +
' Step 1 — Ask for a name if not provided:\n' + ' Step 1 — Ask for a name if not provided:\n' +
' "你想给这只小龙虾取个什么名字?"\n\n' + ' "你想给这只小龙虾取个什么名字?"\n\n' +
' Step 2 — Create the instance (Bash tool):\n' + ' Step 2 — Create the instance (Bash tool):\n' +
' wget -q -O- --post-data=\'{"name":"<name>","userId":"<userId>","usePool":true}\' --header="Content-Type: application/json" http://localhost:3002/api/v1/agent/instances\n' + ' 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' + ' Parse JSON to get "id" (instanceId) and "name".\n' +
' Say: "好的,小龙虾「<name>」已经创建好了!"\n\n' + ' Say: "好的,小龙虾「<name>」已经创建好了!接下来把它和你的即时通讯工具绑定,方便直接对话。你想绑定钉钉、飞书,还是都绑定?"\n\n' +
' Step 3 — Channel binding (based on user choice):\n\n' +
' [DingTalk / both]\n' +
`${dingtalkOauthStep}\n\n` + `${dingtalkOauthStep}\n\n` +
' Step 4 — Confirm (after user says they authorized):\n' + ' DingTalk confirm:\n' +
' wget -q -O- http://localhost:3002/api/v1/agent/channels/dingtalk/status/<instanceId>\n' + ' wget -q -O- http://localhost:3002/api/v1/agent/channels/dingtalk/status/<instanceId>\n' +
' If { "bound": true }: "太好了!小龙虾「<name>」已成功绑定钉钉,现在可以在钉钉里和它对话了"\n' + ' If { "bound": true }: "钉钉绑定成功"\n' +
' If still false: "授权还没完成,请确认是否点击了钉钉里的授权按钮。"\n\n' + ' If still false: "授权还没完成,请确认是否点击了钉钉里的授权按钮。"\n\n' +
' [Feishu / both]\n' +
' Call the bind-code API to get a 6-character code:\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' +
' 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' +
' Check/unbind:\n' + ' Check/unbind:\n' +
' Status: wget -q -O- http://localhost:3002/api/v1/agent/channels/dingtalk/status/<instanceId>\n' + ' DingTalk status: wget -q -O- http://localhost:3002/api/v1/agent/channels/dingtalk/status/<instanceId>\n' +
' Unbind: wget -q -O- --post-data="" http://localhost:3002/api/v1/agent/channels/dingtalk/unbind/<instanceId>', ' DingTalk unbind: wget -q -O- --post-data="" http://localhost:3002/api/v1/agent/channels/dingtalk/unbind/<instanceId>\n' +
' Feishu status: wget -q -O- http://localhost:3002/api/v1/agent/channels/feishu/status/<instanceId>\n' +
' Feishu unbind: wget -q -O- --post-data="" http://localhost:3002/api/v1/agent/channels/feishu/unbind/<instanceId>',
); );
// Tenant + user context // Tenant + user context