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

@@ -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}` : ""),
[],