Refactor CLI and file handling tools for improved functionality. Update CLI interrogation command for better clarity and adjust logging format. Modify list_files.js to enhance path display logic and update read_file.js schema to allow null values for optional parameters, improving flexibility in file reading operations.

This commit is contained in:
sebseb7
2025-08-21 12:58:14 +00:00
parent 6e8a336143
commit eb3f58b2e6
3 changed files with 10 additions and 7 deletions

View File

@@ -24,8 +24,8 @@ modelDialog.on('reasoningUpdate', (output) => {
//const output = await modelDialog.interrogate('Can you remember "seven" ?');
//console.log(output.output,JSON.stringify(output.reasoning,null,2));
//const output2 = await modelDialog.interrogate('read a file that is what you remebered plus 1 as a word with txt ending, check that file.');
const output2 = await modelDialog.interrogate('schaue welche Dateien du findet und wenn du webseiten findest, invertiere die farben in ihnen.');
const output2 = await modelDialog.interrogate('Hi, use the list files tools and the read files tool on /readme.txt in same variations to test it. use the tools in parallel.');
console.log('final output:',output2.output);
console.log('reasoning:',output2.reasoning);
console.log('Tokens:',output2.inputTokens,output2.cachedTokens,output2.outputTokens);
console.log('Ti:',output2.inputTokens,'Tc:',output2.cachedTokens,'To:',output2.outputTokens);
})()

View File

@@ -159,7 +159,10 @@ export async function run(args) {
return { err: `Path does not exist${inputPath ? `: ${inputPath}` : ""}` };
}
const cwd = path.relative(chrootResolved, stat.isFile() ? path.dirname(resolvedBase) : resolvedBase) || ".";
const cwd = toDisplayPath(
stat.isFile() ? path.dirname(resolvedBase) : resolvedBase,
chrootResolved
);
// Handle single file case
if (stat.isFile()) {

View File

@@ -8,12 +8,12 @@ const virtual_chroot = '/workspaces/aiTools/root';
// Ensures reads are confined to `virtual_chroot`.
export default {
type: "function", name: "read_file", description: "read a file", strict: true,
type: "function", name: "read_file", description: "read a file", strict: false,
parameters: {
type: "object", required: ["path","linesToSkip","linesToRead"], additionalProperties: false, properties: {
type: "object", required: ["path"], additionalProperties: false, properties: {
path: { type: "string", description: "The path to the file to read.", },
linesToSkip: { type: "integer", description: "The number of lines to skip. Use 0 to read from the beginning.", minimum: 0 },
linesToRead: { type: "integer", description: "1-400 The number of lines to read.", minimum: 1, maximum: 400 }
linesToSkip: { type: ["integer", "null"], description: "The number of lines to skip. Use 0 to read from the beginning, which is the default.", minimum: 0 },
linesToRead: { type: ["integer", "null"], description: "1-400 The number of lines to read. 400 is the default.", minimum: 1, maximum: 400 }
}
}
};