From 25bb2e1616e31b2b39e079d2bdcbe330dc61f15e Mon Sep 17 00:00:00 2001
From: chanx <1243304602@qq.com>
Date: Tue, 3 Feb 2026 11:43:44 +0800
Subject: [PATCH] Fix:Optimize metadata and optimize the empty state style of
the agent page. (#12960)
### What problem does this PR solve?
Fix:Optimize metadata and optimize the empty state style of the agent
page.
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
---
web/src/components/bulk-operate-bar.tsx | 6 +++-
web/src/components/empty/empty.tsx | 13 ++++----
web/src/pages/agents/index.tsx | 30 +++++++++++++++++--
.../metedata/hooks/use-manage-modal.ts | 30 +++++++++++--------
.../components/metedata/manage-modal.tsx | 6 ++--
web/src/pages/dataset/dataset/index.tsx | 7 +++--
.../dataset/use-bulk-operate-dataset.tsx | 10 +++----
7 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/web/src/components/bulk-operate-bar.tsx b/web/src/components/bulk-operate-bar.tsx
index 84e69cfbd..ce5a73376 100644
--- a/web/src/components/bulk-operate-bar.tsx
+++ b/web/src/components/bulk-operate-bar.tsx
@@ -60,8 +60,12 @@ export function BulkOperateBar({
}}
>
diff --git a/web/src/components/empty/empty.tsx b/web/src/components/empty/empty.tsx
index 3623f43d0..44f46e0dd 100644
--- a/web/src/components/empty/empty.tsx
+++ b/web/src/components/empty/empty.tsx
@@ -78,8 +78,9 @@ export const EmptyAppCard = (props: {
className?: string;
isSearch?: boolean;
size?: 'small' | 'large';
+ children?: React.ReactNode;
}) => {
- const { type, showIcon, className, isSearch } = props;
+ const { type, showIcon, className, isSearch, children } = props;
let defaultClass = '';
let style = {};
switch (props.size) {
@@ -96,20 +97,17 @@ export const EmptyAppCard = (props: {
break;
}
return (
-
+
- {!isSearch && (
+ {!isSearch && !children && (
)}
+ {children}
);
diff --git a/web/src/pages/agents/index.tsx b/web/src/pages/agents/index.tsx
index 82308f309..01e7bd761 100644
--- a/web/src/pages/agents/index.tsx
+++ b/web/src/pages/agents/index.tsx
@@ -86,11 +86,35 @@ export default function Agents() {
showCreatingModal()}
- />
+ // onClick={() => showCreatingModal()}
+ >
+
+
+
+ {t('flow.createFromBlank')}
+
+
+
+ {t('flow.createFromTemplate')}
+
+
+
+ {t('flow.importJsonFile')}
+
+
+
)}
diff --git a/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts b/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts
index 3555af26c..cd9428f21 100644
--- a/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts
+++ b/web/src/pages/dataset/components/metedata/hooks/use-manage-modal.ts
@@ -11,7 +11,11 @@ import { RowSelectionState } from '@tanstack/react-table';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router';
-import { DEFAULT_VALUE_TYPE, MetadataType } from '../constant';
+import {
+ DEFAULT_VALUE_TYPE,
+ MetadataType,
+ metadataValueTypeEnum,
+} from '../constant';
import {
IBuiltInMetadataItem,
IMetaDataReturnJSONSettings,
@@ -163,16 +167,16 @@ export const useMetadataOperations = () => {
newValue: string | string[],
type?: MetadataValueType,
) => {
- // let newValuesRes: string | string[];
- // if (type !== metadataValueTypeEnum['list']) {
- // if (Array.isArray(newValue) && newValue.length > 0) {
- // newValuesRes = newValue[0];
- // } else {
- // newValuesRes = newValue;
- // }
- // } else {
- // newValuesRes = newValue;
- // }
+ let newValuesRes: string | string[];
+ if (type !== metadataValueTypeEnum['list']) {
+ if (Array.isArray(newValue) && newValue.length > 0) {
+ newValuesRes = newValue[0];
+ } else {
+ newValuesRes = newValue;
+ }
+ } else {
+ newValuesRes = newValue;
+ }
setOperations((prev) => {
let updatedUpdates = [...prev.updates];
const existsIndex = prev.updates.findIndex(
@@ -185,7 +189,7 @@ export const useMetadataOperations = () => {
updatedUpdates[existsIndex] = {
key,
match: originalValue,
- value: newValue,
+ value: newValuesRes,
valueType: type || DEFAULT_VALUE_TYPE,
};
@@ -194,7 +198,7 @@ export const useMetadataOperations = () => {
updatedUpdates.push({
key,
match: originalValue,
- value: newValue,
+ value: newValuesRes,
valueType: type,
});
}
diff --git a/web/src/pages/dataset/components/metedata/manage-modal.tsx b/web/src/pages/dataset/components/metedata/manage-modal.tsx
index 23b1a8d98..4cf0d42ed 100644
--- a/web/src/pages/dataset/components/metedata/manage-modal.tsx
+++ b/web/src/pages/dataset/components/metedata/manage-modal.tsx
@@ -19,7 +19,6 @@ import {
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { useSetModalState } from '@/hooks/common-hooks';
import { useRowSelection } from '@/hooks/logic-hooks/use-row-selection';
-import { Routes } from '@/routes';
import {
flexRender,
getCoreRowModel,
@@ -321,7 +320,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
{secondTitle || t('knowledgeDetails.metadata.metadata')}
- {metadataType === MetadataType.Manage && (
+ {/* {metadataType === MetadataType.Manage && (
- )}
+ )} */}
{isCanAdd && activeTab !== 'built-in' && (
)}
diff --git a/web/src/pages/dataset/dataset/index.tsx b/web/src/pages/dataset/dataset/index.tsx
index 86817b2d5..be431e087 100644
--- a/web/src/pages/dataset/dataset/index.tsx
+++ b/web/src/pages/dataset/dataset/index.tsx
@@ -100,7 +100,7 @@ export default function Dataset() {
const handleAddMetadataWithDocuments = () => {
showManageMetadataModal({
type: MetadataType.Manage,
- isCanAdd: false,
+ isCanAdd: true,
isEditField: false,
isDeleteSingleValue: true,
isAddValue: true,
@@ -254,7 +254,10 @@ export default function Dataset() {
)
}
visible={manageMetadataVisible}
- hideModal={hideManageMetadataModal}
+ hideModal={() => {
+ setRowSelection({});
+ hideManageMetadataModal();
+ }}
// selectedRowKeys={selectedRowKeys}
tableData={tableData}
isCanAdd={metadataConfig.isCanAdd}
diff --git a/web/src/pages/dataset/dataset/use-bulk-operate-dataset.tsx b/web/src/pages/dataset/dataset/use-bulk-operate-dataset.tsx
index fda05c870..a96c1ec6a 100644
--- a/web/src/pages/dataset/dataset/use-bulk-operate-dataset.tsx
+++ b/web/src/pages/dataset/dataset/use-bulk-operate-dataset.tsx
@@ -136,6 +136,11 @@ export function useBulkOperateDataset({
icon: ,
onClick: handleCancelClick,
},
+ {
+ id: 'batch-metadata',
+ label: t('knowledgeDetails.metadata.metadata'),
+ icon: ,
+ },
{
id: 'delete',
label: t('common.delete'),
@@ -147,11 +152,6 @@ export function useBulkOperateDataset({
}
},
},
- {
- id: 'batch-metadata',
- label: t('knowledgeDetails.metadata.metadata'),
- icon: ,
- },
];
return { chunkNum, list, visible, hideModal, showModal, handleRunClick };