mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-18 17:33:08 +08:00
refactor(startup): improve first-launch import logic with per-table detection
- Replace global `is_empty_for_first_import()` with independent checks: - `is_mcp_table_empty()` for MCP server imports - `is_prompts_table_empty()` for prompt imports - Skills and providers already have built-in idempotency checks - Fix misleading logs in provider import: - Change `import_default_config` return type from `Result<()>` to `Result<bool>` - Return `true` when actually imported, `false` when skipped - Only log success message when import actually occurred - Add idempotency protection to `import_from_file_on_first_launch` This allows each data type to be independently recovered if deleted, rather than requiring all tables to be empty for any import to trigger.
This commit is contained in:
@@ -225,7 +225,9 @@ impl ProviderService {
|
||||
}
|
||||
|
||||
/// Import default configuration from live files (re-export)
|
||||
pub fn import_default_config(state: &AppState, app_type: AppType) -> Result<(), AppError> {
|
||||
///
|
||||
/// Returns `Ok(true)` if imported, `Ok(false)` if skipped.
|
||||
pub fn import_default_config(state: &AppState, app_type: AppType) -> Result<bool, AppError> {
|
||||
import_default_config(state, app_type)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user