mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 10:05:14 +00:00
guard azure responses deltas before content parts
This commit is contained in:
parent
3112526051
commit
01f559efc0
1 changed files with 6 additions and 0 deletions
|
|
@ -194,6 +194,9 @@ export const streamAzureOpenAIResponses: StreamFunction<"azure-openai-responses"
|
|||
}
|
||||
} else if (event.type === "response.output_text.delta") {
|
||||
if (currentItem && currentItem.type === "message" && currentBlock && currentBlock.type === "text") {
|
||||
if (!currentItem.content || currentItem.content.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const lastPart = currentItem.content[currentItem.content.length - 1];
|
||||
if (lastPart && lastPart.type === "output_text") {
|
||||
currentBlock.text += event.delta;
|
||||
|
|
@ -208,6 +211,9 @@ export const streamAzureOpenAIResponses: StreamFunction<"azure-openai-responses"
|
|||
}
|
||||
} else if (event.type === "response.refusal.delta") {
|
||||
if (currentItem && currentItem.type === "message" && currentBlock && currentBlock.type === "text") {
|
||||
if (!currentItem.content || currentItem.content.length === 0) {
|
||||
continue;
|
||||
}
|
||||
const lastPart = currentItem.content[currentItem.content.length - 1];
|
||||
if (lastPart && lastPart.type === "refusal") {
|
||||
currentBlock.text += event.delta;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue