feat: v0.3.0 - fix provider data loss, oauth corruption & switch UX
Bug fixes: - Fix config.toml wiped to single provider on switch (now writes all providers) - Fix managed:kimi-code oauth key corruption (oauth/kimi-code was rewritten to oauth/managed-kimi-code, breaking the official subscription) - Fix default_model not switching due to React 18 deferred state update (updateConfig now sets configRef synchronously before setConfig) - Strip KimiSwitch-private default_model from config.toml provider output Architecture: - config.toml is now the authoritative source for Kimi Code provider data - SQLite stores only metadata (notes, official URLs, remembered models) - Load reconciles config.toml with SQLite for external /provider changes - Activate is a no-op for KimiCode (save already writes config.toml) Features: - Selected provider moves to top of list on switch - Add models-dev context size lookup - Add tauri-plugin-single-instance Tests: - 3 new regression tests: oauth key round-trip, all-providers write, private default_model strip
This commit is contained in:
1 parent
5806fac056
commit
139af18826
15 files changed
+2398
-97
No files matched your search
@@ -3,6 +3,7 @@ import { invoke } from "@tauri-apps/api/core";
|
||||
import { useTranslation } from "../i18n";
|
||||
import type { TranslationKey } from "../i18n/zh";
|
||||
import { getDefaultMaxContextSize } from "../lib/model-defaults";
|
||||
import { capabilitiesFromRef, getModelRef } from "../lib/models-dev";
|
||||
import { AgentSettingsPanel } from "./AgentSettingsPanel";
|
||||
import type { Agent, DiscoveredModel, Model, Provider, ProviderType } from "../types";
|
||||
|
||||
@@ -400,15 +401,24 @@ function ModelMapping({
|
||||
for (const dm of discovered) {
|
||||
if (!selected.has(dm.id)) continue;
|
||||
const alias = dm.id.replace(/[^a-zA-Z0-9_-]/g, "-");
|
||||
const max_context_size = dm.max_context_size ?? getDefaultMaxContextSize(dm.id);
|
||||
const ref = getModelRef(dm.id);
|
||||
// Priority: API-provided value > models.dev reference > regex fallback
|
||||
const max_context_size =
|
||||
dm.max_context_size ?? ref?.context ?? getDefaultMaxContextSize(dm.id);
|
||||
toAdd.push({
|
||||
alias,
|
||||
provider: provider.name,
|
||||
model: dm.id,
|
||||
max_context_size,
|
||||
display_name: dm.display_name,
|
||||
display_name: dm.display_name ?? ref?.name ?? null,
|
||||
supports_1m: max_context_size >= 1_000_000,
|
||||
capabilities: fetchThinking ? ["thinking"] : [],
|
||||
// Reference data wins when available; otherwise keep the old
|
||||
// fetchThinking-checkbox behavior as the fallback.
|
||||
capabilities: ref
|
||||
? capabilitiesFromRef(ref)
|
||||
: fetchThinking
|
||||
? ["thinking"]
|
||||
: [],
|
||||
});
|
||||
}
|
||||
onBulkAdd(toAdd);
|
||||
|
||||
Reference in new issue
Block a user