fix: read file tool allow ./ path format
This commit is contained in:
parent
6f42bd9749
commit
ebf8ea8006
1 changed files with 5 additions and 0 deletions
|
|
@ -33,6 +33,11 @@ export const readFileTool: Tool = {
|
|||
},
|
||||
run: async (args: { filepath: string }): Promise<string> => {
|
||||
try {
|
||||
let { filepath } = args;
|
||||
if (filepath.startsWith("./")) {
|
||||
filepath = filepath.slice(2);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(args.filepath)) {
|
||||
return `Error: File does not exist: ${args.filepath}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue