mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-03 17:15:08 +08:00
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)
This commit is contained in:
@ -60,8 +60,12 @@ export function BulkOperateBar({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
variant={'ghost'}
|
variant={!isDeleteItem(x.id) ? 'ghost' : 'delete'}
|
||||||
onClick={isDeleteItem(x.id) ? () => {} : x.onClick}
|
onClick={isDeleteItem(x.id) ? () => {} : x.onClick}
|
||||||
|
className={cn({
|
||||||
|
['text-state-error border border-state-error bg-state-error/5']:
|
||||||
|
isDeleteItem(x.id),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
{x.icon} {x.label}
|
{x.icon} {x.label}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@ -78,8 +78,9 @@ export const EmptyAppCard = (props: {
|
|||||||
className?: string;
|
className?: string;
|
||||||
isSearch?: boolean;
|
isSearch?: boolean;
|
||||||
size?: 'small' | 'large';
|
size?: 'small' | 'large';
|
||||||
|
children?: React.ReactNode;
|
||||||
}) => {
|
}) => {
|
||||||
const { type, showIcon, className, isSearch } = props;
|
const { type, showIcon, className, isSearch, children } = props;
|
||||||
let defaultClass = '';
|
let defaultClass = '';
|
||||||
let style = {};
|
let style = {};
|
||||||
switch (props.size) {
|
switch (props.size) {
|
||||||
@ -96,20 +97,17 @@ export const EmptyAppCard = (props: {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div onClick={isSearch ? undefined : props.onClick}>
|
||||||
className=" cursor-pointer "
|
|
||||||
onClick={isSearch ? undefined : props.onClick}
|
|
||||||
>
|
|
||||||
<EmptyCard
|
<EmptyCard
|
||||||
icon={showIcon ? EmptyCardData[type].icon : undefined}
|
icon={showIcon ? EmptyCardData[type].icon : undefined}
|
||||||
title={
|
title={
|
||||||
isSearch ? EmptyCardData[type].notFound : EmptyCardData[type].title
|
isSearch ? EmptyCardData[type].notFound : EmptyCardData[type].title
|
||||||
}
|
}
|
||||||
className={className}
|
className={cn('cursor-pointer ', className)}
|
||||||
style={style}
|
style={style}
|
||||||
// description={EmptyCardData[type].description}
|
// description={EmptyCardData[type].description}
|
||||||
>
|
>
|
||||||
{!isSearch && (
|
{!isSearch && !children && (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
defaultClass,
|
defaultClass,
|
||||||
@ -119,6 +117,7 @@ export const EmptyAppCard = (props: {
|
|||||||
<Plus size={24} />
|
<Plus size={24} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{children}
|
||||||
</EmptyCard>
|
</EmptyCard>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -86,11 +86,35 @@ export default function Agents() {
|
|||||||
<EmptyAppCard
|
<EmptyAppCard
|
||||||
showIcon
|
showIcon
|
||||||
size="large"
|
size="large"
|
||||||
className="w-[480px] p-14"
|
className="w-[480px] p-14 !cursor-default"
|
||||||
isSearch={!!searchString}
|
isSearch={!!searchString}
|
||||||
type={EmptyCardType.Agent}
|
type={EmptyCardType.Agent}
|
||||||
onClick={() => showCreatingModal()}
|
// onClick={() => showCreatingModal()}
|
||||||
/>
|
>
|
||||||
|
<div className="flex flex-col gap-y-5 text-text-secondary text-sm pt-5">
|
||||||
|
<div
|
||||||
|
className="flex items-center gap-x-2 hover:text-text-primary cursor-pointer"
|
||||||
|
onClick={showCreatingModal}
|
||||||
|
>
|
||||||
|
<Clipboard size={14} />
|
||||||
|
{t('flow.createFromBlank')}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="flex items-center gap-x-2 hover:text-text-primary cursor-pointer"
|
||||||
|
onClick={navigateToAgentTemplates}
|
||||||
|
>
|
||||||
|
<ClipboardPlus size={14} />
|
||||||
|
{t('flow.createFromTemplate')}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="flex items-center gap-x-2 hover:text-text-primary cursor-pointer"
|
||||||
|
onClick={handleImportJson}
|
||||||
|
>
|
||||||
|
<FileInput size={14} />
|
||||||
|
{t('flow.importJsonFile')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</EmptyAppCard>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<section className="flex flex-col w-full flex-1">
|
<section className="flex flex-col w-full flex-1">
|
||||||
|
|||||||
@ -11,7 +11,11 @@ import { RowSelectionState } from '@tanstack/react-table';
|
|||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useParams } from 'react-router';
|
import { useParams } from 'react-router';
|
||||||
import { DEFAULT_VALUE_TYPE, MetadataType } from '../constant';
|
import {
|
||||||
|
DEFAULT_VALUE_TYPE,
|
||||||
|
MetadataType,
|
||||||
|
metadataValueTypeEnum,
|
||||||
|
} from '../constant';
|
||||||
import {
|
import {
|
||||||
IBuiltInMetadataItem,
|
IBuiltInMetadataItem,
|
||||||
IMetaDataReturnJSONSettings,
|
IMetaDataReturnJSONSettings,
|
||||||
@ -163,16 +167,16 @@ export const useMetadataOperations = () => {
|
|||||||
newValue: string | string[],
|
newValue: string | string[],
|
||||||
type?: MetadataValueType,
|
type?: MetadataValueType,
|
||||||
) => {
|
) => {
|
||||||
// let newValuesRes: string | string[];
|
let newValuesRes: string | string[];
|
||||||
// if (type !== metadataValueTypeEnum['list']) {
|
if (type !== metadataValueTypeEnum['list']) {
|
||||||
// if (Array.isArray(newValue) && newValue.length > 0) {
|
if (Array.isArray(newValue) && newValue.length > 0) {
|
||||||
// newValuesRes = newValue[0];
|
newValuesRes = newValue[0];
|
||||||
// } else {
|
} else {
|
||||||
// newValuesRes = newValue;
|
newValuesRes = newValue;
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// newValuesRes = newValue;
|
newValuesRes = newValue;
|
||||||
// }
|
}
|
||||||
setOperations((prev) => {
|
setOperations((prev) => {
|
||||||
let updatedUpdates = [...prev.updates];
|
let updatedUpdates = [...prev.updates];
|
||||||
const existsIndex = prev.updates.findIndex(
|
const existsIndex = prev.updates.findIndex(
|
||||||
@ -185,7 +189,7 @@ export const useMetadataOperations = () => {
|
|||||||
updatedUpdates[existsIndex] = {
|
updatedUpdates[existsIndex] = {
|
||||||
key,
|
key,
|
||||||
match: originalValue,
|
match: originalValue,
|
||||||
value: newValue,
|
value: newValuesRes,
|
||||||
valueType: type || DEFAULT_VALUE_TYPE,
|
valueType: type || DEFAULT_VALUE_TYPE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -194,7 +198,7 @@ export const useMetadataOperations = () => {
|
|||||||
updatedUpdates.push({
|
updatedUpdates.push({
|
||||||
key,
|
key,
|
||||||
match: originalValue,
|
match: originalValue,
|
||||||
value: newValue,
|
value: newValuesRes,
|
||||||
valueType: type,
|
valueType: type,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import {
|
|||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||||
import { useSetModalState } from '@/hooks/common-hooks';
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
import { useRowSelection } from '@/hooks/logic-hooks/use-row-selection';
|
import { useRowSelection } from '@/hooks/logic-hooks/use-row-selection';
|
||||||
import { Routes } from '@/routes';
|
|
||||||
import {
|
import {
|
||||||
flexRender,
|
flexRender,
|
||||||
getCoreRowModel,
|
getCoreRowModel,
|
||||||
@ -321,7 +320,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
|||||||
{secondTitle || t('knowledgeDetails.metadata.metadata')}
|
{secondTitle || t('knowledgeDetails.metadata.metadata')}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{metadataType === MetadataType.Manage && (
|
{/* {metadataType === MetadataType.Manage && (
|
||||||
<Button
|
<Button
|
||||||
variant={'ghost'}
|
variant={'ghost'}
|
||||||
className="border border-border-button"
|
className="border border-border-button"
|
||||||
@ -332,7 +331,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
|||||||
>
|
>
|
||||||
{t('knowledgeDetails.metadata.toMetadataSetting')}
|
{t('knowledgeDetails.metadata.toMetadataSetting')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)} */}
|
||||||
{isCanAdd && activeTab !== 'built-in' && (
|
{isCanAdd && activeTab !== 'built-in' && (
|
||||||
<Button
|
<Button
|
||||||
variant={'ghost'}
|
variant={'ghost'}
|
||||||
@ -341,6 +340,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
|||||||
onClick={handAddValueRow}
|
onClick={handAddValueRow}
|
||||||
>
|
>
|
||||||
<Plus />
|
<Plus />
|
||||||
|
{t('common.add')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -100,7 +100,7 @@ export default function Dataset() {
|
|||||||
const handleAddMetadataWithDocuments = () => {
|
const handleAddMetadataWithDocuments = () => {
|
||||||
showManageMetadataModal({
|
showManageMetadataModal({
|
||||||
type: MetadataType.Manage,
|
type: MetadataType.Manage,
|
||||||
isCanAdd: false,
|
isCanAdd: true,
|
||||||
isEditField: false,
|
isEditField: false,
|
||||||
isDeleteSingleValue: true,
|
isDeleteSingleValue: true,
|
||||||
isAddValue: true,
|
isAddValue: true,
|
||||||
@ -254,7 +254,10 @@ export default function Dataset() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
visible={manageMetadataVisible}
|
visible={manageMetadataVisible}
|
||||||
hideModal={hideManageMetadataModal}
|
hideModal={() => {
|
||||||
|
setRowSelection({});
|
||||||
|
hideManageMetadataModal();
|
||||||
|
}}
|
||||||
// selectedRowKeys={selectedRowKeys}
|
// selectedRowKeys={selectedRowKeys}
|
||||||
tableData={tableData}
|
tableData={tableData}
|
||||||
isCanAdd={metadataConfig.isCanAdd}
|
isCanAdd={metadataConfig.isCanAdd}
|
||||||
|
|||||||
@ -136,6 +136,11 @@ export function useBulkOperateDataset({
|
|||||||
icon: <CircleX />,
|
icon: <CircleX />,
|
||||||
onClick: handleCancelClick,
|
onClick: handleCancelClick,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'batch-metadata',
|
||||||
|
label: t('knowledgeDetails.metadata.metadata'),
|
||||||
|
icon: <Cylinder />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'delete',
|
id: 'delete',
|
||||||
label: t('common.delete'),
|
label: t('common.delete'),
|
||||||
@ -147,11 +152,6 @@ export function useBulkOperateDataset({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'batch-metadata',
|
|
||||||
label: t('knowledgeDetails.metadata.metadata'),
|
|
||||||
icon: <Cylinder />,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return { chunkNum, list, visible, hideModal, showModal, handleRunClick };
|
return { chunkNum, list, visible, hideModal, showModal, handleRunClick };
|
||||||
|
|||||||
Reference in New Issue
Block a user