feat: 更新消息处理逻辑以排除应用自身的提及

This commit is contained in:
zhaoyingbo 2024-12-02 03:35:04 +00:00
parent dc958d4765
commit 21bf2bf6af

View File

@ -8,6 +8,7 @@ const agent = async (ctx: Context.Data) => {
requestId,
larkCard,
larkService,
appInfo,
larkBody: { messageId, msgText, chatId, mentions, rawMsgText },
} = ctx
const cardGender = larkCard.child("groupAgent")
@ -43,7 +44,7 @@ const agent = async (ctx: Context.Data) => {
// 根据Mention拼装原始消息
let userInput = rawMsgText
for (const mention of mentions ?? []) {
if (mention.id.user_id) {
if (mention.name !== appInfo.app_name) {
userInput = userInput.replace(mention.key, `@${mention.name}`)
} else {
userInput = userInput.replace(mention.key, "")