release v1.0.45

This commit is contained in:
musistudio
2025-09-02 19:55:04 +08:00
parent 35fc4505b2
commit 5d53571fe6
7 changed files with 20 additions and 18 deletions

View File

@@ -570,6 +570,7 @@ A huge thank you to all our sponsors for their generous support!
- @zcutlip
- [@Peng-YM](http://github.com/Peng-YM)
- @\*更
- @\*.
(If your name is masked, please contact me via my homepage email to update it with your GitHub username.)

View File

@@ -539,6 +539,7 @@ jobs:
- @zcutlip
- [@Peng-YM](http://github.com/Peng-YM)
- @\*更
- @\*.
(如果您的名字被屏蔽,请通过我的主页电子邮件与我联系,以便使用您的 GitHub 用户名进行更新。)

View File

@@ -1,6 +1,6 @@
{
"name": "@musistudio/claude-code-router",
"version": "1.0.44",
"version": "1.0.45",
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
"bin": {
"ccr": "./dist/cli.js"
@@ -20,7 +20,7 @@
"license": "MIT",
"dependencies": {
"@fastify/static": "^8.2.0",
"@musistudio/llms": "^1.0.29",
"@musistudio/llms": "^1.0.30",
"dotenv": "^16.4.7",
"json5": "^2.2.3",
"openurl": "^1.1.1",

10
pnpm-lock.yaml generated
View File

@@ -12,8 +12,8 @@ importers:
specifier: ^8.2.0
version: 8.2.0
'@musistudio/llms':
specifier: ^1.0.29
version: 1.0.29(ws@8.18.3)
specifier: ^1.0.30
version: 1.0.30(ws@8.18.3)
dotenv:
specifier: ^16.4.7
version: 16.6.1
@@ -266,8 +266,8 @@ packages:
resolution: {integrity: sha512-9I2Zn6+NJLfaGoz9jN3lpwDgAYvfGeNYdbAIjJOqzs4Tpc+VU3Jqq4IofSUBKajiDS8k9fZIg18/z13mpk1bsA==}
engines: {node: '>=8'}
'@musistudio/llms@1.0.29':
resolution: {integrity: sha512-U1mAgkFuItc2pSgrT8YZl/v3bGC8MpWjHWcsIhFkce0kS6OKuj7QtZuCBC0MUetUFay8dmkSdRq7jM2qzb3N9A==}
'@musistudio/llms@1.0.30':
resolution: {integrity: sha512-vqeAz+noIm0G53DVDnyyAgv90HxObG/URlPjQE89YQafG10xkRUemHyuyscRgiHKvut9Z0FF0i8m0Uiqat068A==}
'@nodelib/fs.scandir@2.1.5':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
@@ -1111,7 +1111,7 @@ snapshots:
'@lukeed/ms@2.0.2': {}
'@musistudio/llms@1.0.29(ws@8.18.3)':
'@musistudio/llms@1.0.30(ws@8.18.3)':
dependencies:
'@anthropic-ai/sdk': 0.54.0
'@fastify/cors': 11.1.0

View File

@@ -17,15 +17,8 @@ class ImageCache {
});
}
calculateHash(base64Image: string): string {
const hash = createHash('sha256');
hash.update(base64Image);
return hash.digest('hex');
}
storeImage(id: string, source: any): void {
if (this.hasImage(id)) return;
const base64Image = source.data
this.cache.set(id, {
source,
timestamp: Date.now(),
@@ -62,7 +55,7 @@ export class ImageAgent implements IAgent {
}
shouldHandle(req: any, config: any): boolean {
if (!config.Router.image) return false;
if (!config.Router.image || req.body.model === config.Router.image) return false;
const lastMessage = req.body.messages[req.body.messages.length - 1]
if (!config.forceUseImageAgent && lastMessage.role === 'user' && Array.isArray(lastMessage.content) &&lastMessage.content.find((item: any) => item.type === 'image')) {
req.body.model = config.Router.image
@@ -109,6 +102,7 @@ export class ImageAgent implements IAgent {
"required": ["imageId", "task"]
},
handler: async (args, context) => {
console.log('args', JSON.stringify(args, null, 2))
const imageMessages = [];
let imageId;
@@ -127,7 +121,6 @@ export class ImageAgent implements IAgent {
delete args.imageId;
}
// Add text message with the response
if (Object.keys(args).length > 0) {
imageMessages.push({
type: "text",
@@ -146,7 +139,10 @@ export class ImageAgent implements IAgent {
model: context.config.Router.image,
system: [{
type: 'text',
text: `你需要按照任务去解析图片`
text: `You must interpret and analyze images strictly according to the assigned task.
When an image placeholder is provided, your role is to parse the image content only within the scope of the users instructions.
Do not ignore or deviate from the task.
Always ensure that your response reflects a clear, accurate interpretation of the image aligned with the given objective.`
}],
messages: [
{
@@ -159,6 +155,7 @@ export class ImageAgent implements IAgent {
}).then(res => res.json()).catch(err => {
return null;
});
console.log(agentResponse.content);
if (!agentResponse || !agentResponse.content) {
return 'analyzeImage Error';
}

View File

@@ -148,6 +148,9 @@ async function run(options: RunOptions = {}) {
// append agent tools
if (agent.tools.size) {
if (!req.body?.tools?.length) {
req.body.tools = []
}
req.body.tools.unshift(...Array.from(agent.tools.values()).map(item => {
return {
name: item.name,
@@ -211,6 +214,7 @@ async function run(options: RunOptions = {}) {
req,
config
});
console.log('result', toolResult)
toolMessages.push({
"tool_use_id": currentToolId,
"type": "tool_result",

View File

@@ -65,7 +65,6 @@ export async function executeCodeCommand(args: string[] = []) {
const stdioConfig: StdioOptions = config.NON_INTERACTIVE_MODE
? ["pipe", "inherit", "inherit"] // Pipe stdin for non-interactive
: "inherit"; // Default inherited behavior
console.log(joinedArgs)
const claudeProcess = spawn(
claudePath + (joinedArgs ? ` ${joinedArgs}` : ""),
[],