fix: adapt sequence (#6496)

This commit is contained in:
Archer
2026-03-03 22:26:25 +08:00
committed by GitHub
parent 87b0bca30c
commit 8714b43446
3 changed files with 261 additions and 260 deletions
+12 -12
View File
@@ -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,