update task-loop type
This commit is contained in:
parent
942755b3e6
commit
8f6d431ef1
@ -359,11 +359,11 @@ export class TaskLoop {
|
|||||||
|
|
||||||
pinkLog('调用工具数量:' + this.streamingToolCalls.value.length);
|
pinkLog('调用工具数量:' + this.streamingToolCalls.value.length);
|
||||||
|
|
||||||
for (const toolCall of this.streamingToolCalls.value || []) {
|
for (let toolCall of this.streamingToolCalls.value || []) {
|
||||||
|
|
||||||
|
toolCall = this.onToolCall(toolCall);
|
||||||
const toolCallResult = await handleToolCalls(toolCall);
|
let toolCallResult = await handleToolCalls(toolCall);
|
||||||
this.onToolCalled(toolCallResult);
|
toolCallResult = this.onToolCalled(toolCallResult);
|
||||||
|
|
||||||
if (toolCallResult.state === MessageState.ParseJsonError) {
|
if (toolCallResult.state === MessageState.ParseJsonError) {
|
||||||
// 如果是因为解析 JSON 错误,则重新开始
|
// 如果是因为解析 JSON 错误,则重新开始
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "openmcp-sdk",
|
"name": "openmcp-sdk",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"description": "openmcp-sdk",
|
"description": "openmcp-sdk",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
2
resources/openmcp-sdk-release/task-loop.d.ts
vendored
2
resources/openmcp-sdk-release/task-loop.d.ts
vendored
@ -104,7 +104,7 @@ export class TaskLoop {
|
|||||||
* @description 注册当工具调用完成时的回调函数,会调用这个方法,可以拦截并修改 toolcall 的输出
|
* @description 注册当工具调用完成时的回调函数,会调用这个方法,可以拦截并修改 toolcall 的输出
|
||||||
* @param handler
|
* @param handler
|
||||||
*/
|
*/
|
||||||
registerOnToolCalled(handler: (toolCallResult: ToolCallResult) => void): void;
|
registerOnToolCalled(handler: (toolCallResult: ToolCallResult) => ToolCallResult): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 注册当工具调用前的回调函数,可以拦截并修改 toolcall 的输入
|
* @description 注册当工具调用前的回调函数,可以拦截并修改 toolcall 的输入
|
||||||
|
Loading…
x
Reference in New Issue
Block a user