fix: better filename resolution, choosing another agent works
This commit is contained in:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user