Skip to content

Commit

Permalink
Merge pull request #89 from HydroGest/dev
Browse files Browse the repository at this point in the history
[Fix] 适配 XML 格式下含消息元素消息的发送
  • Loading branch information
HydroGest authored Jan 26, 2025
2 parents 99433dd + e2b6e6a commit 572317d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class Bot {
} else if (LLMResponse.status === "function") {
return this.handleFunctionCalls(LLMResponse.functions, debug);
} else {
const reason = `Status 不是一个有效值: ${LLMResponse.status}`;
const reason = `status 不是一个有效值: ${LLMResponse.status}`;
return {
status: "fail",
raw: content,
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ ${toolsToString(functions)}
let { replyTo, finalReply, nextTriggerCount, logic, functions } = chatResponse as SuccessResponse;

if (isEmpty(replyTo)) replyTo = session.channelId;

finalReply = Array.isArray(finalReply)
? finalReply.join('') // 如果是数组,拼接成字符串。场景: 当使用 XML 格式时,此处中可能包含 <at/>、<quote> 等无法被正确解析成字符串。
: finalReply; // 如果是字符串,直接使用


sendQueue.setTriggerCount(channelId, nextTriggerCount);
template = `
Expand Down

0 comments on commit 572317d

Please sign in to comment.