feat: 更新大模型调用逻辑,直接传递发送者名字以优化用户输入格式

This commit is contained in:
zhaoyingbo 2024-12-02 08:19:11 +00:00
parent de0067ec17
commit 36c1dc2136

View File

@ -53,16 +53,13 @@ const agent = async (ctx: Context.Data) => {
}
}
// 获取发送者的名字
const userName = historyMentions.get(openId || "") ?? "用户"
userInput = `${userName}${userInput}`
// 调用大模型
try {
await updateCard(cardGender.genPendingCard("LLM激情输出中请稍等..."))
const llmRes = await llm.invoke(
"groupAgent",
{
userName: historyMentions.get(openId || "") ?? "用户",
userInput,
chatHistory: JSON.stringify(chatHistory),
time: new Date().toLocaleString("zh-CN", { timeZone: "Asia/Shanghai" }),