mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 13:19:33 +08:00
fix(models): enhance Doubao model checks to include model.id conditions (#7657)
- Updated model checks in isFunctionCallingModel, isEmbeddingModel, isVisionModel, and isReasoningModel functions to consider model.id for 'doubao' provider. - Improved isOpenAIWebSearchModel to include additional conditions for model.id.
This commit is contained in:
parent
218dcc2229
commit
b0053b94a9
@ -386,10 +386,6 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient<
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const toolChoices: OpenAI.Responses.ToolChoiceTypes = {
|
|
||||||
type: 'web_search_preview'
|
|
||||||
}
|
|
||||||
|
|
||||||
tools = tools.concat(extraTools)
|
tools = tools.concat(extraTools)
|
||||||
const commonParams = {
|
const commonParams = {
|
||||||
model: model.id,
|
model: model.id,
|
||||||
@ -402,7 +398,6 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient<
|
|||||||
max_output_tokens: maxTokens,
|
max_output_tokens: maxTokens,
|
||||||
stream: streamOutput,
|
stream: streamOutput,
|
||||||
tools: !isEmpty(tools) ? tools : undefined,
|
tools: !isEmpty(tools) ? tools : undefined,
|
||||||
tool_choice: enableWebSearch ? toolChoices : undefined,
|
|
||||||
service_tier: this.getServiceTier(model),
|
service_tier: this.getServiceTier(model),
|
||||||
...(this.getReasoningEffort(assistant, model) as OpenAI.Reasoning),
|
...(this.getReasoningEffort(assistant, model) as OpenAI.Reasoning),
|
||||||
...this.getCustomParameters(assistant)
|
...this.getCustomParameters(assistant)
|
||||||
|
|||||||
@ -273,7 +273,7 @@ export function isFunctionCallingModel(model: Model): boolean {
|
|||||||
return ['deepseek-v3-tool', 'deepseek-v3-0324', 'qwq-32b', 'qwen2.5-72b-instruct'].includes(model.id)
|
return ['deepseek-v3-tool', 'deepseek-v3-0324', 'qwq-32b', 'qwen2.5-72b-instruct'].includes(model.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.provider === 'doubao') {
|
if (model.provider === 'doubao' || model.id.includes('doubao')) {
|
||||||
return FUNCTION_CALLING_REGEX.test(model.id) || FUNCTION_CALLING_REGEX.test(model.name)
|
return FUNCTION_CALLING_REGEX.test(model.id) || FUNCTION_CALLING_REGEX.test(model.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2327,7 +2327,7 @@ export function isEmbeddingModel(model: Model): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.provider === 'doubao') {
|
if (model.provider === 'doubao' || model.id.includes('doubao')) {
|
||||||
return EMBEDDING_REGEX.test(model.name)
|
return EMBEDDING_REGEX.test(model.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2351,7 +2351,7 @@ export function isVisionModel(model: Model): boolean {
|
|||||||
// return false
|
// return false
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (model.provider === 'doubao') {
|
if (model.provider === 'doubao' || model.id.includes('doubao')) {
|
||||||
return VISION_REGEX.test(model.name) || VISION_REGEX.test(model.id) || model.type?.includes('vision') || false
|
return VISION_REGEX.test(model.name) || VISION_REGEX.test(model.id) || model.type?.includes('vision') || false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2422,7 +2422,9 @@ export function isOpenAIWebSearchModel(model: Model): boolean {
|
|||||||
model.id.includes('gpt-4o-search-preview') ||
|
model.id.includes('gpt-4o-search-preview') ||
|
||||||
model.id.includes('gpt-4o-mini-search-preview') ||
|
model.id.includes('gpt-4o-mini-search-preview') ||
|
||||||
(model.id.includes('gpt-4.1') && !model.id.includes('gpt-4.1-nano')) ||
|
(model.id.includes('gpt-4.1') && !model.id.includes('gpt-4.1-nano')) ||
|
||||||
(model.id.includes('gpt-4o') && !model.id.includes('gpt-4o-image'))
|
(model.id.includes('gpt-4o') && !model.id.includes('gpt-4o-image')) ||
|
||||||
|
model.id.includes('o3') ||
|
||||||
|
model.id.includes('o4')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2555,8 +2557,9 @@ export function isReasoningModel(model?: Model): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.provider === 'doubao') {
|
if (model.provider === 'doubao' || model.id.includes('doubao')) {
|
||||||
return (
|
return (
|
||||||
|
REASONING_REGEX.test(model.id) ||
|
||||||
REASONING_REGEX.test(model.name) ||
|
REASONING_REGEX.test(model.name) ||
|
||||||
model.type?.includes('reasoning') ||
|
model.type?.includes('reasoning') ||
|
||||||
isSupportedThinkingTokenDoubaoModel(model) ||
|
isSupportedThinkingTokenDoubaoModel(model) ||
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user