fix(desktop): 模型自动路由 — 首次登录自动选择可用模型
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- saasStore: fetchAvailableModels 处理 currentModel 为空的情况,自动选择第一个可用模型 - connectionStore: SaaS relay 连接成功后同步 currentModel 到 conversationStore - 同时覆盖 Tauri 和浏览器两条 SaaS relay 路径 - 修复首次登录用户需手动选模型的问题
This commit is contained in:
@@ -488,11 +488,15 @@ export const useSaaSStore = create<SaaSStore>((set, get) => {
|
||||
const { useConversationStore } = await import('./chat/conversationStore');
|
||||
const current = useConversationStore.getState().currentModel;
|
||||
const modelIds = models.map(m => m.alias || m.id);
|
||||
if (current && !modelIds.includes(current)) {
|
||||
const firstModel = models[0];
|
||||
const fallbackId = firstModel.alias || firstModel.id;
|
||||
const firstModel = models[0];
|
||||
const fallbackId = firstModel.alias || firstModel.id;
|
||||
if (!current || !modelIds.includes(current)) {
|
||||
useConversationStore.getState().setCurrentModel(fallbackId);
|
||||
log.info(`Synced currentModel: ${current} not available, switched to ${fallbackId}`);
|
||||
if (current) {
|
||||
log.info(`Synced currentModel: ${current} not available, switched to ${fallbackId}`);
|
||||
} else {
|
||||
log.info(`Auto-selected first available model: ${fallbackId}`);
|
||||
}
|
||||
}
|
||||
} catch (syncErr) {
|
||||
log.warn('Failed to sync currentModel after fetching models:', syncErr);
|
||||
|
||||
Reference in New Issue
Block a user