diff --git a/src/agents/image.agent.ts b/src/agents/image.agent.ts index b3d3d61..7df4718 100644 --- a/src/agents/image.agent.ts +++ b/src/agents/image.agent.ts @@ -102,21 +102,30 @@ export class ImageAgent implements IAgent { "required": ["imageId", "task"] }, handler: async (args, context) => { - console.log('args', JSON.stringify(args, null, 2)) const imageMessages = []; let imageId; // Create image messages from cached images - if (args.imageId && Array.isArray(args.imageId)) { - args.imageId.forEach((imgId: string) => { - const image = imageCache.getImage(`${context.req.id}_Image#${imgId}`); + if (args.imageId) { + if (Array.isArray(args.imageId)) { + args.imageId.forEach((imgId: string) => { + const image = imageCache.getImage(`${context.req.id}_Image#${imgId}`); + if (image) { + imageMessages.push({ + type: "image", + source: image, + }); + } + }); + } else { + const image = imageCache.getImage(`${context.req.id}_Image#${args.imageId}`); if (image) { imageMessages.push({ type: "image", source: image, }); } - }); + } imageId = args.imageId; delete args.imageId; } @@ -155,7 +164,6 @@ Always ensure that your response reflects a clear, accurate interpretation of th }).then(res => res.json()).catch(err => { return null; }); - console.log(agentResponse.content); if (!agentResponse || !agentResponse.content) { return 'analyzeImage Error'; } diff --git a/src/index.ts b/src/index.ts index e2adb51..7ffdadc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -244,7 +244,6 @@ async function run(options: RunOptions = {}) { req, config }); - console.log('result', toolResult) toolMessages.push({ "tool_use_id": currentToolId, "type": "tool_result", @@ -318,7 +317,6 @@ async function run(options: RunOptions = {}) { // 处理流提前关闭的错误 if (error.code === 'ERR_STREAM_PREMATURE_CLOSE') { - console.log('Stream prematurely closed, aborting operations'); abortController.abort(); return undefined; } @@ -368,7 +366,6 @@ async function run(options: RunOptions = {}) { done(null, payload) }); server.addHook("onSend", async (req, reply, payload) => { - console.log('主应用onSend') event.emit('onSend', req, reply, payload); return payload; }) diff --git a/ui/src/components/LogViewer.tsx b/ui/src/components/LogViewer.tsx index 8fbdc51..2c60863 100644 --- a/ui/src/components/LogViewer.tsx +++ b/ui/src/components/LogViewer.tsx @@ -502,7 +502,6 @@ export function LogViewer({ open, onOpenChange, showToast }: LogViewerProps) { // 如果在分组模式且选中了具体请求,显示该请求的日志 if (groupByReqId && groupedLogs && selectedReqId && groupedLogs.groups[selectedReqId]) { const requestLogs = groupedLogs.groups[selectedReqId]; - console.log(requestLogs) // 提取原始JSON字符串并每行一个 return requestLogs.map(log => JSON.stringify(log)).join('\n'); } @@ -552,7 +551,7 @@ export function LogViewer({ open, onOpenChange, showToast }: LogViewerProps) { const handleDebugClick = (lineNumber: number) => { console.log('handleDebugClick called with lineNumber:', lineNumber); console.log('Current state:', { groupByReqId, selectedReqId, logsLength: logs.length }); - + let logData = null; if (groupByReqId && groupedLogs && selectedReqId && groupedLogs.groups[selectedReqId]) { @@ -631,16 +630,16 @@ export function LogViewer({ open, onOpenChange, showToast }: LogViewerProps) { glyphMarginLeft: e.target.detail?.glyphMarginLeft, glyphMarginWidth: e.target.detail?.glyphMarginWidth }); - + // 检查是否点击在glyph margin区域 - const isGlyphMarginClick = e.target.detail && - e.target.detail.glyphMarginLane !== undefined && + const isGlyphMarginClick = e.target.detail && + e.target.detail.glyphMarginLane !== undefined && e.target.detail.offsetX !== undefined && e.target.detail.offsetX <= e.target.detail.glyphMarginLeft + e.target.detail.glyphMarginWidth; - + console.log('Is glyph margin click:', isGlyphMarginClick); - - if (e.target.position && isGlyphMarginClick) { + + if (e.target.position && isGlyphMarginClick) { const finalRequestLines = getFinalRequestLines(); console.log('Final request lines:', finalRequestLines); console.log('Clicked line number:', e.target.position.lineNumber);