u
This commit is contained in:
@@ -183,17 +183,16 @@ class LLMOrbiter {
|
||||
tools: toolSpecs.length ? toolSpecs : undefined,
|
||||
signal: runSignal,
|
||||
extraBody,
|
||||
onStatus: (s) => call(onStatus, s),
|
||||
onStatus: (...args) => call(onStatus, ...args),
|
||||
onContent: (...args) => call(onContent, ...args),
|
||||
onReasoning: (r) => call(onReasoning, r),
|
||||
});
|
||||
|
||||
// Accumulate usage & emit event per LLM call completed
|
||||
// Accumulate usage per LLM call completed
|
||||
const callUsage = this._addUsage(usage, completion.usage);
|
||||
if (completion.usage) {
|
||||
rawUsages.push(completion.usage);
|
||||
}
|
||||
await call(onUsage, callUsage);
|
||||
|
||||
const toolCalls = completion.tool_calls;
|
||||
const content = completion.content;
|
||||
@@ -202,6 +201,7 @@ class LLMOrbiter {
|
||||
|
||||
// When there is no response (neither tool calls nor content), the loop shall continue.
|
||||
if (!hasToolCalls && !hasContent) {
|
||||
await call(onUsage, callUsage);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@ class LLMOrbiter {
|
||||
// No tool calls → done
|
||||
if (!hasToolCalls) {
|
||||
finalContent = content;
|
||||
await call(onUsage, callUsage);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -318,6 +319,8 @@ class LLMOrbiter {
|
||||
recordToolResult(callItem, result);
|
||||
}
|
||||
|
||||
await call(onUsage, callUsage);
|
||||
|
||||
if (hasDirectReturn) break;
|
||||
|
||||
if (pendingAppendedMessages.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user