feat: Add web search support for OpenRouter provider
This commit is contained in:
parent
e0fcdf43c5
commit
2094e2201a
@ -1671,12 +1671,17 @@ export function isWebSearchModel(model: Model): boolean {
|
|||||||
if (provider.id === 'zhipu') {
|
if (provider.id === 'zhipu') {
|
||||||
return model?.id?.startsWith('glm-4-')
|
return model?.id?.startsWith('glm-4-')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider.id === 'dashscope') {
|
if (provider.id === 'dashscope') {
|
||||||
const models = ['qwen-turbo', 'qwen-max', 'qwen-plus']
|
const models = ['qwen-turbo', 'qwen-max', 'qwen-plus']
|
||||||
// matches id like qwen-max-0919, qwen-max-latest
|
// matches id like qwen-max-0919, qwen-max-latest
|
||||||
return models.some((i) => model.id.startsWith(i))
|
return models.some((i) => model.id.startsWith(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (provider.id === 'openrouter') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1688,6 +1693,7 @@ export function getOpenAIWebSearchParams(assistant: Assistant, model: Model): Re
|
|||||||
if (model.provider === 'hunyuan') {
|
if (model.provider === 'hunyuan') {
|
||||||
return { enable_enhancement: true }
|
return { enable_enhancement: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.provider === 'dashscope') {
|
if (model.provider === 'dashscope') {
|
||||||
return {
|
return {
|
||||||
enable_search: true,
|
enable_search: true,
|
||||||
@ -1696,6 +1702,13 @@ export function getOpenAIWebSearchParams(assistant: Assistant, model: Model): Re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model.provider === 'openrouter') {
|
||||||
|
return {
|
||||||
|
plugins: [{ id: 'web' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tools: webSearchTools
|
tools: webSearchTools
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user