fix: sync currentModel from SaaS available models on login
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

Root cause: conversationStore hardcoded 'glm-4-flash' as default model,
which may not exist in SaaS admin config, causing 404 on all chat requests.

- conversationStore: default currentModel to empty string (runtime-resolved)
- saasStore: after fetching available models, auto-switch currentModel
  to first available if the stored model is not in the list
- SaaS relay getModel() already had fallback to first available model
This commit is contained in:
iven
2026-04-09 18:50:38 +08:00
parent 1965fa5269
commit 125da57436
2 changed files with 19 additions and 1 deletions

View File

@@ -192,7 +192,7 @@ export const useConversationStore = create<ConversationState>()(
agents: [DEFAULT_AGENT],
currentAgent: DEFAULT_AGENT,
sessionKey: null,
currentModel: 'glm-4-flash-250414',
currentModel: '', // Set dynamically: SaaS models or config.toml default
newConversation: (currentMessages: ChatMessage[]) => {
const state = get();