Skip to content

Commit

Permalink
chore(version): 0.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kangfenmao committed Sep 20, 2024
1 parent 6bb7b2c commit a22a47c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CherryStudio",
"version": "0.7.4",
"version": "0.7.5",
"private": true,
"description": "A powerful AI assistant for producer.",
"main": "./out/main/index.js",
Expand Down
11 changes: 10 additions & 1 deletion src/renderer/src/providers/OpenAIProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,25 @@ export default class OpenAIProvider extends BaseProvider {
userMessages.push(await this.getMessageParam(message, model))
}

const isSupportStreamOutput = this.isSupportStreamOutput(model.id)

// @ts-ignore key is not typed
const stream = await this.sdk.chat.completions.create({
model: model.id,
messages: [systemMessage, ...userMessages].filter(Boolean) as ChatCompletionMessageParam[],
stream: this.isSupportStreamOutput(model.id),
stream: isSupportStreamOutput,
temperature: assistant?.settings?.temperature,
max_tokens: maxTokens,
keep_alive: this.keepAliveTime
})

if (!isSupportStreamOutput) {
return onChunk({
text: stream.choices[0].message?.content || '',
usage: stream.usage
})
}

for await (const chunk of stream) {
if (window.keyv.get(EVENT_NAMES.CHAT_COMPLETION_PAUSED)) {
break
Expand Down

0 comments on commit a22a47c

Please sign in to comment.