feat(ai): unify model discovery and effort handling
This commit is contained in:
@@ -17,6 +17,12 @@ pub async fn ai_list_models(config: AiConfig) -> Result<Vec<AiModelInfo>, String
|
||||
dbx_core::ai::list_models_core(&config).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn ai_resolve_model_effort(config: AiConfig, model_id: String) -> Result<AiEffortCapability, String> {
|
||||
let config = resolve_cli_provider_config(config);
|
||||
dbx_core::ai::resolve_model_effort_core(&config, &model_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn save_ai_config(state: State<'_, Arc<AppState>>, config: AiConfig) -> Result<(), String> {
|
||||
state.storage.save_ai_config(&config).await
|
||||
@@ -47,6 +53,19 @@ pub async fn load_ai_provider_configs(
|
||||
state.storage.load_ai_provider_configs().await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn save_ai_chat_selection(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
selection: AiChatSelectionState,
|
||||
) -> Result<(), String> {
|
||||
state.storage.save_ai_chat_selection(&selection).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn load_ai_chat_selection(state: State<'_, Arc<AppState>>) -> Result<Option<AiChatSelectionState>, String> {
|
||||
state.storage.load_ai_chat_selection().await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn ai_complete(request: AiCompletionRequest) -> Result<String, String> {
|
||||
dbx_core::ai::complete(&request).await
|
||||
|
||||
@@ -1303,10 +1303,13 @@ pub fn run() {
|
||||
commands::ai::ai_cancel_stream,
|
||||
commands::ai::ai_test_connection,
|
||||
commands::ai::ai_list_models,
|
||||
commands::ai::ai_resolve_model_effort,
|
||||
commands::ai::save_ai_config,
|
||||
commands::ai::load_ai_config,
|
||||
commands::ai::save_ai_provider_config,
|
||||
commands::ai::load_ai_provider_configs,
|
||||
commands::ai::save_ai_chat_selection,
|
||||
commands::ai::load_ai_chat_selection,
|
||||
commands::ai::save_ai_conversation,
|
||||
commands::ai::load_ai_conversations,
|
||||
commands::ai::delete_ai_conversation,
|
||||
|
||||
Reference in New Issue
Block a user