fix(saas): remove hardcoded model fallback — dynamic from available models
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
- service.rs: template model passed as-is (Option<String>), no hardcoded fallback - saas-types.ts: AgentConfigFromTemplate.model → string | null - agentStore.ts: when model is null, resolve from saasStore.availableModels[0] - AgentOnboardingWizard.tsx: restore full file (was corrupted), apply assignTemplate try/catch fix
This commit is contained in:
@@ -10,6 +10,7 @@ import type { AgentTemplateFull } from '../lib/saas-client';
|
||||
import { saasClient } from '../lib/saas-client';
|
||||
import { useChatStore } from './chatStore';
|
||||
import { useConversationStore } from './chat/conversationStore';
|
||||
import { useSaaSStore } from './saasStore';
|
||||
import { createLogger } from '../lib/logger';
|
||||
|
||||
const log = createLogger('AgentStore');
|
||||
@@ -192,9 +193,14 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
|
||||
|
||||
set({ isLoading: true, error: null });
|
||||
try {
|
||||
// Step 1: Call backend to get server-processed config (tools merge, model fallback)
|
||||
// Step 1: Call backend to get server-processed config (tools merge)
|
||||
const config = await saasClient.createAgentFromTemplate(template.id);
|
||||
|
||||
// Resolve model: template model > first available SaaS model > 'default'
|
||||
const resolvedModel = config.model
|
||||
?? useSaaSStore.getState().availableModels[0]?.id
|
||||
?? 'default';
|
||||
|
||||
// Step 2: Create clone with merged data from backend
|
||||
const result = await client.createClone({
|
||||
name: config.name,
|
||||
@@ -202,7 +208,7 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
|
||||
personality: config.personality,
|
||||
scenarios: template.scenarios,
|
||||
communicationStyle: config.communication_style,
|
||||
model: config.model,
|
||||
model: resolvedModel,
|
||||
});
|
||||
|
||||
const cloneId = result?.clone?.id;
|
||||
|
||||
Reference in New Issue
Block a user