You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The azure openai chat completion with streaming mode will return a empty "choices" at first time. It make openai coploit privoder throw an error:
copilot_provider_side_error: Provider openai failed with unexpected_response error: Cannot read properties of undefined (reading 'delta')
at OpenAIProvider.handleError (file:///app/dist/plugins/copilot/providers/openai.js:131:20)
at OpenAIProvider.generateTextStream (file:///app/dist/plugins/copilot/providers/openai.js:191:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
And the solution is very simple, just add a '?' at the follow location:
// plugins/copilot/providers/openai.ts
for await (const message of result) {
- const content = message.choices[0].delta.content;
+ const content = message.choices[0]?.delta.content;
if (content) {
yield content;
if (options.signal?.aborted) {
result.controller.abort();
break;
}
}
}
NOTE: Because I deploy my privite affine project with offical docker image, I fix the above bug by updating file /app/dist/plugins/copilot/providers/openai.js directly.
Distribution version
Web (app.affine.pro)
What browsers are you seeing the problem on if you're using web version?
No response
Are you self-hosting?
Yes
Relevant log output
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
according to openai's doc, the array will have least one element, it may be due to non-standard impl by third party.
but for minor implementation deviations, i think add fault tolerance to support them is not bad
i will make a pr later
What happened?
the coploit provider support openai means that Azure OpenAI also is useable with special config:
The azure openai chat completion with streaming mode will return a empty "choices" at first time. It make openai coploit privoder throw an error:
And the solution is very simple, just add a '?' at the follow location:
NOTE: Because I deploy my privite affine project with offical docker image, I fix the above bug by updating file /app/dist/plugins/copilot/providers/openai.js directly.
Distribution version
Web (app.affine.pro)
What browsers are you seeing the problem on if you're using web version?
No response
Are you self-hosting?
Relevant log output
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: