fix: a non-running instance is selected in creating benchmark

This commit is contained in:
jialin
2026-03-24 17:10:18 +08:00
parent d874e502e2
commit 59740d1601
+7 -1
View File
@@ -115,6 +115,7 @@ const ModelInstanceForm: React.FC = () => {
disabled: modelCategoriesMap.llm !== model.categories?.[0], disabled: modelCategoriesMap.llm !== model.categories?.[0],
id: model.id, id: model.id,
isLeaf: false, isLeaf: false,
ready_replicas: model.ready_replicas,
children: [] children: []
})); }));
@@ -123,15 +124,20 @@ const ModelInstanceForm: React.FC = () => {
} }
// preload instances for the first model // preload instances for the first model
const selectedllmModel = modelOptions.find((model) => !model.disabled); const selectedllmModel = modelOptions.find(
(model) => !model.disabled && model.ready_replicas > 0
);
if (!selectedllmModel) { if (!selectedllmModel) {
setModelList(modelOptions); setModelList(modelOptions);
return; return;
} }
const instanceList = await fetchInstanceList({ id: selectedllmModel.id }); const instanceList = await fetchInstanceList({ id: selectedllmModel.id });
const instanceOptions = instanceList.map((instance: any) => const instanceOptions = instanceList.map((instance: any) =>
renderInstance(instance) renderInstance(instance)
); );
if (selectedllmModel) { if (selectedllmModel) {
selectedllmModel.children = [...instanceOptions] as never[]; selectedllmModel.children = [...instanceOptions] as never[];
} }