Add automatic folder creation for file operations and improve chat session handling
Implement `ensureFolderExists` in `ToolExecutor` to create parent directories when creating, moving, or renaming notes. Update `ChatView` to properly persist agent mode and derive session titles from the first user message. Fix error handling in tool execution to return structured failures instead of null, and include failure details in follow-up messages.
This commit is contained in:
@@ -5,11 +5,13 @@ export class Vault {
|
||||
getMarkdownFiles: () => any[];
|
||||
read: (file: any) => Promise<string>;
|
||||
create: (path: string, content: string) => Promise<any>;
|
||||
createFolder: (path: string) => Promise<any>;
|
||||
|
||||
constructor() {
|
||||
this.getMarkdownFiles = () => [];
|
||||
this.read = async () => '';
|
||||
this.create = async () => null;
|
||||
this.createFolder = async () => null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +115,14 @@ export interface TFile {
|
||||
path: string;
|
||||
}
|
||||
|
||||
export class TFolder {
|
||||
path: string;
|
||||
|
||||
constructor(path: string = '') {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
// Plugin class (used by main.ts)
|
||||
export class Plugin {
|
||||
app: App;
|
||||
|
||||
Reference in New Issue
Block a user