feat(v031): vision IPC + preload (get-vision-models / set / refresh)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
altair823
2026-05-10 04:59:12 +09:00
parent 2179cfbf39
commit d03098cfac
4 changed files with 161 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import type { SettingsService } from '../services/SettingsService.js';
import type { SyncTimer } from '../services/SyncTimer.js';
import { collectAutostartState } from '../services/AutostartDiagnostic.js';
import { getInboxWindow as getInboxWindowSingleton } from '../windows/inboxWindow.js';
import { refreshVisionCache } from '../services/VisionDetect.js';
/**
* 외부 (트레이 / second-instance / 기타 main 프로세스 호출자) 에서 inbox 창에 view 전환을
@@ -378,4 +379,27 @@ export function registerSettingsApi(deps?: SettingsIpcDeps): void {
}
return { lastAt: last.lastAt, lastResult: last.lastResult, nextAt };
});
// v0.3.1 Cut F — vision IPC
ipcMain.handle('settings:get-vision-models', async () => {
const cache = await deps.settings.getVisionCapableCache();
const selected = await deps.settings.getVisionModel();
return { models: cache.models, at: cache.at, selected };
});
ipcMain.handle('settings:set-vision-model', async (_e, value: string | null) => {
const sanitized = typeof value === 'string' && value.trim().length > 0 ? value.trim() : null;
await deps.settings.setVisionModel(sanitized);
return { ok: true as const };
});
ipcMain.handle('settings:refresh-vision-cache', async () => {
const all = await deps.settings.getAll();
const endpoint = all.ollama?.endpoint;
if (!endpoint) {
return { ok: false as const, reason: 'no_endpoint' };
}
return refreshVisionCache({ settings: deps.settings, endpoint });
});
}