fix(ai): refactor AI model settings and fallback logic

This commit moves default model mappings into the backend, making it the single source of truth. The `get_ai_settings` command now merges user-defined settings with these defaults, so the UI always receives a complete and correct configuration. The model selection logic in `ai_ask_stream` was also simplified to use the merged settings, which fixes a bug where the system would use a global fallback instead of the correct model-specific default. Additionally, the `set_ai_settings` command now only persists user overrides, keeping the configuration file clean.
This commit is contained in:
ByteAtATime 2025-06-27 18:27:53 -07:00
parent 9b7b29d720
commit 5dafd76912
No known key found for this signature in database
5 changed files with 248 additions and 81 deletions

View file

@ -255,7 +255,9 @@ pub fn run() {
ai::is_ai_api_key_set,
ai::clear_ai_api_key,
ai::ai_ask_stream,
ai::get_ai_usage_history
ai::get_ai_usage_history,
ai::get_ai_settings,
ai::set_ai_settings
])
.setup(|app| {
let app_handle = app.handle().clone();