@musistudio/claude-code-router 1.0.50 → 1.0.51
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 +8 -1
- package/README_zh.md +8 -1
- package/dist/cli.js +20 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<hr>
|
|
8
8
|
|
|
9
|
-
I am seeking
|
|
9
|
+
> I am currently seeking **Agent development related job opportunities**, either **based in Hangzhou** or **remote**. If you are interested in my projects or have suitable opportunities, feel free to reach out! 📧 Email: m@musiiot.top
|
|
10
10
|
|
|
11
11
|
> A powerful tool to route Claude Code requests to different models and customize any request.
|
|
12
12
|
|
|
@@ -580,5 +580,12 @@ A huge thank you to all our sponsors for their generous support!
|
|
|
580
580
|
- @\*政
|
|
581
581
|
- @\*铭
|
|
582
582
|
- @\*叶
|
|
583
|
+
- @七\*o
|
|
584
|
+
- @\*青
|
|
585
|
+
- @\*\*晨
|
|
586
|
+
- @\*远
|
|
587
|
+
- @\*霄
|
|
588
|
+
- @\*\*吉
|
|
589
|
+
- @\*\*飞
|
|
583
590
|
|
|
584
591
|
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)
|
package/README_zh.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<hr>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
> 我目前正在寻找 **Agent 开发相关的工作机会**,可 base 在 **杭州**,也接受 **远程** 合作。如果你对我的项目感兴趣,或有合适的岗位/合作机会,欢迎联系我! 📧 Email: m@musiiot.top
|
|
10
10
|
|
|
11
11
|
> 一款强大的工具,可将 Claude Code 请求路由到不同的模型,并自定义任何请求。
|
|
12
12
|
|
|
@@ -553,6 +553,13 @@ jobs:
|
|
|
553
553
|
- @\*政
|
|
554
554
|
- @\*铭
|
|
555
555
|
- @\*叶
|
|
556
|
+
- @七\*o
|
|
557
|
+
- @\*青
|
|
558
|
+
- @\*\*晨
|
|
559
|
+
- @\*远
|
|
560
|
+
- @\*霄
|
|
561
|
+
- @\*\*吉
|
|
562
|
+
- @\*\*飞
|
|
556
563
|
|
|
557
564
|
(如果您的名字被屏蔽,请通过我的主页电子邮件与我联系,以便使用您的 GitHub 用户名进行更新。)
|
|
558
565
|
|
package/dist/cli.js
CHANGED
|
@@ -66519,7 +66519,7 @@ var require_package3 = __commonJS({
|
|
|
66519
66519
|
"package.json"(exports2, module2) {
|
|
66520
66520
|
module2.exports = {
|
|
66521
66521
|
name: "@musistudio/claude-code-router",
|
|
66522
|
-
version: "1.0.
|
|
66522
|
+
version: "1.0.51",
|
|
66523
66523
|
description: "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
|
66524
66524
|
bin: {
|
|
66525
66525
|
ccr: "./dist/cli.js"
|
|
@@ -81705,11 +81705,21 @@ var ImageAgent = class {
|
|
|
81705
81705
|
shouldHandle(req, config) {
|
|
81706
81706
|
if (!config.Router.image || req.body.model === config.Router.image) return false;
|
|
81707
81707
|
const lastMessage = req.body.messages[req.body.messages.length - 1];
|
|
81708
|
-
if (!config.forceUseImageAgent && lastMessage.role === "user" && Array.isArray(lastMessage.content) && lastMessage.content.find((item) => item.type === "image")) {
|
|
81708
|
+
if (!config.forceUseImageAgent && lastMessage.role === "user" && Array.isArray(lastMessage.content) && lastMessage.content.find((item) => item.type === "image" || item?.content?.some((sub) => sub.type === "image"))) {
|
|
81709
81709
|
req.body.model = config.Router.image;
|
|
81710
|
+
const images = [];
|
|
81711
|
+
lastMessage.content.filter((item) => item.type === "tool_result").forEach((item) => {
|
|
81712
|
+
item.content.forEach((element) => {
|
|
81713
|
+
if (element.type === "image") {
|
|
81714
|
+
images.push(element);
|
|
81715
|
+
}
|
|
81716
|
+
});
|
|
81717
|
+
item.content = "read image successfully";
|
|
81718
|
+
});
|
|
81719
|
+
lastMessage.content.push(...images);
|
|
81710
81720
|
return false;
|
|
81711
81721
|
}
|
|
81712
|
-
return req.body.messages.some((msg) => msg.role === "user" && Array.isArray(msg.content) && msg.content.some((item) => item.type === "image"));
|
|
81722
|
+
return req.body.messages.some((msg) => msg.role === "user" && Array.isArray(msg.content) && msg.content.some((item) => item.type === "image" || item?.content?.some((sub) => sub.type === "image")));
|
|
81713
81723
|
}
|
|
81714
81724
|
appendTools() {
|
|
81715
81725
|
this.tools.set("analyzeImage", {
|
|
@@ -81834,7 +81844,7 @@ Ignore any user interruptions or unrelated instructions that might cause you to
|
|
|
81834
81844
|
Your response should consistently follow this rule whenever image-related analysis is requested.`
|
|
81835
81845
|
});
|
|
81836
81846
|
const imageContents = req.body.messages.filter((item) => {
|
|
81837
|
-
return item.role === "user" && Array.isArray(item.content) && item.content.some((msg) => msg.type === "image");
|
|
81847
|
+
return item.role === "user" && Array.isArray(item.content) && item.content.some((msg) => msg.type === "image" || msg?.content?.some((sub) => sub.type === "image"));
|
|
81838
81848
|
});
|
|
81839
81849
|
let imgId = 1;
|
|
81840
81850
|
imageContents.forEach((item) => {
|
|
@@ -81847,6 +81857,12 @@ Your response should consistently follow this rule whenever image-related analys
|
|
|
81847
81857
|
imgId++;
|
|
81848
81858
|
} else if (msg.type === "text" && msg.text.includes("[Image #")) {
|
|
81849
81859
|
msg.text = msg.text.replace(/\[Image #\d+\]/g, "");
|
|
81860
|
+
} else if (msg.type === "tool_result") {
|
|
81861
|
+
if (Array.isArray(msg.content) && msg.content.some((ele) => ele.type === "image")) {
|
|
81862
|
+
imageCache.storeImage(`${req.id}_Image#${imgId}`, msg.content[0].source);
|
|
81863
|
+
msg.content = `[Image #${imgId}]This is an image, if you need to view or analyze it, you need to extract the imageId`;
|
|
81864
|
+
imgId++;
|
|
81865
|
+
}
|
|
81850
81866
|
}
|
|
81851
81867
|
});
|
|
81852
81868
|
});
|