From e7aac14ef1a67a0fe0d1916efad90e89e15b5775 Mon Sep 17 00:00:00 2001 From: jialin Date: Tue, 28 Apr 2026 12:37:33 +0800 Subject: [PATCH] fix: keep previous run checkbox visible and fall back to main worker --- .../llmodels/components/view-logs-modal.tsx | 66 ++++++++++++------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/src/pages/llmodels/components/view-logs-modal.tsx b/src/pages/llmodels/components/view-logs-modal.tsx index 0f5adca4..45c3eb15 100644 --- a/src/pages/llmodels/components/view-logs-modal.tsx +++ b/src/pages/llmodels/components/view-logs-modal.tsx @@ -131,16 +131,34 @@ const ViewLogsModal: React.FC = (props) => { }; const showCascader = - countOptions?.some((option) => option.children!?.length >= 2) || + countOptions?.some((option) => option.children?.length >= 2) || countOptions?.length > 1; const handleOnChecked = (e: any) => { const checked = e.target.checked; - const selectItem = currentWorkerCountList.find( - (item) => item.previous === checked - ); setShowPrevious(checked); - handleOnChange(selectItem); + + if (checked) { + const currentPrev = currentWorkerCountList.find((item) => item.previous); + if (currentPrev) { + handleOnChange(currentPrev); + return; + } + const mainOptionWithPrev = countOptions?.find( + (option) => + option.isMain && option.children?.some((child) => child.previous) + ); + const prevChild = mainOptionWithPrev?.children?.find( + (child) => child.previous + ); + if (prevChild) { + handleOnChange(prevChild); + } + return; + } + + const currentItem = currentWorkerCountList.find((item) => !item.previous); + handleOnChange(currentItem); }; const optionRender = (option: any) => { @@ -177,32 +195,30 @@ const ViewLogsModal: React.FC = (props) => { marginRight: 8 }} > - {currentWorkerCountList.length > 1 && ( - - - - {intl.formatMessage({ - id: 'models.instance.previousRun' - })} - : - + + + {intl.formatMessage({ - id: 'models.instance.startHistory.tips' + id: 'models.instance.previousRun' })} + : - } - > - {intl.formatMessage({ - id: 'models.instance.previousRun' + id: 'models.instance.startHistory.tips' })} - - - - )} + } + > + + {intl.formatMessage({ + id: 'models.instance.previousRun' + })} + + + +