fix: 修复卡片点击报错问题
This commit is contained in:
parent
c41f6744fa
commit
500a5c10b0
@ -1,18 +1,18 @@
|
||||
const functionMap = {
|
||||
egg: {
|
||||
Xname: "小煎蛋",
|
||||
Xauthor: "zhaoyingbo",
|
||||
Xicon: "🍳",
|
||||
xName: "小煎蛋",
|
||||
xAuthor: "zhaoyingbo",
|
||||
xIcon: "🍳",
|
||||
},
|
||||
groupAgent: {
|
||||
Xname: "Group Agent",
|
||||
Xauthor: "AI创新应用组",
|
||||
Xicon: "🔥",
|
||||
xName: "Group Agent",
|
||||
xAuthor: "AI创新应用组",
|
||||
xIcon: "🔥",
|
||||
},
|
||||
sheetDB: {
|
||||
Xname: "小煎蛋 Sheet DB",
|
||||
Xauthor: "zhaoyingbo",
|
||||
Xicon: "🍪",
|
||||
xName: "小煎蛋 Sheet DB",
|
||||
xAuthor: "zhaoyingbo",
|
||||
xIcon: "🍪",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
"dependencies": {
|
||||
"@dotenvx/dotenvx": "^1.19.0",
|
||||
"@egg/hooks": "^1.2.0",
|
||||
"@egg/lark-msg-tool": "^1.7.2",
|
||||
"@egg/lark-msg-tool": "^1.7.4",
|
||||
"@egg/logger": "^1.4.4",
|
||||
"@egg/net-tool": "^1.9.2",
|
||||
"@egg/path-tool": "^1.4.1",
|
||||
|
@ -34,6 +34,6 @@ export const manageActionMsg = async (ctx: Context.Data) => {
|
||||
if (!["button", "select_static"].includes(actionType!))
|
||||
return ctx.genResp.ok()
|
||||
const card = await manageAction(ctx)
|
||||
if (card) return ctx.genResp.custom(card)
|
||||
if (card) return ctx.genResp.json(card)
|
||||
return ctx.genResp.ok()
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { genCardOptions } from "@egg/lark-msg-tool"
|
||||
|
||||
import { Context } from "../../../types"
|
||||
import llm from "../../../utils/llm"
|
||||
|
||||
@ -32,10 +34,9 @@ const sendGroupSelector = async ({
|
||||
const sendFunctionSelector = async ({
|
||||
logger,
|
||||
larkCard,
|
||||
larkService,
|
||||
larkBody: { actionOption, messageId },
|
||||
larkBody: { actionOption },
|
||||
}: Context.Data) => {
|
||||
const cardGender = larkCard.child("groupAgent")
|
||||
const cardGender = larkCard.child("groupAgent", false)
|
||||
logger.debug(`Action option: ${JSON.stringify(actionOption)}`)
|
||||
const [chatId, chatName] = (actionOption ?? "").split("|")
|
||||
if (!chatId || !chatName) {
|
||||
@ -44,23 +45,11 @@ const sendFunctionSelector = async ({
|
||||
)
|
||||
return cardGender.genErrorCard("Invalid targetChatId or targetChatName")
|
||||
}
|
||||
// 组织功能数据
|
||||
const functions = [
|
||||
{
|
||||
text: "总结消息",
|
||||
value: "summary-gpt-4o|总结消息",
|
||||
},
|
||||
]
|
||||
|
||||
larkService.message.update(
|
||||
messageId,
|
||||
cardGender.genCard("functionSelector", {
|
||||
functions,
|
||||
chatId,
|
||||
chatName,
|
||||
})
|
||||
)
|
||||
return {}
|
||||
return cardGender.genCard("functionSelector", {
|
||||
functions: genCardOptions({ 总结消息: "summary-gpt-4o|总结消息" }),
|
||||
chatId,
|
||||
chatName,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,7 +179,7 @@ const manageGroupMsg = async (ctx: Context.Data) => {
|
||||
// 处理群组消息
|
||||
sendGroupReport(ctx)
|
||||
// 发送一个loading的消息
|
||||
return cardGender.genSuccessCard("正在爬楼中,请稍等...")
|
||||
return cardGender.genPendingCard("正在爬楼中,请稍等...")
|
||||
}
|
||||
|
||||
const groupAgent = {
|
||||
|
4
test/test.http
Normal file
4
test/test.http
Normal file
@ -0,0 +1,4 @@
|
||||
POST http://localhost:3000/bot?app=egg
|
||||
Content-Type: application/json
|
||||
|
||||
{"open_id":"ou_470ac13b8b50fc472d9d8ee71e03de26","user_id":"zhaoyingbo","open_message_id":"om_e0eada9844d0a1f199c42a1c883404b0","open_chat_id":"oc_ba33dc55b3dd76bf31e0adfec5e13300","tenant_key":"2ee61fe50f4f1657","token":"c-f31a8fa8788c5d79dbede8e336856d2e98e4be96","action":{"value":{"action":"sendFunctionSelector","requestId":"91a1473b-8c70-4957-9d21-66bb2b07c46a"},"tag":"select_static","option":"oc_433b1cb7a9dbb7ebe70a4e1a59cb8bb1|方糖の家"}}
|
Loading…
x
Reference in New Issue
Block a user