fix: o1模型设置使用优化 #172
This commit is contained in:
parent
f1cfdb29f8
commit
ff5de3625e
@ -134,13 +134,16 @@ export default class OpenAIProvider extends BaseProvider {
|
|||||||
userMessages.push(await this.getMessageParam(message, model))
|
userMessages.push(await this.getMessageParam(message, model))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isOpenAIo1 = model.id.includes('o1-')
|
||||||
const isSupportStreamOutput = streamOutput && this.isSupportStreamOutput(model.id)
|
const isSupportStreamOutput = streamOutput && this.isSupportStreamOutput(model.id)
|
||||||
|
|
||||||
// @ts-ignore key is not typed
|
// @ts-ignore key is not typed
|
||||||
const stream = await this.sdk.chat.completions.create({
|
const stream = await this.sdk.chat.completions.create({
|
||||||
model: model.id,
|
model: model.id,
|
||||||
messages: [systemMessage, ...userMessages].filter(Boolean) as ChatCompletionMessageParam[],
|
messages: [isOpenAIo1 ? undefined : systemMessage, ...userMessages].filter(
|
||||||
temperature: assistant?.settings?.temperature,
|
Boolean
|
||||||
|
) as ChatCompletionMessageParam[],
|
||||||
|
temperature: isOpenAIo1 ? 1 : assistant?.settings?.temperature,
|
||||||
max_tokens: maxTokens,
|
max_tokens: maxTokens,
|
||||||
keep_alive: this.keepAliveTime,
|
keep_alive: this.keepAliveTime,
|
||||||
stream: isSupportStreamOutput
|
stream: isSupportStreamOutput
|
||||||
|
|||||||
@ -29,9 +29,6 @@ export async function restore() {
|
|||||||
data = JSON.parse(await window.api.decompress(file.content))
|
data = JSON.parse(await window.api.decompress(file.content))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理文件内容
|
|
||||||
console.log('Parsed file content:', data)
|
|
||||||
|
|
||||||
await handleData(data)
|
await handleData(data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user