fix: strengthen goal patch repair routing

This commit is contained in:
thanhnv
2026-07-18 11:36:03 +07:00
parent f23fb98953
commit 4f8a53bda9
5 changed files with 43 additions and 17 deletions
@@ -158,7 +158,7 @@ export class GoalsService {
return { model: String(runtime.CASAN_CHAT_SELECTED_MODEL || model), runtime };
});
const envCloudCandidates = [
process.env.OPENAI_API_KEY ? { model: `openai:${process.env.CASAN_GOAL_OPENAI_MODEL || 'gpt-4o-mini'}`, runtime: {} } : null,
process.env.OPENAI_API_KEY ? { model: `openai:${process.env.CASAN_GOAL_OPENAI_MODEL || 'gpt-4.1'}`, runtime: {} } : null,
process.env.ANTHROPIC_API_KEY ? { model: `anthropic:${process.env.CASAN_GOAL_ANTHROPIC_MODEL || 'claude-3-5-sonnet-latest'}`, runtime: {} } : null,
].filter((candidate): candidate is { model: string; runtime: Record<string, string> } => candidate !== null);
const cloudCandidates = [...envCloudCandidates, ...savedCloudCandidates].filter((candidate, index, rows) => rows.findIndex((row) => row.model === candidate.model) === index);