Files
inquiry_robot/aibot-bridge/group_message_frame.cjs
T
jillion886andCursor cfbce2fd69 落地空运单聊询价字段与线路选择。
必填核对后再建单;多条线路走 H5 点选;费用只展示该线路 TMS 回包,不套用整单空运费。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-22 15:02:32 +08:00

46 lines
1.1 KiB
JavaScript

/**
* 空运群出站报文:禁止 stream(企微会加「内容由AI生成」和赞踩)。
* 只发 markdown,且不带 feedback。
* 有这次 @ 的 req_id 才走 aibot_respond_msg,群里才会引用原消息。
*/
function pickReplyReqId({ fromCaller, fromChat, lastAny }) {
const caller = String(fromCaller || "").trim();
if (caller) {
return caller;
}
const chat = String(fromChat || "").trim();
if (chat) {
return chat;
}
return String(lastAny || "").trim();
}
function buildGroupMessageFrame({ chatId, content, callbackReqId, reqId }) {
const text = String(content || "");
const markdown = { content: text };
if (callbackReqId) {
return {
cmd: "aibot_respond_msg",
headers: { req_id: callbackReqId },
body: {
chatid: chatId,
chat_type: 2,
msgtype: "markdown",
markdown,
},
};
}
return {
cmd: "aibot_send_msg",
headers: { req_id: reqId || "aibot_send_msg" },
body: {
chatid: chatId,
chat_type: 2,
msgtype: "markdown",
markdown,
},
};
}
module.exports = { buildGroupMessageFrame, pickReplyReqId };