Merge branch 'feature/tool_yjp' into develop

This commit is contained in:
yujiangping
2026-03-09 19:11:13 +08:00
2 changed files with 29 additions and 22 deletions

View File

@@ -82,6 +82,7 @@ const CreateDataset = () => {
const [form] = Form.useForm<ContentFormData>();
const [data, setData] = useState<KnowledgeBaseDocumentData[]>([]);
const [rechunkFileIds, setRechunkFileIds] = useState<string[]>(initialFileIds);
const [textFormValid, setTextFormValid] = useState<boolean>(false);
const [pollingLoading, setPollingLoading] = useState<boolean>(false);
const pollingTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);
@@ -624,7 +625,16 @@ const CreateDataset = () => {
)}
{source && source === 'text' && (
<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
name="title"
label={t('knowledgeBase.title')}
@@ -845,7 +855,11 @@ const CreateDataset = () => {
<Button
type='primary'
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'}
</Button>

View File

@@ -6,7 +6,10 @@ import InfiniteScroll from 'react-infinite-scroll-component';
import MarketConfigModal, { type MarketConfigModalRef } from './components/MarketConfigModal';
import McpServiceModal from './components/McpServiceModal';
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 BodyWrapper from '@/components/Empty/BodyWrapper';
interface MarketSource {
id: string;
name: string;
@@ -280,9 +283,14 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
if (!selectedSource) {
return (
<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>
<h3 className="rb:text-lg rb:font-semibold rb:text-gray-900 rb:mb-2">{t('tool.marketSelectTitle')}</h3>
<p className="rb:text-sm rb:text-gray-600 rb:max-w-md">{t('tool.marketSelectDesc')}</p>
<Empty
url={pageEmptyIcon}
title={t('tool.marketSelectTitle')}
subTitle={t('tool.marketSelectDesc')}
size={200}
className="rb:h-full"
/>
</div>
);
}
@@ -356,7 +364,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
</div>
<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)]">
<InfiniteScroll
dataLength={filteredList.length}
@@ -426,22 +434,7 @@ const Market: React.FC<{ getStatusTag?: (status: string) => ReactNode }> = () =>
</div>
</InfiniteScroll>
</div>
) : (
<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>
)}
</BodyWrapper>
</div>
</>
);