fix: better filename resolution, choosing another agent works

This commit is contained in:
hh
2026-05-21 20:11:52 +02:00
parent 2b00fa44d5
commit 93b52f0621
4 changed files with 86 additions and 46 deletions
+22
View File
@@ -5,13 +5,19 @@ import type BeaverPlugin from "./main";
export interface BeaverSettings {
baseUrl: string;
token: string;
vaultSubpath: string;
}
export const DEFAULT_SETTINGS: BeaverSettings = {
baseUrl: "http://localhost:62993",
token: "",
vaultSubpath: "",
};
export function normalizeSubpath(raw: string): string {
return raw.trim().replace(/^\/+|\/+$/g, "");
}
export class BeaverSettingsTab extends PluginSettingTab {
plugin: BeaverPlugin;
@@ -51,6 +57,22 @@ export class BeaverSettingsTab extends PluginSettingTab {
});
});
new Setting(containerEl)
.setName("Vault subpath")
.setDesc(
"Folder in this Obsidian vault that maps to the gateway's vault root. " +
"Leave empty if the two vault roots match. Example: `💬 чаты`.",
)
.addText((text) =>
text
.setPlaceholder("")
.setValue(this.plugin.settings.vaultSubpath)
.onChange(async (value) => {
this.plugin.settings.vaultSubpath = normalizeSubpath(value);
await this.plugin.saveSettings();
}),
);
new Setting(containerEl)
.setName("Test connection")
.setDesc("Calls GET /agents and reports the count.")