From 566cd208498b2e63564db7780c82a7ee268939d4 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 11:37:12 +0800 Subject: [PATCH 1/3] feat: dataset config support readonly --- .../app/configuration/config/index.tsx | 2 +- .../dataset-config/card-item/item.tsx | 23 +++++++++++-------- .../configuration/dataset-config/index.tsx | 12 ++++++---- .../components/app/configuration/preview.tsx | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/web/app/components/app/configuration/config/index.tsx b/web/app/components/app/configuration/config/index.tsx index 3e8b5f1caa..adef93f541 100644 --- a/web/app/components/app/configuration/config/index.tsx +++ b/web/app/components/app/configuration/config/index.tsx @@ -79,7 +79,7 @@ const Config: FC = () => { {/* Dataset */} {/* Tools */} diff --git a/web/app/components/app/configuration/dataset-config/card-item/item.tsx b/web/app/components/app/configuration/dataset-config/card-item/item.tsx index b671d9c146..8d9155b0f0 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/item.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/item.tsx @@ -29,6 +29,7 @@ const Item: FC = ({ config, onSave, onRemove, + readonly = false, editable = true, }) => { const media = useBreakpoints() @@ -68,7 +69,7 @@ const Item: FC = ({
{ - editable && { e.stopPropagation() setShowSettingsModal(true) @@ -77,14 +78,18 @@ const Item: FC = ({ } - onRemove(config.id)} - state={isDeleting ? ActionButtonState.Destructive : ActionButtonState.Default} - onMouseEnter={() => setIsDeleting(true)} - onMouseLeave={() => setIsDeleting(false)} - > - - + { + !readonly && ( + onRemove(config.id)} + state={isDeleting ? ActionButtonState.Destructive : ActionButtonState.Default} + onMouseEnter={() => setIsDeleting(true)} + onMouseLeave={() => setIsDeleting(false)} + > + + + ) + }
{ config.indexing_technique && { +type Props = { + readonly?: boolean +} +const DatasetConfig: FC = ({ readonly }) => { const { t } = useTranslation() const userProfile = useAppContextSelector(s => s.userProfile) const { @@ -254,10 +257,10 @@ const DatasetConfig: FC = () => { className='mt-2' title={t('appDebug.feature.dataSet.title')} headerRight={ -
+ !readonly && (
{!isAgent && } -
+
) } hasHeaderBottomBorder={!hasData} noBodySpacing @@ -271,7 +274,8 @@ const DatasetConfig: FC = () => { config={item} onRemove={onRemove} onSave={handleSave} - editable={item.editable} + editable={item.editable && !readonly} + readonly={readonly} /> ))} diff --git a/web/app/components/app/configuration/preview.tsx b/web/app/components/app/configuration/preview.tsx index eceb4972aa..7679ee13b6 100644 --- a/web/app/components/app/configuration/preview.tsx +++ b/web/app/components/app/configuration/preview.tsx @@ -305,7 +305,7 @@ const Configuration: FC = ({ return ( -
+
From 3b64e118d08f3b190bbbf13d434e4cd25706b72a Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 11:39:41 +0800 Subject: [PATCH 2/3] chore: readonly ui --- web/app/components/app/configuration/config-var/var-item.tsx | 2 +- .../app/configuration/dataset-config/card-item/item.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/app/components/app/configuration/config-var/var-item.tsx b/web/app/components/app/configuration/config-var/var-item.tsx index 78ed4b1031..9b11d65589 100644 --- a/web/app/components/app/configuration/config-var/var-item.tsx +++ b/web/app/components/app/configuration/config-var/var-item.tsx @@ -33,7 +33,7 @@ const VarItem: FC = ({ const [isDeleting, setIsDeleting] = useState(false) return ( -
+
diff --git a/web/app/components/app/configuration/dataset-config/card-item/item.tsx b/web/app/components/app/configuration/dataset-config/card-item/item.tsx index 8d9155b0f0..60200c4a8d 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/item.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/item.tsx @@ -56,6 +56,7 @@ const Item: FC = ({
Date: Wed, 15 Oct 2025 13:48:39 +0800 Subject: [PATCH 3/3] chore: user input readonly --- .../app/configuration/config/index.tsx | 1 + .../configuration/dataset-config/index.tsx | 43 ++++++++++--------- .../app/configuration/debug/index.tsx | 23 ++++++---- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/web/app/components/app/configuration/config/index.tsx b/web/app/components/app/configuration/config/index.tsx index adef93f541..79bae2bcd3 100644 --- a/web/app/components/app/configuration/config/index.tsx +++ b/web/app/components/app/configuration/config/index.tsx @@ -80,6 +80,7 @@ const Config: FC = () => { {/* Dataset */} {/* Tools */} diff --git a/web/app/components/app/configuration/dataset-config/index.tsx b/web/app/components/app/configuration/dataset-config/index.tsx index dc22f001c6..fa1103933c 100644 --- a/web/app/components/app/configuration/dataset-config/index.tsx +++ b/web/app/components/app/configuration/dataset-config/index.tsx @@ -39,8 +39,9 @@ import { type Props = { readonly?: boolean + hideMetadataFilter?: boolean } -const DatasetConfig: FC = ({ readonly }) => { +const DatasetConfig: FC = ({ readonly, hideMetadataFilter }) => { const { t } = useTranslation() const userProfile = useAppContextSelector(s => s.userProfile) const { @@ -286,25 +287,27 @@ const DatasetConfig: FC = ({ readonly }) => {
)} -
- item.type === MetadataFilteringVariableType.string || item.type === MetadataFilteringVariableType.select)} - availableCommonNumberVars={promptVariablesToSelect.filter(item => item.type === MetadataFilteringVariableType.number)} - /> -
+ {!hideMetadataFilter && ( +
+ item.type === MetadataFilteringVariableType.string || item.type === MetadataFilteringVariableType.select)} + availableCommonNumberVars={promptVariablesToSelect.filter(item => item.type === MetadataFilteringVariableType.number)} + /> +
+ )} {mode === AppType.completion && dataSet.length > 0 && ( = ({ }) => { const { t } = useTranslation() const { + readonly, appId, mode, modelModeType, @@ -413,19 +414,23 @@ const Debug: FC = ({ } {mode !== AppType.completion && ( <> - - - - - + {!readonly && ( + + + + + + + )} + {varList.length > 0 && (
- setExpanded(!expanded)}> + !readonly && setExpanded(!expanded)}> @@ -553,7 +558,7 @@ const Debug: FC = ({ onCancel={handleCancel} /> )} - {!isAPIKeySet && ()} + {!isAPIKeySet && !readonly && ()} ) }