@dedenlabs/claude-code-router-cli 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.js +29 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Claude Code Router CLI v2.0.
|
|
1
|
+
# Claude Code Router CLI v2.0.7
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
[](https://github.com/dedenlabs/claude-code-router-cli)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](https://www.typescriptlang.org/)
|
package/dist/cli.js
CHANGED
|
@@ -85096,9 +85096,31 @@ ${allLines[totalLines - 1] || ""}`
|
|
|
85096
85096
|
switch (customFunction) {
|
|
85097
85097
|
case "modelContainsComma":
|
|
85098
85098
|
return context.req?.body?.model?.includes(",") || false;
|
|
85099
|
+
case "directProviderMapping":
|
|
85099
85100
|
case "directModelMapping":
|
|
85100
85101
|
const model = context.req?.body?.model;
|
|
85101
|
-
|
|
85102
|
+
if (!model || model.includes(",")) {
|
|
85103
|
+
return false;
|
|
85104
|
+
}
|
|
85105
|
+
const providers = context.req?.config?.Providers || [];
|
|
85106
|
+
const modelStr = String(model).toLowerCase();
|
|
85107
|
+
for (const provider of providers) {
|
|
85108
|
+
if (provider.models && Array.isArray(provider.models)) {
|
|
85109
|
+
if (provider.models.some((m) => String(m).toLowerCase() === modelStr)) {
|
|
85110
|
+
return true;
|
|
85111
|
+
}
|
|
85112
|
+
}
|
|
85113
|
+
if (String(provider.model || "").toLowerCase() === modelStr) {
|
|
85114
|
+
return true;
|
|
85115
|
+
}
|
|
85116
|
+
}
|
|
85117
|
+
const matchedProvider = providers.find(
|
|
85118
|
+
(p) => String(p.name).toLowerCase() === modelStr
|
|
85119
|
+
);
|
|
85120
|
+
if (matchedProvider) {
|
|
85121
|
+
return true;
|
|
85122
|
+
}
|
|
85123
|
+
return false;
|
|
85102
85124
|
default:
|
|
85103
85125
|
this.logger.warn(`\u672A\u77E5\u7684\u81EA\u5B9A\u4E49\u6761\u4EF6\u51FD\u6570: ${customFunction}`);
|
|
85104
85126
|
return false;
|
|
@@ -85209,10 +85231,10 @@ ${allLines[totalLines - 1] || ""}`
|
|
|
85209
85231
|
this.logger.debug("${subagent} \u53D8\u91CF\u66FF\u6362\u5931\u8D25\uFF0C\u4FDD\u6301\u539F\u6837");
|
|
85210
85232
|
return processedRoute;
|
|
85211
85233
|
}
|
|
85212
|
-
this.logger.
|
|
85213
|
-
`\u53D8\u91CF\u66FF\u6362\u672A\u5B8C\u6210\uFF0C\u4ECD\u5305\u542B\u672A\u66FF\u6362\u7684\u53D8\u91CF: ${processedRoute}\uFF0C\
|
|
85234
|
+
this.logger.debug(
|
|
85235
|
+
`\u53D8\u91CF\u66FF\u6362\u672A\u5B8C\u6210\uFF0C\u4ECD\u5305\u542B\u672A\u66FF\u6362\u7684\u53D8\u91CF: ${processedRoute}\uFF0C\u4FDD\u6301\u539F\u6837\u8FD4\u56DE`
|
|
85214
85236
|
);
|
|
85215
|
-
return
|
|
85237
|
+
return processedRoute;
|
|
85216
85238
|
}
|
|
85217
85239
|
return processedRoute;
|
|
85218
85240
|
}
|
|
@@ -85494,12 +85516,13 @@ function migrateLegacyConfig(legacy) {
|
|
|
85494
85516
|
enabled: true,
|
|
85495
85517
|
condition: {
|
|
85496
85518
|
type: "custom",
|
|
85497
|
-
customFunction: "
|
|
85519
|
+
customFunction: "directProviderMapping"
|
|
85520
|
+
// 新名称,兼容旧版本使用 directModelMapping
|
|
85498
85521
|
},
|
|
85499
85522
|
action: {
|
|
85500
85523
|
route: "${mappedModel}",
|
|
85501
85524
|
transformers: [],
|
|
85502
|
-
description: "\
|
|
85525
|
+
description: "Provider\u6620\u5C04\uFF1A\u9A8C\u8BC1\u5E76\u6620\u5C04provider\u540D\u79F0\u5230\u5176\u9ED8\u8BA4\u6A21\u578B"
|
|
85503
85526
|
}
|
|
85504
85527
|
});
|
|
85505
85528
|
rules.push({
|