Refactor logging in CLI and ModelDialog to improve clarity by commenting out verbose console outputs. Update function call result logging to include limited arguments and JSON stringification for better readability. Enhance error handling in read_file.js to check for file existence before processing.

This commit is contained in:
sebseb7
2025-08-14 10:09:24 +00:00
parent 657b6af993
commit 421b47355b
4 changed files with 22 additions and 13 deletions

View File

@@ -135,10 +135,7 @@ class ModelDialog {
const limitedArgs = typeof toolCall.arguments === 'string'
? (toolCall.arguments.length > 400 ? toolCall.arguments.slice(0, 400) + '...[truncated]' : toolCall.arguments)
: toolCall.arguments;
console.log(
chalk.green('tool call:'),
{ ...toolCall, arguments: limitedArgs }
);
const tool = toolsByFile[toolCall.name];
let args;
try{
@@ -153,7 +150,7 @@ class ModelDialog {
continue;
}
const result = await tool.run(args);
console.log(chalk.green('function call result:'),'<toolCall.name>',toolCall.name,'</toolCall.name>\n','<args>',args,'</args>\n','<result>',result,'</result>');
console.log(chalk.green('function call result:'),'<toolCall.name>',toolCall.name,'</toolCall.name>\n','<args>',limitedArgs,'</args>\n','<result>',JSON.stringify(result).slice(0,100),'...</result>');
this.messages.push({
type: "function_call_output",
call_id: toolCall.call_id,