fix:next button
This commit is contained in:
@@ -82,6 +82,7 @@ const CreateDataset = () => {
|
|||||||
const [form] = Form.useForm<ContentFormData>();
|
const [form] = Form.useForm<ContentFormData>();
|
||||||
const [data, setData] = useState<KnowledgeBaseDocumentData[]>([]);
|
const [data, setData] = useState<KnowledgeBaseDocumentData[]>([]);
|
||||||
const [rechunkFileIds, setRechunkFileIds] = useState<string[]>(initialFileIds);
|
const [rechunkFileIds, setRechunkFileIds] = useState<string[]>(initialFileIds);
|
||||||
|
const [textFormValid, setTextFormValid] = useState<boolean>(false);
|
||||||
|
|
||||||
const [pollingLoading, setPollingLoading] = useState<boolean>(false);
|
const [pollingLoading, setPollingLoading] = useState<boolean>(false);
|
||||||
const pollingTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
const pollingTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||||
@@ -624,7 +625,16 @@ const CreateDataset = () => {
|
|||||||
)}
|
)}
|
||||||
{source && source === 'text' && (
|
{source && source === 'text' && (
|
||||||
<div className='rb:flex rb:w-full rb:flex-col rb:mt-10 rb:px-40'>
|
<div className='rb:flex rb:w-full rb:flex-col rb:mt-10 rb:px-40'>
|
||||||
<Form form={form} layout="vertical">
|
<Form
|
||||||
|
form={form}
|
||||||
|
layout="vertical"
|
||||||
|
onValuesChange={() => {
|
||||||
|
// 检查表单字段是否都已填写
|
||||||
|
const values = form.getFieldsValue();
|
||||||
|
const isValid = !!(values.title?.trim() && values.content?.trim());
|
||||||
|
setTextFormValid(isValid);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="title"
|
name="title"
|
||||||
label={t('knowledgeBase.title')}
|
label={t('knowledgeBase.title')}
|
||||||
@@ -845,7 +855,11 @@ const CreateDataset = () => {
|
|||||||
<Button
|
<Button
|
||||||
type='primary'
|
type='primary'
|
||||||
onClick={current === 2 ? handleStartUpload : handleNext}
|
onClick={current === 2 ? handleStartUpload : handleNext}
|
||||||
disabled={pollingLoading || (current === 0 && rechunkFileIds.length === 0)}
|
disabled={
|
||||||
|
pollingLoading ||
|
||||||
|
(current === 0 && source === 'local' && rechunkFileIds.length === 0) ||
|
||||||
|
(current === 0 && source === 'text' && !textFormValid)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{current === 2 ? t('knowledgeBase.startUploading') || 'Start Upload' : t('common.next') || 'Next'}
|
{current === 2 ? t('knowledgeBase.startUploading') || 'Start Upload' : t('common.next') || 'Next'}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import InfiniteScroll from 'react-infinite-scroll-component';
|
|||||||
import MarketConfigModal, { type MarketConfigModalRef } from './components/MarketConfigModal';
|
import MarketConfigModal, { type MarketConfigModalRef } from './components/MarketConfigModal';
|
||||||
import McpServiceModal from './components/McpServiceModal';
|
import McpServiceModal from './components/McpServiceModal';
|
||||||
import type { McpServiceModalRef } from './types';
|
import type { McpServiceModalRef } from './types';
|
||||||
|
import pageEmptyIcon from '@/assets/images/empty/pageEmpty.png'
|
||||||
|
import Empty from '@/components/Empty/index'
|
||||||
import { getMarketTools, getMarketConfig, getMarketMCPs, getMarketMCPDetail, getMarketMCPsActivated, getTools } from '@/api/tools';
|
import { getMarketTools, getMarketConfig, getMarketMCPs, getMarketMCPDetail, getMarketMCPsActivated, getTools } from '@/api/tools';
|
||||||
|
import BodyWrapper from '@/components/Empty/BodyWrapper';
|
||||||
interface MarketSource {
|
interface MarketSource {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -280,9 +283,14 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
if (!selectedSource) {
|
if (!selectedSource) {
|
||||||
return (
|
return (
|
||||||
<div className="rb:flex rb:flex-col rb:items-center rb:justify-center rb:h-full rb:text-center">
|
<div className="rb:flex rb:flex-col rb:items-center rb:justify-center rb:h-full rb:text-center">
|
||||||
<div className="rb:text-6xl rb:mb-4">🏪</div>
|
<Empty
|
||||||
<h3 className="rb:text-lg rb:font-semibold rb:text-gray-900 rb:mb-2">{t('tool.marketSelectTitle')}</h3>
|
url={pageEmptyIcon}
|
||||||
<p className="rb:text-sm rb:text-gray-600 rb:max-w-md">{t('tool.marketSelectDesc')}</p>
|
title={t('tool.marketSelectTitle')}
|
||||||
|
subTitle={t('tool.marketSelectDesc')}
|
||||||
|
size={200}
|
||||||
|
className="rb:h-full"
|
||||||
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -356,7 +364,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rb:mt-6">
|
<div className="rb:mt-6">
|
||||||
{mcpList.length > 0 ? (
|
<BodyWrapper loading={loading} empty={mcpList.length === 0}>
|
||||||
<div id="mcpScrollableDiv" className="rb:overflow-y-auto rb:h-[calc(100vh-260px)]">
|
<div id="mcpScrollableDiv" className="rb:overflow-y-auto rb:h-[calc(100vh-260px)]">
|
||||||
<InfiniteScroll
|
<InfiniteScroll
|
||||||
dataLength={filteredList.length}
|
dataLength={filteredList.length}
|
||||||
@@ -426,22 +434,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
|
|||||||
</div>
|
</div>
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
</BodyWrapper>
|
||||||
<div className="rb:flex rb:flex-col rb:items-center rb:justify-center rb:py-16 rb:text-center">
|
|
||||||
<div className="rb:text-6xl rb:mb-4">{source.connected ? '📭' : '🔌'}</div>
|
|
||||||
<h4 className="rb:text-base rb:font-semibold rb:text-gray-900 rb:mb-2">
|
|
||||||
{source.connected ? t('tool.marketNoServices') : t('tool.marketNotConnected')}
|
|
||||||
</h4>
|
|
||||||
<p className="rb:text-sm rb:text-gray-600 rb:mb-4">
|
|
||||||
{source.connected ? t('tool.marketNoServicesDesc') : t('tool.marketNotConnectedDesc')}
|
|
||||||
</p>
|
|
||||||
{!source.connected && (
|
|
||||||
<Button type="primary" onClick={() => handleOpenConfig(selectedSource)}>
|
|
||||||
{t('tool.marketConfigConnection')}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user