sonnet 3.7 process thinking

This commit is contained in:
richardclim 2025-02-26 03:42:34 -05:00
parent 0ccf309519
commit 71d9235cac

View File

@ -241,9 +241,10 @@ export class ClaudeApi implements LLMApi {
name: string;
};
delta?: {
type: "text_delta" | "input_json_delta";
type: "text_delta" | "input_json_delta" | "thinking_delta";
text?: string;
partial_json?: string;
thinking?: string;
};
index: number;
};
@ -270,6 +271,9 @@ export class ClaudeApi implements LLMApi {
runTools[index]["function"]["arguments"] +=
chunkJson?.delta?.partial_json;
}
if (chunkJson?.delta?.type === "thinking_delta" && chunkJson?.delta?.thinking) {
return `🧠 ${chunkJson.delta.thinking}`;
}
return chunkJson?.delta?.text;
},
// processToolMessage, include tool_calls message and tool call results