protocol-proxy 2.1.5 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -122,14 +122,13 @@ function convertMessage(msg, idMap) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// user 消息含 tool_result → 拆分为多个 tool 消息
|
|
125
|
+
// OpenAI 要求 tool 消息紧跟 assistant tool_calls,user text 放在 tool 之后
|
|
125
126
|
if (msg.role === 'user' && toolResults.length > 0) {
|
|
126
127
|
const result = [];
|
|
127
|
-
|
|
128
|
-
// 但通常 tool_result 消息不会有额外的 user text
|
|
128
|
+
result.push(...toolResults);
|
|
129
129
|
if (textParts.length > 0) {
|
|
130
130
|
result.push({ role: 'user', content: textParts.join('') });
|
|
131
131
|
}
|
|
132
|
-
result.push(...toolResults);
|
|
133
132
|
return result;
|
|
134
133
|
}
|
|
135
134
|
|