You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AI cleanup: strip the stranded plaintext key from settings.json and delete dead opt-out commands
Two follow-ups to the AI-search fixes, both around the pre-`ai.cloudProvider` schema refactor:
**Plaintext key no longer lingers in `settings.json`.** The old schema left three flat keys behind — `ai.openaiApiKey` (a PLAINTEXT key), `ai.openaiBaseUrl`, `ai.openaiModel`. Nothing reads them (the key lives in the OS secret store, model/baseUrl in `ai.cloudProviderConfigs`), and the registry-driven save loop only manages registered ids, so they sat in `settings.json` forever — a plaintext key in Time Machine and cloud backups, exactly what the secret-store move was meant to prevent. `ai-config.ts::migrateLegacyOpenAiKeys` now lifts a stranded `ai.openaiApiKey` into the secret store if that's its only copy (so a tester who never re-entered it doesn't lose it AND gets working AI back), then deletes all three on startup. Split `migrateApiKeysFromSettings` into two independent steps so the flat-key cleanup still runs when `ai.cloudProviderConfigs` is missing/malformed (it used to early-return there). New raw-store helpers `getRawStoreValue` / `deleteRawStoreKeys` reach the non-registry keys.
**Deleted dead opt-out machinery.** `opt_in_ai`, `is_ai_opted_out`, and the `AiState.opted_out` field had no readers after the onboarding revamp (`ai.provider` is the source of truth). Removed the commands, their IPC registration + specta collection, the TS wrappers, and the field. Kept `uninstall_ai` — it's still wired to the Uninstall button in `AiLocalSection.svelte`, so the old "orphan" doc note was wrong on that one.
Fixed the stale `lib/ai/CLAUDE.md` claim that `ai.openai*` are registry settings; regenerated bindings. knip didn't catch the dead wrappers because `tauri-commands/**` is in its ignore list (IPC boundary).
Copy file name to clipboardExpand all lines: apps/desktop/src-tauri/src/ai/CLAUDE.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ Three provider modes:
32
32
33
33
Core: `get_ai_status`, `get_ai_model_info`, `get_ai_runtime_status`, `configure_ai`, `start_ai_server`, `stop_ai_server`, `check_ai_connection`, `start_ai_download`, `cancel_ai_download`, `get_folder_suggestions`, `stream_folder_suggestions`, `cancel_folder_suggestions`. Note: `get_system_memory_info` moved to top-level `system_memory.rs`.
34
34
API keys: `save_ai_api_key`, `get_ai_api_key`, `delete_ai_api_key`, `has_ai_api_key` (in `api_keys.rs`).
35
-
Orphan (no frontend callers after the onboarding revamp; flagged for follow-up cleanup): `uninstall_ai`, `opt_in_ai`, `is_ai_opted_out`. The post-FDA AI offer toast is gone, so `dismiss_ai_offer` and `opt_out_ai` were deleted with it.
35
+
Also: `uninstall_ai` (the Uninstall button in `AiLocalSection.svelte`). The dead opt-out machinery (`opt_in_ai`, `is_ai_opted_out`, `dismiss_ai_offer`, `opt_out_ai`, and the `AiState.opted_out` field) was removed with the onboarding revamp — `ai.provider` is the single source of truth for whether AI is on.
36
36
37
37
## Startup flow
38
38
@@ -83,7 +83,6 @@ The frontend (`AiSection.svelte`) tracks `installStep` state and displays "Step
83
83
- Binary re-extraction is possible if model exists but binary is missing.
84
84
- Download guard: `download_in_progress` flag prevents concurrent downloads.
85
85
- Server logs written to `llama-server.log` in the AI dir for debugging.
86
-
-`opted_out` field in `AiState` is legacy. `ai.provider` in frontend settings store is the source of truth.
87
86
- OpenAI config (api_key, base_url, model) stored in `ManagerState` so suggestions.rs can read without settings files. The api_key originates from the OS secret store (`api_keys.rs`), pushed in via `configure_ai`.
88
87
-`configure_ai` is idempotent -- frontend calls it on startup and whenever any AI setting changes.
89
88
-`ModelInfo` includes `kv_bytes_per_token` and `base_overhead_bytes` for frontend memory estimation.
0 commit comments