refactor(api): simplify app type parameter handling to single required parameter

Replace the previous dual-parameter approach (app_type/app/appType) with a single required `app: String` parameter across all Tauri commands. This change:

- Introduces unified `parse_app()` helper replacing complex `resolve_app_type()` logic
- Updates all backend commands in config, mcp, and provider modules
- Aligns frontend API calls to use consistent `app` parameter naming
- Simplifies MSW test handlers by removing optional parameter handling

This improves API clarity and reduces parameter ambiguity while maintaining backward compatibility through error handling.
This commit is contained in:
Jason
2025-10-30 11:35:14 +08:00
parent 2aec407a2f
commit 931ef7d3dd
8 changed files with 92 additions and 166 deletions

View File

@@ -267,12 +267,7 @@ fn switch_provider_internal(
let app_type_str = app_type.as_str().to_string();
let provider_id_clone = provider_id.clone();
crate::commands::switch_provider(
app_state.clone(),
Some(app_type),
Some(app_type_str.clone()),
provider_id,
)
crate::commands::switch_provider(app_state.clone(), app_type_str.clone(), provider_id)
.map_err(AppError::Message)?;
// 切换成功后重新创建托盘菜单