diff --git a/src/utils/router.ts b/src/utils/router.ts index c9a3b54..b783aff 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -122,18 +122,19 @@ const getUseModel = async ( req.log.info(`Using background model for ${req.body.model}`); return config.Router.background; } + // The priority of websearch must be higher than thinking. + if ( + Array.isArray(req.body.tools) && + req.body.tools.some((tool: any) => tool.type?.startsWith("web_search")) && + config.Router.webSearch + ) { + return config.Router.webSearch; + } // if exits thinking, use the think model if (req.body.thinking && config.Router.think) { req.log.info(`Using think model for ${req.body.thinking}`); return config.Router.think; } - if ( - Array.isArray(req.body.tools) && - req.body.tools.some((tool: any) => tool.type?.startsWith("web_search")) && - config.Router.webSearch - ) { - return config.Router.webSearch; - } return config.Router!.default; };