feat: Enable search capability for Qwen commercial version model

This commit is contained in:
Yrom 2025-02-18 20:52:25 +08:00 committed by 亢奋猫
parent 7139d5093a
commit b38a9c954a

View File

@ -1668,6 +1668,11 @@ export function isWebSearchModel(model: Model): boolean {
if (provider.id === 'zhipu') {
return model?.id?.startsWith('glm-4-')
}
if (provider.id === 'dashscope') {
const models = ['qwen-turbo', 'qwen-max', 'qwen-plus']
// matches id like qwen-max-0919, qwen-max-latest
return models.some((i) => model.id.startsWith(i))
}
return false
}
@ -1680,7 +1685,14 @@ export function getOpenAIWebSearchParams(assistant: Assistant, model: Model): Re
if (model.provider === 'hunyuan') {
return { enable_enhancement: true }
}
if (model.provider === 'dashscope') {
return {
enable_search: true,
search_options: {
forced_search: true
}
}
}
return {
tools: webSearchTools
}