fix fallback to the default model when no router configuration is provided
This commit is contained in:
@@ -244,3 +244,4 @@ Thanks to the following sponsors for supporting the continued development of thi
|
|||||||
@\*划 (可通过主页邮箱联系我修改 github 用户名)
|
@\*划 (可通过主页邮箱联系我修改 github 用户名)
|
||||||
[@Clarence-pan](https://github.com/Clarence-pan)
|
[@Clarence-pan](https://github.com/Clarence-pan)
|
||||||
[@carter003](https://github.com/carter003)
|
[@carter003](https://github.com/carter003)
|
||||||
|
@S\*r (可通过主页邮箱联系我修改 github 用户名)
|
||||||
@@ -9,19 +9,19 @@ const getUseModel = (req: any, tokenCount: number, config: any) => {
|
|||||||
return req.body.model;
|
return req.body.model;
|
||||||
}
|
}
|
||||||
// if tokenCount is greater than 60K, use the long context model
|
// if tokenCount is greater than 60K, use the long context model
|
||||||
if (tokenCount > 1000 * 60) {
|
if (tokenCount > 1000 * 60 && config.Router.longContext) {
|
||||||
log("Using long context model due to token count:", tokenCount);
|
log("Using long context model due to token count:", tokenCount);
|
||||||
return config.Router!.longContext;
|
return config.Router.longContext;
|
||||||
}
|
}
|
||||||
// If the model is claude-3-5-haiku, use the background model
|
// If the model is claude-3-5-haiku, use the background model
|
||||||
if (req.body.model?.startsWith("claude-3-5-haiku")) {
|
if (req.body.model?.startsWith("claude-3-5-haiku") && config.Router.background) {
|
||||||
log("Using background model for ", req.body.model);
|
log("Using background model for ", req.body.model);
|
||||||
return config.Router!.background;
|
return config.Router.background;
|
||||||
}
|
}
|
||||||
// if exits thinking, use the think model
|
// if exits thinking, use the think model
|
||||||
if (req.body.thinking) {
|
if (req.body.thinking && config.Router.think) {
|
||||||
log("Using think model for ", req.body.thinking);
|
log("Using think model for ", req.body.thinking);
|
||||||
return config.Router!.think;
|
return config.Router.think;
|
||||||
}
|
}
|
||||||
return config.Router!.default;
|
return config.Router!.default;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user