feat(web): use App replace confirm
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-02 15:26:44
|
* @Date: 2026-02-02 15:26:44
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-02-02 15:26:44
|
* @Last Modified time: 2026-03-25 18:14:20
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* SliderInput Component
|
* SliderInput Component
|
||||||
@@ -107,7 +107,7 @@ const SliderInput: FC<SliderInputProps> = ({
|
|||||||
<div className={`rb:w-full ${className}`}>
|
<div className={`rb:w-full ${className}`}>
|
||||||
{/* Optional label */}
|
{/* Optional label */}
|
||||||
{label && (
|
{label && (
|
||||||
<div className="rb:text-sm rb:font-medium rb:text-[#475467]">
|
<div className="rb:text-[#5B6167] rb:leading-5 rb:mb-1">
|
||||||
{label}
|
{label}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -127,7 +127,7 @@ const SliderInput: FC<SliderInputProps> = ({
|
|||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
{/* Input number component */}
|
{/* Input number component */}
|
||||||
<Col flex="120px">
|
<Col flex="80px">
|
||||||
<InputNumber
|
<InputNumber
|
||||||
min={min}
|
min={min}
|
||||||
max={max}
|
max={max}
|
||||||
@@ -135,7 +135,7 @@ const SliderInput: FC<SliderInputProps> = ({
|
|||||||
value={internalValue}
|
value={internalValue}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={`rb:w-full ${inputClassName}`}
|
className={`rb:w-full! ${inputClassName}`}
|
||||||
controls
|
controls
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { cookieUtils } from '@/utils/request'
|
import { cookieUtils } from '@/utils/request'
|
||||||
import { fileUpload } from '@/api/fileStorage'
|
import { fileUpload } from '@/api/fileStorage'
|
||||||
|
|
||||||
const { confirm } = Modal;
|
|
||||||
const { Dragger } = Upload;
|
const { Dragger } = Upload;
|
||||||
|
|
||||||
interface UploadFilesProps extends Omit<UploadProps, 'onChange'> {
|
interface UploadFilesProps extends Omit<UploadProps, 'onChange'> {
|
||||||
@@ -91,14 +90,14 @@ const UploadFiles = forwardRef<UploadFilesRef, UploadFilesProps>(({
|
|||||||
...props
|
...props
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { message } = App.useApp()
|
const { message, modal } = App.useApp()
|
||||||
const [fileList, setFileList] = useState<UploadFile[]>(propFileList);
|
const [fileList, setFileList] = useState<UploadFile[]>(propFileList);
|
||||||
const [accept, setAccept] = useState<string | undefined>();
|
const [accept, setAccept] = useState<string | undefined>();
|
||||||
|
|
||||||
// 处理文件移除
|
// 处理文件移除
|
||||||
const handleRemove = (file: UploadFile) => {
|
const handleRemove = (file: UploadFile) => {
|
||||||
// 显示确认弹窗
|
// 显示确认弹窗
|
||||||
confirm({
|
modal.confirm({
|
||||||
title: `${t('common.confirmRemoveFile')}`,
|
title: `${t('common.confirmRemoveFile')}`,
|
||||||
okText: `${t('common.confirm')}`,
|
okText: `${t('common.confirm')}`,
|
||||||
okType: 'danger',
|
okType: 'danger',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 16:56:54
|
* @Date: 2026-02-03 16:56:54
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-03-25 11:42:26
|
* @Last Modified time: 2026-03-25 18:28:18
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Emotion Engine Configuration Page
|
* Emotion Engine Configuration Page
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Row, Col, Form, Button, message, Space, Flex, Tooltip } from 'antd';
|
import { Row, Col, Form, Button, App, Space, Flex, Tooltip } from 'antd';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
@@ -67,7 +67,7 @@ const EmotionEngine: React.FC = () => {
|
|||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [configData, setConfigData] = useState<ConfigForm>({} as ConfigForm);
|
const [configData, setConfigData] = useState<ConfigForm>({} as ConfigForm);
|
||||||
const [form] = Form.useForm<ConfigForm>();
|
const [form] = Form.useForm<ConfigForm>();
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const { message: messageApi } = App.useApp();
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const values = Form.useWatch([], form);
|
const values = Form.useWatch([], form);
|
||||||
@@ -284,7 +284,6 @@ const EmotionEngine: React.FC = () => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
</RbCard>
|
</RbCard>
|
||||||
</Col>
|
</Col>
|
||||||
{contextHolder}
|
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 17:00:12
|
* @Date: 2026-02-03 17:00:12
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-03-16 15:41:54
|
* @Last Modified time: 2026-03-25 18:29:00
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Forgetting Engine Configuration Page
|
* Forgetting Engine Configuration Page
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Row, Col, Form, Button, Space, message, Flex, Tooltip } from 'antd';
|
import { Row, Col, Form, Button, Space, App, Flex, Tooltip } from 'antd';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ const ForgettingEngine: React.FC = () => {
|
|||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const [configData, setConfigData] = useState<ConfigForm>();
|
const [configData, setConfigData] = useState<ConfigForm>();
|
||||||
const [form] = Form.useForm<ConfigForm>();
|
const [form] = Form.useForm<ConfigForm>();
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const { message: messageApi } = App.useApp();
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const values = Form.useWatch([], form);
|
const values = Form.useWatch([], form);
|
||||||
@@ -238,7 +238,6 @@ const ForgettingEngine: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
</RbCard>
|
</RbCard>
|
||||||
</Col>
|
</Col>
|
||||||
{contextHolder}
|
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useMemo,useRef, useState, useEffect } from 'react';
|
import { useMemo,useRef, useState, useEffect } from 'react';
|
||||||
import { Button, Flex, Radio, Steps, Modal, Input, Spin, message, Checkbox, Select, Form, Progress} from 'antd';
|
import { Button, Flex, Radio, Steps, Modal, Input, Checkbox, Select, Form, Progress, App } from 'antd';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
||||||
import './Private.css';
|
import './Private.css';
|
||||||
@@ -15,7 +15,7 @@ import exitIcon from '@/assets/images/knowledgeBase/exit.png';
|
|||||||
|
|
||||||
import SliderInput from '@/components/SliderInput';
|
import SliderInput from '@/components/SliderInput';
|
||||||
import DelimiterSelector from '../components/DelimiterSelector';
|
import DelimiterSelector from '../components/DelimiterSelector';
|
||||||
const { confirm } = Modal
|
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
|
|
||||||
const style: React.CSSProperties = {
|
const style: React.CSSProperties = {
|
||||||
@@ -28,12 +28,13 @@ const { TextArea } = Input;
|
|||||||
columnGap: 14, // Wider gap between dot and text
|
columnGap: 14, // Wider gap between dot and text
|
||||||
width: '100%',
|
width: '100%',
|
||||||
border: '1px solid #E5E5E5',
|
border: '1px solid #E5E5E5',
|
||||||
borderRadius: 8,
|
borderRadius: 12,
|
||||||
padding: 16,
|
padding: 16,
|
||||||
};
|
};
|
||||||
const getActiveRadioStyle = (active: boolean): React.CSSProperties => ({
|
const getActiveRadioStyle = (active: boolean): React.CSSProperties => ({
|
||||||
...radioWrapperBaseStyle,
|
...radioWrapperBaseStyle,
|
||||||
border: active ? '1px solid #171719' : radioWrapperBaseStyle.border,
|
border: active ? '1px solid #171719' : radioWrapperBaseStyle.border,
|
||||||
|
backgroundColor: active ? '#FAFAFA' : 'transparent',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ interface ContentFormData {
|
|||||||
const CreateDataset = () => {
|
const CreateDataset = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { modal, message: messageApi } = App.useApp()
|
||||||
const { knowledgeBaseId: routeKnowledgeBaseId } = useParams<{ knowledgeBaseId: string }>();
|
const { knowledgeBaseId: routeKnowledgeBaseId } = useParams<{ knowledgeBaseId: string }>();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const locationState = (location.state ?? {}) as CreateDatasetLocationState;
|
const locationState = (location.state ?? {}) as CreateDatasetLocationState;
|
||||||
@@ -93,7 +95,6 @@ const CreateDataset = () => {
|
|||||||
const [parameterSettings, setParameterSettings] = useState<ParameterSettings>('defaultSettings');
|
const [parameterSettings, setParameterSettings] = useState<ParameterSettings>('defaultSettings');
|
||||||
const [pdfEnhancementEnabled, setPdfEnhancementEnabled] = useState<boolean>(true);
|
const [pdfEnhancementEnabled, setPdfEnhancementEnabled] = useState<boolean>(true);
|
||||||
const [pdfEnhancementMethod, setPdfEnhancementMethod] = useState<string>('deepdoc');
|
const [pdfEnhancementMethod, setPdfEnhancementMethod] = useState<string>('deepdoc');
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
|
||||||
const fileType = ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'csv', 'md', 'htm', 'html', 'json', 'ppt', 'pptx', 'txt','png','jpg','mp3','mp4','mov','wav']
|
const fileType = ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'csv', 'md', 'htm', 'html', 'json', 'ppt', 'pptx', 'txt','png','jpg','mp3','mp4','mov','wav']
|
||||||
const steps = useMemo(
|
const steps = useMemo(
|
||||||
() => [
|
() => [
|
||||||
@@ -184,7 +185,7 @@ const CreateDataset = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 显示确认弹框
|
// 显示确认弹框
|
||||||
confirm({
|
modal.confirm({
|
||||||
title: t('knowledgeBase.startUploadConfirmTitle') || 'Start processing documents',
|
title: t('knowledgeBase.startUploadConfirmTitle') || 'Start processing documents',
|
||||||
content: t('knowledgeBase.startUploadConfirmContent') || 'Document processing will proceed in the background. You can choose to return to the list page immediately or stay on this page to view processing progress.',
|
content: t('knowledgeBase.startUploadConfirmContent') || 'Document processing will proceed in the background. You can choose to return to the list page immediately or stay on this page to view processing progress.',
|
||||||
okText: t('knowledgeBase.returnToList') || 'Return to list',
|
okText: t('knowledgeBase.returnToList') || 'Return to list',
|
||||||
@@ -231,7 +232,7 @@ const CreateDataset = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleDelete = (record: AnyObject) => {
|
const handleDelete = (record: AnyObject) => {
|
||||||
confirm({
|
modal.confirm({
|
||||||
title: t('common.deleteWarning'),
|
title: t('common.deleteWarning'),
|
||||||
content: t('common.deleteWarningContent', { content: record.name }),
|
content: t('common.deleteWarningContent', { content: record.name }),
|
||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
@@ -548,8 +549,6 @@ const CreateDataset = () => {
|
|||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
{contextHolder}
|
|
||||||
|
|
||||||
<div className='rb:p-3 rb:pt-2 rb:h-full rb:flex rb:flex-col'>
|
<div className='rb:p-3 rb:pt-2 rb:h-full rb:flex rb:flex-col'>
|
||||||
{/* <Typography.Title level={4} className='rb:!m-0 rb:!mb-4'>
|
{/* <Typography.Title level={4} className='rb:!m-0 rb:!mb-4'>
|
||||||
{t('knowledgeBase.createA') + ' ' + t('knowledgeBase.dataset')}
|
{t('knowledgeBase.createA') + ' ' + t('knowledgeBase.dataset')}
|
||||||
@@ -558,10 +557,10 @@ const CreateDataset = () => {
|
|||||||
<img src={exitIcon} alt='exit' className='rb:w-4 rb:h-4' />
|
<img src={exitIcon} alt='exit' className='rb:w-4 rb:h-4' />
|
||||||
<span className='rb:text-gray-500 rb:text-sm'>{t('common.exit')}</span>
|
<span className='rb:text-gray-500 rb:text-sm'>{t('common.exit')}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className='rb:px-24 rb:py-5 rb:bg-white rb:rounded-lg'>
|
<div className='rb:px-24 rb:py-5 rb:bg-white rb:rounded-xl'>
|
||||||
<Steps current={current} items={steps} className="custom-steps" />
|
<Steps current={current} items={steps} className="custom-steps" />
|
||||||
</div>
|
</div>
|
||||||
<div className='rb:bg-white rb:rounded-lg rb:flex-1 rb:mt-3'>
|
<div className='rb:bg-white rb:rounded-xl rb:flex-1 rb:mt-3'>
|
||||||
|
|
||||||
{current === 0 && (
|
{current === 0 && (
|
||||||
<div className='rb:flex rb:w-full rb:p-6'>
|
<div className='rb:flex rb:w-full rb:p-6'>
|
||||||
@@ -672,7 +671,7 @@ const CreateDataset = () => {
|
|||||||
{current === 1 && (
|
{current === 1 && (
|
||||||
<div className='rb:flex rb:flex-col rb:mt-10 rb:px-40'>
|
<div className='rb:flex rb:flex-col rb:mt-10 rb:px-40'>
|
||||||
{rechunkFileIds.length > 0 && (
|
{rechunkFileIds.length > 0 && (
|
||||||
<div className='rb:bg-[#F0F3F8] rb:border rb:border-[#DFE4ED] rb:rounded rb:px-3 rb:py-2 rb:mb-4 rb:text-xs rb:text-gray-600 rb:flex rb:flex-wrap rb:gap-2'>
|
<div className='rb:bg-[#F0F3F8] rb:border rb:border-[#DFE4ED] rb:rounded-[8px] rb:px-3 rb:py-2 rb:mb-4 rb:text-xs rb:text-gray-600 rb:flex rb:items-center rb:flex-wrap rb:gap-2'>
|
||||||
<span className='rb:text-gray-700 rb:font-medium'>{t('knowledgeBase.rechunking')}:</span>
|
<span className='rb:text-gray-700 rb:font-medium'>{t('knowledgeBase.rechunking')}:</span>
|
||||||
{rechunkFileIds.map((id) => (
|
{rechunkFileIds.map((id) => (
|
||||||
<span key={id} className='rb:px-2 rb:py-0.5 rb:bg-white rb:border rb:border-[#DFE4ED] rb:rounded'>{id}</span>
|
<span key={id} className='rb:px-2 rb:py-0.5 rb:bg-white rb:border rb:border-[#DFE4ED] rb:rounded'>{id}</span>
|
||||||
@@ -684,8 +683,8 @@ const CreateDataset = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className='rb:mt-4'>
|
<div className='rb:mt-4'>
|
||||||
<div
|
<div
|
||||||
className={`rb:flex rb:items-center rb:w-full rb:border rb:rounded-lg rb:p-4 rb:cursor-pointer ${
|
className={`rb:flex rb:items-center rb:justify-between rb:w-full rb:border rb:rounded-xl rb:p-4 rb:cursor-pointer ${
|
||||||
pdfEnhancementEnabled ? 'rb:border-blue-500' : 'rb:border-gray-300'
|
pdfEnhancementEnabled ? 'rb:border-[#171719] rb:bg-[#FAFAFA]' : 'rb-border'
|
||||||
}`}
|
}`}
|
||||||
// onClick={() => setPdfEnhancementEnabled(!pdfEnhancementEnabled)}
|
// onClick={() => setPdfEnhancementEnabled(!pdfEnhancementEnabled)}
|
||||||
>
|
>
|
||||||
@@ -693,24 +692,25 @@ const CreateDataset = () => {
|
|||||||
checked={pdfEnhancementEnabled}
|
checked={pdfEnhancementEnabled}
|
||||||
onChange={(e) => setPdfEnhancementEnabled(e.target.checked)}
|
onChange={(e) => setPdfEnhancementEnabled(e.target.checked)}
|
||||||
className='rb:mr-3'
|
className='rb:mr-3'
|
||||||
/>
|
>
|
||||||
<span className='rb:text-base rb:font-medium rb:text-gray-800 rb:pl-[22px]'>
|
<span className='rb:text-base rb:font-medium rb:text-gray-800 rb:pl-[22px]'>
|
||||||
{t('knowledgeBase.pdfEnhancementAnalysis')}
|
{t('knowledgeBase.pdfEnhancementAnalysis')}
|
||||||
</span>
|
</span>
|
||||||
|
</Checkbox>
|
||||||
{pdfEnhancementEnabled && (
|
{pdfEnhancementEnabled && (
|
||||||
<div className='rb:ml-10'>
|
<div className='rb:ml-10'>
|
||||||
<Select
|
<Select
|
||||||
value={pdfEnhancementMethod}
|
value={pdfEnhancementMethod}
|
||||||
onChange={(value) => setPdfEnhancementMethod(value)}
|
onChange={(value) => setPdfEnhancementMethod(value)}
|
||||||
className='rb:w-48'
|
className='rb:w-[300px]'
|
||||||
options={[
|
options={[
|
||||||
{ value: 'deepdoc', label: 'DeepDoc' },
|
{ value: 'deepdoc', label: 'DeepDoc' },
|
||||||
{ value: 'mineru', label: 'MinerU' },
|
{ value: 'mineru', label: 'MinerU' },
|
||||||
{ value: 'textln', label: 'TextLN' }
|
{ value: 'textln', label: 'TextLN' }
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -766,12 +766,14 @@ const CreateDataset = () => {
|
|||||||
</Radio>
|
</Radio>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
{parameterSettings === 'customSettings' && (
|
{parameterSettings === 'customSettings' && (
|
||||||
<div className='rb:flex rb:flex-col rb:mt-5'>
|
<div className='rb:grid rb:grid-cols-2 rb:mt-5 rb-border rb:rounded-xl rb:px-6 rb:py-4 rb:gap-10'>
|
||||||
<div className='rb:w-full rb:text-sm rb:font-medium rb:text-gray-800 rb:mb-3'>
|
<div>
|
||||||
{t('knowledgeBase.delimiter')}
|
<div className='rb:w-full rb:text-[#5B6167] rb:leading-5 rb:mb-2'>
|
||||||
</div>
|
{t('knowledgeBase.delimiter')}
|
||||||
<DelimiterSelector value={delimiter} onChange={setDelimiter} className='rb:mb-5'/>
|
</div>
|
||||||
<SliderInput label={t('knowledgeBase.suggestedBlockSize')} max={1024} min={1} step={1} value={blockSize} onChange={handleChange} />
|
<DelimiterSelector value={delimiter} onChange={setDelimiter} />
|
||||||
|
</div>
|
||||||
|
<SliderInput label={t('knowledgeBase.suggestedBlockSize')} max={1024} min={1} step={1} value={blockSize} onChange={handleChange} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { useEffect, useState, useRef, useCallback, type FC } from 'react';
|
import { useEffect, useState, useRef, useCallback, type FC } from 'react';
|
||||||
import { useNavigate, useParams, useLocation } from 'react-router-dom';
|
import { useNavigate, useParams, useLocation } from 'react-router-dom';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Switch, Button, Dropdown, Space, Modal, message, Radio, Tooltip } from 'antd';
|
import { Switch, Button, Dropdown, Space, Radio, Tooltip, App } from 'antd';
|
||||||
import type { MenuProps } from 'antd';
|
import type { MenuProps } from 'antd';
|
||||||
import SearchInput from '@/components/SearchInput'
|
import SearchInput from '@/components/SearchInput'
|
||||||
import Table, { type TableRef } from '@/components/Table'
|
import Table, { type TableRef } from '@/components/Table'
|
||||||
@@ -39,12 +39,11 @@ import { formatDateTime } from '@/utils/format';
|
|||||||
import KnowledgeGraphCard from '../components/KnowledgeGraphCard';
|
import KnowledgeGraphCard from '../components/KnowledgeGraphCard';
|
||||||
import { useBreadcrumbManager, type BreadcrumbItem } from '@/hooks/useBreadcrumbManager';
|
import { useBreadcrumbManager, type BreadcrumbItem } from '@/hooks/useBreadcrumbManager';
|
||||||
import './Private.css'
|
import './Private.css'
|
||||||
const { confirm } = Modal
|
|
||||||
// Tree node data type
|
// Tree node data type
|
||||||
|
|
||||||
const Private: FC = () => {
|
const Private: FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const { modal, message: messageApi } = App.useApp()
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { knowledgeBaseId } = useParams<{ knowledgeBaseId: string }>();
|
const { knowledgeBaseId } = useParams<{ knowledgeBaseId: string }>();
|
||||||
@@ -501,7 +500,7 @@ const Private: FC = () => {
|
|||||||
downloadFile(targetFileId, fileName);
|
downloadFile(targetFileId, fileName);
|
||||||
}
|
}
|
||||||
const handleDelete = (item: any) => {
|
const handleDelete = (item: any) => {
|
||||||
confirm({
|
modal.confirm({
|
||||||
title: t('common.deleteWarning'),
|
title: t('common.deleteWarning'),
|
||||||
content: t('common.deleteWarningContent', { content: item.file_name }),
|
content: t('common.deleteWarningContent', { content: item.file_name }),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
@@ -765,7 +764,6 @@ const Private: FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<div className="rb:flex rb:h-full rb:bg-white rb:rounded-xl">
|
<div className="rb:flex rb:h-full rb:bg-white rb:rounded-xl">
|
||||||
{folder && (
|
{folder && (
|
||||||
<div className="rb:w-64 rb:py-4 rb:flex-shrink-0 rb:h-[calc(100%+40px)] rb:border-r rb:border-[#EAECEE] rb:p-4 rb:bg-transparent">
|
<div className="rb:w-64 rb:py-4 rb:flex-shrink-0 rb:h-[calc(100%+40px)] rb:border-r rb:border-[#EAECEE] rb:p-4 rb:bg-transparent">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { forwardRef, useImperativeHandle, useState, useRef } from 'react';
|
import { forwardRef, useImperativeHandle, useState, useRef } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { Form, message } from 'antd';
|
import { Form, App } from 'antd';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import type { UploadFile } from 'antd';
|
import type { UploadFile } from 'antd';
|
||||||
import type { CreateSetModalRef, CreateSetMoealRefProps } from '@/views/KnowledgeBase/types';
|
import type { CreateSetModalRef, CreateSetMoealRefProps } from '@/views/KnowledgeBase/types';
|
||||||
@@ -19,8 +19,8 @@ const CreateImageDataset = forwardRef<CreateSetModalRef, CreateSetMoealRefProps>
|
|||||||
({ refreshTable }, ref) => {
|
({ refreshTable }, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { message: messageApi } = App.useApp();
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
|
||||||
|
|
||||||
const [form] = Form.useForm<ImageDatasetFormData>();
|
const [form] = Form.useForm<ImageDatasetFormData>();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@@ -227,7 +227,6 @@ const CreateImageDataset = forwardRef<CreateSetModalRef, CreateSetMoealRefProps>
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<RbModal
|
<RbModal
|
||||||
title={`${t('knowledgeBase.createA')} ${t('knowledgeBase.mediaDataSet')}`}
|
title={`${t('knowledgeBase.createA')} ${t('knowledgeBase.mediaDataSet')}`}
|
||||||
open={visible}
|
open={visible}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
||||||
import { Form, Input, Select, Modal, Tabs, Switch, Radio, Button, message } from 'antd';
|
import { Form, Input, Select, Modal, Tabs, Switch, Radio, Button, App } from 'antd';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import type { KnowledgeBaseListItem, KnowledgeBaseFormData, CreateModalRef, CreateModalRefProps } from '@/views/KnowledgeBase/types';
|
import type { KnowledgeBaseListItem, KnowledgeBaseFormData, CreateModalRef, CreateModalRefProps } from '@/views/KnowledgeBase/types';
|
||||||
import {
|
import {
|
||||||
@@ -26,7 +26,7 @@ const CreateModal = forwardRef<CreateModalRef, CreateModalRefProps>(({
|
|||||||
refreshTable
|
refreshTable
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const { modal, message: messageApi } = App.useApp()
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [modelTypeList, setModelTypeList] = useState<string[]>([]);
|
const [modelTypeList, setModelTypeList] = useState<string[]>([]);
|
||||||
const [modelOptionsByType, setModelOptionsByType] = useState<Record<string, { label: string; value: string }[]>>({});
|
const [modelOptionsByType, setModelOptionsByType] = useState<Record<string, { label: string; value: string }[]>>({});
|
||||||
@@ -335,7 +335,7 @@ const CreateModal = forwardRef<CreateModalRef, CreateModalRefProps>(({
|
|||||||
|
|
||||||
// If original type is 'rebuild' and knowledge graph is enabled, show confirmation dialog
|
// If original type is 'rebuild' and knowledge graph is enabled, show confirmation dialog
|
||||||
if (originalType === 'rebuild' && isGraphragEnabled) {
|
if (originalType === 'rebuild' && isGraphragEnabled) {
|
||||||
confirm({
|
modal.confirm({
|
||||||
title: t('knowledgeBase.rebuildConfirmTitle'),
|
title: t('knowledgeBase.rebuildConfirmTitle'),
|
||||||
content: t('knowledgeBase.rebuildConfirmContent'),
|
content: t('knowledgeBase.rebuildConfirmContent'),
|
||||||
onOk: async() => {
|
onOk: async() => {
|
||||||
@@ -478,7 +478,7 @@ const CreateModal = forwardRef<CreateModalRef, CreateModalRefProps>(({
|
|||||||
// Get previous value from original datasets object
|
// Get previous value from original datasets object
|
||||||
const previousValue = (datasets as any)[fieldKey];
|
const previousValue = (datasets as any)[fieldKey];
|
||||||
|
|
||||||
confirm({
|
modal.confirm({
|
||||||
title: t('common.updateWarning'),
|
title: t('common.updateWarning'),
|
||||||
content: t('knowledgeBase.updateEmbeddingContent'),
|
content: t('knowledgeBase.updateEmbeddingContent'),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
@@ -880,7 +880,6 @@ const CreateModal = forwardRef<CreateModalRef, CreateModalRefProps>(({
|
|||||||
items={tabItems}
|
items={tabItems}
|
||||||
/>
|
/>
|
||||||
</Form>
|
</Form>
|
||||||
{contextHolder}
|
|
||||||
</RbModal>
|
</RbModal>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
* @Version: 0.0.1
|
* @Version: 0.0.1
|
||||||
* @Author: yujiangping
|
* @Author: yujiangping
|
||||||
* @Date: 2025-11-10 18:52:55
|
* @Date: 2025-11-10 18:52:55
|
||||||
* @LastEditors: yujiangping
|
* @LastEditors: ZhaoYing
|
||||||
* @LastEditTime: 2026-03-09 16:39:07
|
* @LastEditTime: 2026-03-25 18:30:28
|
||||||
*/
|
*/
|
||||||
import { forwardRef, useImperativeHandle, useState, useRef } from 'react';
|
import { forwardRef, useImperativeHandle, useState, useRef } from 'react';
|
||||||
import { Switch } from 'antd';
|
import { Switch, App } from 'antd';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { message } from 'antd';
|
|
||||||
import type { ShareModalRef, ShareModalRefProps, KnowledgeBase, SpaceItem} from '@/views/KnowledgeBase/types';
|
import type { ShareModalRef, ShareModalRefProps, KnowledgeBase, SpaceItem} from '@/views/KnowledgeBase/types';
|
||||||
import RbModal from '@/components/RbModal'
|
import RbModal from '@/components/RbModal'
|
||||||
// import betchControlIcon from '@/assets/images/knowledgeBase/betch-control.png';
|
// import betchControlIcon from '@/assets/images/knowledgeBase/betch-control.png';
|
||||||
@@ -23,7 +22,7 @@ import ShareSpaceModal from './ShareSpaceModal'
|
|||||||
const ShareModal = forwardRef<ShareModalRef,ShareModalRefProps>(({ handleShare: onShare }, ref) => {
|
const ShareModal = forwardRef<ShareModalRef,ShareModalRefProps>(({ handleShare: onShare }, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const shareSpaceModalRef = useRef<ShareSpaceModalRef>(null);
|
const shareSpaceModalRef = useRef<ShareSpaceModalRef>(null);
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const { message: messageApi } = App.useApp()
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [curIndex, setCurIndex] = useState(9999);
|
const [curIndex, setCurIndex] = useState(9999);
|
||||||
@@ -101,7 +100,6 @@ const ShareModal = forwardRef<ShareModalRef,ShareModalRefProps>(({ handleShare:
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<RbModal
|
<RbModal
|
||||||
title={t('knowledgeBase.shareSpace')}
|
title={t('knowledgeBase.shareSpace')}
|
||||||
open={visible}
|
open={visible}
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
* @Version: 0.0.1
|
* @Version: 0.0.1
|
||||||
* @Author: yujiangping
|
* @Author: yujiangping
|
||||||
* @Date: 2025-11-10 18:52:55
|
* @Date: 2025-11-10 18:52:55
|
||||||
* @LastEditors: yujiangping
|
* @LastEditors: ZhaoYing
|
||||||
* @LastEditTime: 2026-03-09 16:34:51
|
* @LastEditTime: 2026-03-25 18:30:28
|
||||||
*/
|
*/
|
||||||
import { forwardRef, useImperativeHandle, useState } from 'react';
|
import { forwardRef, useImperativeHandle, useState } from 'react';
|
||||||
import { Switch } from 'antd';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { message } from 'antd';
|
import { App } from 'antd';
|
||||||
import type { ShareModalRef, ShareModalRefProps, KnowledgeBase} from '@/views/KnowledgeBase/types';
|
import type { ShareModalRef, ShareModalRefProps, KnowledgeBase} from '@/views/KnowledgeBase/types';
|
||||||
import RbModal from '@/components/RbModal'
|
import RbModal from '@/components/RbModal'
|
||||||
// import betchControlIcon from '@/assets/images/knowledgeBase/betch-control.png';
|
// import betchControlIcon from '@/assets/images/knowledgeBase/betch-control.png';
|
||||||
@@ -21,7 +20,7 @@ import type { SpaceItem } from '@/views/KnowledgeBase/types';
|
|||||||
import { formatDateTime } from '@/utils/format';
|
import { formatDateTime } from '@/utils/format';
|
||||||
const ShareModal = forwardRef<ShareModalRef,ShareModalRefProps>(({ handleShare: onShare }, ref) => {
|
const ShareModal = forwardRef<ShareModalRef,ShareModalRefProps>(({ handleShare: onShare }, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
const { message: messageApi } = App.useApp()
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [curIndex, setCurIndex] = useState(-1);
|
const [curIndex, setCurIndex] = useState(-1);
|
||||||
@@ -97,7 +96,6 @@ const ShareModal = forwardRef<ShareModalRef,ShareModalRefProps>(({ handleShare:
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<RbModal
|
<RbModal
|
||||||
title={t('knowledgeBase.toWorkspace')}
|
title={t('knowledgeBase.toWorkspace')}
|
||||||
open={visible}
|
open={visible}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState, useRef, useMemo, useCallback, type FC } from 'react';
|
import { useEffect, useState, useRef, useMemo, useCallback, type FC } from 'react';
|
||||||
import { Row, Col, Button, Dropdown, Modal, message, Tooltip } from 'antd'
|
import { Row, Col, Button, Dropdown, Tooltip, App } from 'antd'
|
||||||
import type { MenuProps } from 'antd';
|
import type { MenuProps } from 'antd';
|
||||||
import { EllipsisOutlined, RightOutlined, DownOutlined } from '@ant-design/icons';
|
import { EllipsisOutlined, RightOutlined, DownOutlined } from '@ant-design/icons';
|
||||||
import { useNavigate, useLocation } from 'react-router-dom';
|
import { useNavigate, useLocation } from 'react-router-dom';
|
||||||
@@ -16,7 +16,7 @@ import RbCard from '@/components/RbCard/Card'
|
|||||||
import SearchInput from '@/components/SearchInput'
|
import SearchInput from '@/components/SearchInput'
|
||||||
import Empty from '@/components/Empty'
|
import Empty from '@/components/Empty'
|
||||||
import { getKnowledgeBaseList, getModelList, getModelTypeList, deleteKnowledgeBase, getKnowledgeBaseTypeList } from '@/api/knowledgeBase'
|
import { getKnowledgeBaseList, getModelList, getModelTypeList, deleteKnowledgeBase, getKnowledgeBaseTypeList } from '@/api/knowledgeBase'
|
||||||
const { confirm } = Modal;
|
|
||||||
import InfiniteScroll from 'react-infinite-scroll-component';
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
||||||
|
|
||||||
import { useBreadcrumbManager, type BreadcrumbItem } from '@/hooks/useBreadcrumbManager';
|
import { useBreadcrumbManager, type BreadcrumbItem } from '@/hooks/useBreadcrumbManager';
|
||||||
@@ -29,6 +29,7 @@ type ModelMenuInfo = {
|
|||||||
const KnowledgeBaseManagement: FC = () => {
|
const KnowledgeBaseManagement: FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { modal, message: messageApi } = App.useApp()
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [data, setData] = useState<KnowledgeBaseListItem[]>([])
|
const [data, setData] = useState<KnowledgeBaseListItem[]>([])
|
||||||
@@ -43,7 +44,6 @@ const KnowledgeBaseManagement: FC = () => {
|
|||||||
const [knowledgeBaseTypes, setKnowledgeBaseTypes] = useState<string[]>([]);
|
const [knowledgeBaseTypes, setKnowledgeBaseTypes] = useState<string[]>([]);
|
||||||
const modelListCache = useRef<Record<string, string>>({});
|
const modelListCache = useRef<Record<string, string>>({});
|
||||||
const modalRef = useRef<CreateModalRef>(null)
|
const modalRef = useRef<CreateModalRef>(null)
|
||||||
const [messageApi, contextHolder] = message.useMessage();
|
|
||||||
const processedStateRef = useRef<any>(null);
|
const processedStateRef = useRef<any>(null);
|
||||||
|
|
||||||
// 使用面包屑管理 Hook
|
// 使用面包屑管理 Hook
|
||||||
@@ -386,7 +386,7 @@ const KnowledgeBaseManagement: FC = () => {
|
|||||||
|
|
||||||
// 处理删除
|
// 处理删除
|
||||||
const handleDelete = (item: KnowledgeBaseListItem) => {
|
const handleDelete = (item: KnowledgeBaseListItem) => {
|
||||||
confirm({
|
modal.confirm({
|
||||||
title: t('common.deleteWarning'),
|
title: t('common.deleteWarning'),
|
||||||
content: t('common.deleteWarningContent', { content: item.name }),
|
content: t('common.deleteWarningContent', { content: item.name }),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
@@ -528,7 +528,6 @@ const KnowledgeBaseManagement: FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{contextHolder}
|
|
||||||
<div className="rb:flex rb:justify-between rb:px-2 rb:mb-4">
|
<div className="rb:flex rb:justify-between rb:px-2 rb:mb-4">
|
||||||
<SearchInput
|
<SearchInput
|
||||||
placeholder={t('knowledgeBase.searchPlaceholder')}
|
placeholder={t('knowledgeBase.searchPlaceholder')}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 16:42:17
|
* @Date: 2026-02-03 16:42:17
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-02-03 16:42:17
|
* @Last Modified time: 2026-03-25 18:30:48
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Member Modal
|
* Member Modal
|
||||||
@@ -39,7 +39,7 @@ const MemberModal = forwardRef<MemberModalRef, MemberModalProps>(({
|
|||||||
refreshTable
|
refreshTable
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { message } = App.useApp()
|
const { message, modal } = App.useApp()
|
||||||
const initialForm = {
|
const initialForm = {
|
||||||
// role: 'member',
|
// role: 'member',
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,6 @@ const MemberModal = forwardRef<MemberModalRef, MemberModalProps>(({
|
|||||||
const [editingUser, setEditingUser] = useState<Member | null>(null);
|
const [editingUser, setEditingUser] = useState<Member | null>(null);
|
||||||
const [form] = Form.useForm<MemberModalData>();
|
const [form] = Form.useForm<MemberModalData>();
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [modal, contextHolder] = Modal.useModal();
|
|
||||||
|
|
||||||
const roleOptions = [
|
const roleOptions = [
|
||||||
'member',
|
'member',
|
||||||
@@ -179,7 +178,6 @@ const MemberModal = forwardRef<MemberModalRef, MemberModalProps>(({
|
|||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
{contextHolder}
|
|
||||||
</RbModal>
|
</RbModal>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user