Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion evals/apps/web/src/app/runs/new/new-run.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,49 @@ export function NewRun() {
.parse(JSON.parse(await file.text()))

const providerSettings = providerProfiles.apiConfigs[providerProfiles.currentApiConfigName] ?? {}
const { apiProvider, openRouterModelId, openAiModelId } = providerSettings
const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the provider model mapping logic (destructuring and switch-case) into a separate helper function to reduce duplication and improve maintainability, especially as more providers are supported.

apiProvider,
apiModelId,
openRouterModelId,
glamaModelId,
requestyModelId,
unboundModelId,
ollamaModelId,
lmStudioModelId,
openAiModelId,
} = providerSettings

switch (apiProvider) {
case "anthropic":
case "bedrock":
case "deepseek":
case "gemini":
case "mistral":
case "openai-native":
case "vertex":
setValue("model", apiModelId ?? "")
break
case "openrouter":
setValue("model", openRouterModelId ?? "")
break
case "glama":
setValue("model", glamaModelId ?? "")
break
case "requesty":
setValue("model", requestyModelId ?? "")
break
case "unbound":
setValue("model", unboundModelId ?? "")
break
case "openai":
setValue("model", openAiModelId ?? "")
break
case "ollama":
setValue("model", ollamaModelId ?? "")
break
case "lmstudio":
setValue("model", lmStudioModelId ?? "")
break
default:
throw new Error(`Unsupported API provider: ${apiProvider}`)
}
Expand Down