Commit 8714b434 by Archer Committed by GitHub

fix: adapt sequence (#6496)

parent 87b0bca3
......@@ -15,4 +15,5 @@ description: 'FastGPT V4.14.8 更新说明'
## 🐛 修复
1. 新 SDK 兼容:连续调用同一个 MCP 服务时,多次连接导致报错。
2. 文本与工具同时输出时,保存后顺序异常。
......@@ -323,6 +323,18 @@ export const GPTMessages2Chats = ({
}
});
}
if (typeof item.content === 'string' && item.content) {
const lastValue = value[value.length - 1];
if (lastValue && lastValue.text) {
lastValue.text.content += item.content;
} else {
value.push({
text: {
content: item.content
}
});
}
}
if (item.tool_calls && reserveTool) {
// save tool calls
const toolCalls = item.tool_calls as ChatCompletionMessageToolCall[];
......@@ -384,18 +396,6 @@ export const GPTMessages2Chats = ({
interactive: item.interactive
});
}
if (typeof item.content === 'string' && item.content) {
const lastValue = value[value.length - 1];
if (lastValue && lastValue.text) {
lastValue.text.content += item.content;
} else {
value.push({
text: {
content: item.content
}
});
}
}
return {
dataId: item.dataId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment