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:
@@ -1,6 +1,6 @@
|
||||
import { createReadStream } from "node:fs";
|
||||
import { createInterface } from "node:readline";
|
||||
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const virtual_chroot = '/workspaces/aiTools/root';
|
||||
@@ -30,7 +30,10 @@ export async function run(args) {
|
||||
// Normalize linesToRead (1-400, with 0 or >400 meaning 400)
|
||||
const maxLines = (linesToRead <= 0 || linesToRead > 400) ? 400 : linesToRead;
|
||||
|
||||
// return 'FILE DOES NOT EXIST'
|
||||
// check if the file exists
|
||||
if (!fs.existsSync(fullPath)) {
|
||||
return `read_file error: File does not exist`;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -53,7 +56,7 @@ export async function run(args) {
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
return 'Filecontent: ´´´'+lines.join('')+'´´´';
|
||||
} catch (error) {
|
||||
return `read_file error: ${error.message}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user