mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Include user's current active file path in chat requests - Move conversation save after attachments are added - Extract formattedRequest in suggest handler - Add WorkSpaceService.getActiveFile() method - Remove premature chatArea layout update - Update unit tests
21 lines
No EOL
740 B
TypeScript
21 lines
No EOL
740 B
TypeScript
import type VaultkeeperAIPlugin from "main";
|
|
import { Resolve } from "./DependencyService";
|
|
import { Services } from "./Services";
|
|
import type { TFile, WorkspaceLeaf } from "obsidian";
|
|
|
|
export class WorkSpaceService {
|
|
private readonly plugin: VaultkeeperAIPlugin = Resolve<VaultkeeperAIPlugin>(Services.VaultkeeperAIPlugin);
|
|
|
|
public async openNote(noteName: string) {
|
|
const file: TFile | null = this.plugin.app.metadataCache.getFirstLinkpathDest(noteName, "");
|
|
const leaf: WorkspaceLeaf = this.plugin.app.workspace.getLeaf(false);
|
|
|
|
if (file) {
|
|
await leaf.openFile(file);
|
|
}
|
|
}
|
|
|
|
public getActiveFile(): TFile | null {
|
|
return this.plugin.app.workspace.getActiveFile();
|
|
}
|
|
} |