Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(evals): preserve configured model while options load (#15583)

marliessophie3a6b8bb3d605
diff --git a/web/src/features/playground/page/hooks/useModelParams.ts b/web/src/features/playground/page/hooks/useModelParams.ts
index b935daa2ad..9e69ba4429 100644
--- a/web/src/features/playground/page/hooks/useModelParams.ts
+++ b/web/src/features/playground/page/hooks/useModelParams.ts
@@ -46,6 +46,7 @@ export const useModelParams = (
},
{ enabled: Boolean(projectId) },
);
+ const hasLoadedLlmConnections = availableLLMApiKeys.data !== undefined;
// Generate window-specific localStorage keys
const modelNameKey = getModelNameKey(windowId ?? "");
@@ -200,8 +201,10 @@ export const useModelParams = (
]);
useEffect(() => {
+ if (!hasLoadedLlmConnections) return;
+
if (
- (availableModels.length > 0 && !modelParams.model.value) ||
+ !modelParams.model.value ||
!availableModels.includes(modelParams.model.value)
) {
if (persistedModelName && availableModels.includes(persistedModelName)) {
@@ -211,6 +214,7 @@ export const useModelParams = (
}
}
}, [
+ hasLoadedLlmConnections,
availableModels,
modelParams.model.value,
updateModelParamValue,