diff --git a/frontend/src/pages/SynthesisTask/CreateTask.tsx b/frontend/src/pages/SynthesisTask/CreateTask.tsx index 7b0c62e50..f224887e6 100644 --- a/frontend/src/pages/SynthesisTask/CreateTask.tsx +++ b/frontend/src/pages/SynthesisTask/CreateTask.tsx @@ -53,8 +53,8 @@ export default function SynthesisTaskCreate() { | "PARAGRAPH_CHUNK" | "FIXED_LENGTH_CHUNK" | "CUSTOM_SEPARATOR_CHUNK", - chunkSize: 3000, - overlapSize: 100, + chunkSize: 500, + overlapSize: 50, delimiter: "", }); diff --git a/frontend/src/pages/SynthesisTask/SynthFileTask.tsx b/frontend/src/pages/SynthesisTask/SynthFileTask.tsx index d0a5bcf2d..660646c39 100644 --- a/frontend/src/pages/SynthesisTask/SynthFileTask.tsx +++ b/frontend/src/pages/SynthesisTask/SynthFileTask.tsx @@ -290,7 +290,7 @@ export default function SynthFileTask() { danger: true, confirm: { title: t('synthesisTask.fileTask.confirm.deleteTitle'), - description: t('synthesisTask.fileTask.confirm.deleteDescription', { name: synthesisTask?.name || '' }), + description: t('synthesisTask.fileTask.confirm.deleteDescription', { name: taskInfo?.name || '' }), okText: t('dataManagement.confirm.deleteConfirm'), cancelText: t('dataManagement.confirm.deleteCancel'), onConfirm: handleDelete, diff --git a/frontend/src/pages/SynthesisTask/components/SynthesisTaskTab.tsx b/frontend/src/pages/SynthesisTask/components/SynthesisTaskTab.tsx index 12716aae3..fe8562f5d 100644 --- a/frontend/src/pages/SynthesisTask/components/SynthesisTaskTab.tsx +++ b/frontend/src/pages/SynthesisTask/components/SynthesisTaskTab.tsx @@ -68,6 +68,9 @@ export default function SynthesisTaskTab() { const [evalLoading, setEvalLoading] = useState(false); const [models, setModels] = useState([]); const [modelLoading, setModelLoading] = useState(false); + const [archiveModalVisible, setArchiveModalVisible] = useState(false); + const [currentArchiveTask, setCurrentArchiveTask] = useState(null); + const [archiveFormat, setArchiveFormat] = useState("alpaca"); const [evalForm] = Form.useForm(); @@ -210,7 +213,7 @@ export default function SynthesisTaskTab() { title: t('synthesisTask.home.columns.actions'), key: "actions", fixed: "right" as const, - width: 120, + width: 160, render: (_: unknown, task: SynthesisTask) => (
@@ -234,15 +237,7 @@ export default function SynthesisTaskTab() { type="text" className="hover:bg-green-50 p-1 h-7 w-7 flex items-center justify-center text-green-600" icon={} - onClick={() => { - Modal.confirm({ - title: t('synthesisTask.home.confirm.archiveTitle'), - content: t('synthesisTask.home.confirm.archiveContent', { name: task.name }), - okText: t('synthesisTask.actions.archive'), - cancelText: t('synthesisTask.actions.cancel'), - onOk: () => handleArchiveTask(task), - }); - }} + onClick={() => openArchiveModal(task)} /> @@ -276,9 +271,8 @@ export default function SynthesisTaskTab() { }, ]; - const handleArchiveTask = async (task: SynthesisTask) => { + const handleArchiveTask = async (task: SynthesisTask, format: string = "alpaca") => { try { - // 1. 创建目标数据集(使用简单的默认命名 + 随机后缀,可后续扩展为弹窗自定义) const randomSuffix = Math.random().toString(36).slice(2, 8); const datasetReq: { name: string; @@ -302,11 +296,9 @@ export default function SynthesisTaskTab() { return; } - // 2. 调用后端归档接口,将合成数据写入该数据集 - await archiveSynthesisTaskToDatasetUsingPost(task.id, datasetId); + await archiveSynthesisTaskToDatasetUsingPost(task.id, datasetId, format); message.success(t('synthesisTask.home.archive.success')); - // 3. 可选:跳转到数据集详情页 navigate(`/data/management/detail/${datasetId}`); } catch (e) { console.error(e); @@ -314,6 +306,18 @@ export default function SynthesisTaskTab() { } }; + const openArchiveModal = (task: SynthesisTask) => { + setCurrentArchiveTask(task); + setArchiveFormat("alpaca"); + setArchiveModalVisible(true); + }; + + const handleArchiveConfirm = async () => { + if (!currentArchiveTask) return; + setArchiveModalVisible(false); + await handleArchiveTask(currentArchiveTask, archiveFormat); + }; + const openEvalModal = (task: SynthesisTask) => { setCurrentEvalTask(task); setEvalModalVisible(true); @@ -464,6 +468,37 @@ export default function SynthesisTaskTab() { /> + { + setArchiveModalVisible(false); + setCurrentArchiveTask(null); + }} + onOk={handleArchiveConfirm} + okText={t('synthesisTask.actions.archive')} + cancelText={t('synthesisTask.actions.cancel')} + > +
+

{t('synthesisTask.home.confirm.archiveContent', { name: currentArchiveTask?.name })}

+
+ 导出格式: +