Fix prebuilt cards model configuration (#261)

- Set all prebuilt card models to blank ("model": "")
- Add model fallback in createProjectFromWorkflowJson to use PROVIDER_DEFAULT_MODEL
- Enables different models for OSS vs managed deployments via environment variable
This commit is contained in:
Tushar 2025-09-16 12:19:59 +05:30 committed by GitHub
parent 1072c8836c
commit cbcc1aa8a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 45 additions and 33 deletions

View file

@ -97,12 +97,24 @@ export async function createProjectFromWorkflowJson(formData: FormData): Promise
const workflowJson = formData.get('workflowJson') as string;
try {
// Parse workflow and apply default model to blank agent models
const workflow = JSON.parse(workflowJson);
const defaultModel = process.env.PROVIDER_DEFAULT_MODEL || 'gpt-4o';
if (workflow.agents && Array.isArray(workflow.agents)) {
workflow.agents.forEach((agent: any) => {
if (agent.model === '') {
agent.model = defaultModel;
}
});
}
const project = await createProjectController.execute({
userId: user.id,
data: {
name: name || '',
mode: {
workflowJson,
workflowJson: JSON.stringify(workflow),
},
},
});