diff --git a/cli2.js b/cli2.js index f276b26..5a29f5e 100644 --- a/cli2.js +++ b/cli2.js @@ -24,7 +24,7 @@ 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('lege 5 Dateinen an, mache in jede eine webseite mit einem farbverlauf.'); + const output2 = await modelDialog.interrogate('schaue welche Dateien du findet und wenn du webseiten findest, invertiere die farben in ihnen.'); console.log('final output:',output2.output); console.log('reasoning:',output2.reasoning); console.log('Tokens:',output2.inputTokens,output2.cachedTokens,output2.outputTokens); diff --git a/tools/patch_files.js b/tools/patch_files.js index e572b45..018bea0 100644 --- a/tools/patch_files.js +++ b/tools/patch_files.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +import chalk from 'chalk'; + const desc = ` This is a custom utility that makes it more convenient to add, remove, move, or edit code files. 'apply_patch' effectively allows you to execute a diff/patch against a file, but the format of the diff specification is unique to this task, so pay careful attention to these instructions. @@ -612,10 +614,11 @@ function _get_updated_file(text, action, path) { function patch_to_commit(patch, orig, chroot = null) { const commit = new Commit(); for (const [path, action] of Object.entries(patch.actions)) { + const resolvedPath = resolvePath(chroot, path); if (action.type === ActionType.DELETE) { commit.changes[path] = new FileChange( ActionType.DELETE, - orig[path], + orig[resolvedPath], null, null ); @@ -630,11 +633,11 @@ function patch_to_commit(patch, orig, chroot = null) { null ); } else if (action.type === ActionType.UPDATE) { - const new_content = _get_updated_file(orig[path], action, path); + const new_content = _get_updated_file(orig[resolvedPath], action, path); const move_path = action.move_path ? unresolvePath(chroot, action.move_path) : null; commit.changes[path] = new FileChange( ActionType.UPDATE, - orig[path], + orig[resolvedPath], new_content, move_path ); @@ -824,6 +827,7 @@ export async function run(args) { ); return result; } catch (error) { + console.log(chalk.red('Patch error:'),error); return `Patch error: ${error.message}` } } \ No newline at end of file