feat(llm): wire apiKey through setLlmProvider, add acknowledgeHostedAi (T10.2/T10.3)
settings.svelte.ts's setLlmProvider now accepts an optional apiKey (forwarded straight to the set_llm_provider command, which is the only place it gets stored — the OS credential store) and DEFAULT_SETTINGS gains hosted_ai_acknowledged. acknowledgeHostedAi() persists the one-time hosted-AI banner acknowledgment the same way acknowledgeConsent() does for recording consent.
This commit is contained in:
@@ -28,6 +28,7 @@ const DEFAULT_SETTINGS: AppSettings = {
|
|||||||
low_overhead: false,
|
low_overhead: false,
|
||||||
default_record: false, // recording OFF by default (ADR-0009)
|
default_record: false, // recording OFF by default (ADR-0009)
|
||||||
consent_acknowledged: false,
|
consent_acknowledged: false,
|
||||||
|
hosted_ai_acknowledged: false, // hosted-AI "leaves your device" notice (ADR-0011)
|
||||||
sync_enabled: false, // sync OFF by default (ADR-0010)
|
sync_enabled: false, // sync OFF by default (ADR-0010)
|
||||||
mcp_enabled: false, // MCP server OFF by default (ADR-0011)
|
mcp_enabled: false, // MCP server OFF by default (ADR-0011)
|
||||||
retention_max_age_days: null, // no cap by default (FR-STORE-2)
|
retention_max_age_days: null, // no cap by default (FR-STORE-2)
|
||||||
@@ -183,8 +184,16 @@ class SettingsStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Persist the LLM provider/endpoint/model and refresh status (T5.2). */
|
/** Persist the LLM provider/endpoint/model (+ hosted apiKey, ADR-0011) and
|
||||||
async setLlmProvider(config: { provider: string; endpoint?: string; model?: string }) {
|
* refresh status (T5.2/T10.2). The key is only ever sent to the backend
|
||||||
|
* command (which stores it in the OS credential store) — never held here
|
||||||
|
* beyond this call, and never merged into `this.settings`. */
|
||||||
|
async setLlmProvider(config: {
|
||||||
|
provider: string;
|
||||||
|
endpoint?: string;
|
||||||
|
model?: string;
|
||||||
|
apiKey?: string;
|
||||||
|
}) {
|
||||||
this.llmSaving = true;
|
this.llmSaving = true;
|
||||||
// Optimistic local update so the form reflects the change immediately.
|
// Optimistic local update so the form reflects the change immediately.
|
||||||
this.settings = {
|
this.settings = {
|
||||||
@@ -202,6 +211,13 @@ class SettingsStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Persist the one-time hosted-AI "leaves your device" acknowledgment
|
||||||
|
* (ADR-0011, T10.3) — same generic patch() every other boolean setting
|
||||||
|
* here uses (see setDefaultRecord below). */
|
||||||
|
acknowledgeHostedAi() {
|
||||||
|
return this.patch({ hosted_ai_acknowledged: true });
|
||||||
|
}
|
||||||
|
|
||||||
async setPreferredBackend(backend: AppSettings["preferred_backend"]) {
|
async setPreferredBackend(backend: AppSettings["preferred_backend"]) {
|
||||||
await this.patch({ preferred_backend: backend });
|
await this.patch({ preferred_backend: backend });
|
||||||
await this.loadHardware();
|
await this.loadHardware();
|
||||||
|
|||||||
Reference in New Issue
Block a user