mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 13:00:33 +00:00
refactor(ai): Add completion signal to onText/onThinking callbacks
- Update LLMOptions interface to include completion boolean parameter - Modify all providers to signal when text/thinking blocks are complete - Update examples to handle the completion parameter - Move documentation files to docs/ directory
This commit is contained in:
parent
a42c54e6fe
commit
cb4c32faaa
11 changed files with 45 additions and 13 deletions
|
|
@ -91,21 +91,23 @@ export class OpenAIResponsesLLM implements LLM<OpenAIResponsesLLMOptions> {
|
|||
if (event.type === "response.reasoning_summary_text.delta") {
|
||||
const delta = event.delta;
|
||||
thinking += delta;
|
||||
options?.onThinking?.(delta);
|
||||
options?.onThinking?.(delta, false);
|
||||
} else if (event.type === "response.reasoning_summary_text.done") {
|
||||
if (event.text) {
|
||||
thinking = event.text;
|
||||
}
|
||||
options?.onThinking?.("", true);
|
||||
}
|
||||
// Handle main text output
|
||||
else if (event.type === "response.output_text.delta") {
|
||||
const delta = event.delta;
|
||||
content += delta;
|
||||
options?.onText?.(delta);
|
||||
options?.onText?.(delta, false);
|
||||
} else if (event.type === "response.output_text.done") {
|
||||
if (event.text) {
|
||||
content = event.text;
|
||||
}
|
||||
options?.onText?.("", true);
|
||||
}
|
||||
// Handle function calls
|
||||
else if (event.type === "response.output_item.done") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue