diff --git a/src/miyo/miyoUtils.ts b/src/miyo/miyoUtils.ts index 4f6d13c0..be60491e 100644 --- a/src/miyo/miyoUtils.ts +++ b/src/miyo/miyoUtils.ts @@ -36,12 +36,21 @@ export function shouldUseMiyo(settings: CopilotSettings): boolean { } /** - * Resolve the current vault folder path sent to Miyo as `folder_path`. + * Resolve the folder path sent to Miyo as `folder_path`. + * + * When a remote server URL is configured and the user has set a remote vault folder, + * that override is used — the remote machine's folder path may differ from the local + * vault path. Falls back to the local vault filesystem path, then vault name. * * @param app - Obsidian application instance. - * @returns Current vault filesystem path when available, otherwise vault name. + * @param settings - Current Copilot settings. + * @returns Remote vault folder override when applicable, otherwise local vault path. */ -export function getMiyoFolderPath(app: App): string { +export function getMiyoFolderPath(app: App, settings: CopilotSettings): string { + const remoteVaultFolder = (settings.miyoRemoteVaultPath || "").trim(); + if (remoteVaultFolder && getMiyoCustomUrl(settings)) { + return remoteVaultFolder; + } const vaultPath = getVaultBasePath(app); if (vaultPath) { return vaultPath; diff --git a/src/search/findRelevantNotes.ts b/src/search/findRelevantNotes.ts index 8bac26ea..a2b43c30 100644 --- a/src/search/findRelevantNotes.ts +++ b/src/search/findRelevantNotes.ts @@ -129,7 +129,7 @@ async function calculateSimilarityScoreFromMiyo(filePath: string): Promise { onChange={(value) => updateSetting("miyoServerUrl", value)} /> + {(settings.miyoServerUrl || "").trim() && ( + updateSetting("miyoRemoteVaultPath", value)} + placeholder="e.g. /Users/you/Documents/vault" + /> + )} + {
Folder path sent to Miyo:{" "} - {getMiyoFolderPath(app)} + {getMiyoFolderPath(app, settings)}
)}