mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 11:20:07 +08:00
fix(OpenAIProvider): refine system message handling for specific model IDs (#5397)
* fix(OpenAIProvider): refine system message handling for specific model IDs * refactor(OpenAIProvider): introduce OPENAI_NO_SUPPORT_DEV_ROLE_MODELS for model ID checks
This commit is contained in:
parent
0fe34a12a3
commit
175d189634
@ -2168,6 +2168,8 @@ export const GEMINI_SEARCH_MODELS = [
|
||||
'gemini-2.5-flash-preview-04-17'
|
||||
]
|
||||
|
||||
export const OPENAI_NO_SUPPORT_DEV_ROLE_MODELS = ['o1-preview', 'o1-mini']
|
||||
|
||||
export const PERPLEXITY_SEARCH_MODELS = ['sonar-pro', 'sonar', 'sonar-reasoning', 'sonar-reasoning-pro']
|
||||
|
||||
export function isTextToImageModel(model: Model): boolean {
|
||||
@ -2202,7 +2204,7 @@ export function isVisionModel(model: Model): boolean {
|
||||
if (!model) {
|
||||
return false
|
||||
}
|
||||
// 新添字段 copilot-vision-request 后可使用 vision
|
||||
// 新添字段 copilot-vision-request 后可使用 vision
|
||||
// if (model.provider === 'copilot') {
|
||||
// return false
|
||||
// }
|
||||
|
||||
@ -8,7 +8,8 @@ import {
|
||||
isReasoningModel,
|
||||
isSupportedModel,
|
||||
isVisionModel,
|
||||
isZhipuModel
|
||||
isZhipuModel,
|
||||
OPENAI_NO_SUPPORT_DEV_ROLE_MODELS
|
||||
} from '@renderer/config/models'
|
||||
import { getStoreSetting } from '@renderer/hooks/useSettings'
|
||||
import i18n from '@renderer/i18n'
|
||||
@ -317,7 +318,7 @@ export default class OpenAIProvider extends BaseProvider {
|
||||
const { contextCount, maxTokens, streamOutput } = getAssistantSettings(assistant)
|
||||
messages = addImageFileToContents(messages)
|
||||
let systemMessage = { role: 'system', content: assistant.prompt || '' }
|
||||
if (isOpenAIoSeries(model)) {
|
||||
if (isOpenAIoSeries(model) && !OPENAI_NO_SUPPORT_DEV_ROLE_MODELS.includes(model.id)) {
|
||||
systemMessage = {
|
||||
role: 'developer',
|
||||
content: `Formatting re-enabled${systemMessage ? '\n' + systemMessage.content : ''}`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user