pass token count to custom router

This commit is contained in:
musistudio
2025-08-03 07:38:51 +08:00
parent c2edcd145e
commit 7751683365

View File

@@ -129,6 +129,7 @@ export const router = async (req: any, _res: any, config: any) => {
if (config.CUSTOM_ROUTER_PATH) {
try {
const customRouter = require(config.CUSTOM_ROUTER_PATH);
req.tokenCount = tokenCount; // Pass token count to custom router
model = await customRouter(req, config);
} catch (e: any) {
log("failed to load custom router", e.message);