@astack-tech/integrations 0.1.1-beta.0 → 0.1.1-beta.1
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.
package/package.json
CHANGED
|
@@ -325,11 +325,28 @@ class Deepseek extends Component {
|
|
|
325
325
|
|
|
326
326
|
// 如果有工具调用,添加到结果中
|
|
327
327
|
if (responseMessage.tool_calls && responseMessage.tool_calls.length > 0) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
328
|
+
// 为了兼容 Agent 组件期望的格式,保留 function 和 type 字段
|
|
329
|
+
// 同时为了满足内部 ToolCall 接口,也添加 tool_name 和 arguments 字段
|
|
330
|
+
result.tool_calls = responseMessage.tool_calls.map(toolCall => {
|
|
331
|
+
// 解析参数,确保是对象形式
|
|
332
|
+
const args =
|
|
333
|
+
typeof toolCall.function.arguments === 'string'
|
|
334
|
+
? JSON.parse(toolCall.function.arguments || '{}')
|
|
335
|
+
: toolCall.function.arguments || {};
|
|
336
|
+
|
|
337
|
+
return {
|
|
338
|
+
id: toolCall.id,
|
|
339
|
+
// 满足 Agent 组件期望的格式
|
|
340
|
+
function: {
|
|
341
|
+
name: toolCall.function.name,
|
|
342
|
+
arguments: toolCall.function.arguments || '{}',
|
|
343
|
+
},
|
|
344
|
+
type: 'function',
|
|
345
|
+
// 满足内部 ToolCall 接口
|
|
346
|
+
tool_name: toolCall.function.name,
|
|
347
|
+
arguments: args,
|
|
348
|
+
};
|
|
349
|
+
});
|
|
333
350
|
}
|
|
334
351
|
|
|
335
352
|
return result;
|