mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
Merge pull request #644 from Szpadel/oai-delta-und
Fix crash when delta in openai api handling could be empty in some ca…
This commit is contained in:
@@ -62,13 +62,15 @@ export class OpenAiHandler implements ApiHandler, SingleCompletionHandler {
|
|||||||
const stream = await this.client.chat.completions.create(requestOptions)
|
const stream = await this.client.chat.completions.create(requestOptions)
|
||||||
|
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
const delta = chunk.choices[0]?.delta
|
const delta = chunk.choices[0]?.delta ?? {}
|
||||||
if (delta?.content) {
|
|
||||||
|
if (delta.content) {
|
||||||
yield {
|
yield {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: delta.content,
|
text: delta.content,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("reasoning_content" in delta && delta.reasoning_content) {
|
if ("reasoning_content" in delta && delta.reasoning_content) {
|
||||||
yield {
|
yield {
|
||||||
type: "reasoning",
|
type: "reasoning",
|
||||||
|
|||||||
Reference in New Issue
Block a user