From 1797e221c979eb3a6b1474e07036f71391e14067 Mon Sep 17 00:00:00 2001 From: chenghh-9609 <55340429+chenghh-9609@users.noreply.github.com> Date: Fri, 31 Oct 2025 14:44:06 +0800 Subject: [PATCH] fix operator create bug (#47) * feat: Update site name to DataMate and refine text for AI data processing * feat: Refactor settings page and implement model access functionality - Created a new ModelAccess component for managing model configurations. - Removed the old Settings component and replaced it with a new SettingsPage component that integrates ModelAccess, SystemConfig, and WebhookConfig. - Added SystemConfig component for managing system settings. - Implemented WebhookConfig component for managing webhook configurations. - Updated API functions for model management in settings.apis.ts. - Adjusted routing to point to the new SettingsPage component. * feat: Implement Data Collection Page with Task Management and Execution Log - Created DataCollectionPage component to manage data collection tasks. - Added TaskManagement and ExecutionLog components for task handling and logging. - Integrated task operations including start, stop, edit, and delete functionalities. - Implemented filtering and searching capabilities in task management. - Introduced SimpleCronScheduler for scheduling tasks with cron expressions. - Updated CreateTask component to utilize new scheduling and template features. - Enhanced BasicInformation component to conditionally render fields based on visibility settings. - Refactored ImportConfiguration component to remove NAS import section. * feat: Update task creation API endpoint and enhance task creation form with new fields and validation * Refactor file upload and operator management components - Removed unnecessary console logs from file download and export functions. - Added size property to TaskItem interface for better task management. - Simplified TaskUpload component by utilizing useFileSliceUpload hook for file upload logic. - Enhanced OperatorPluginCreate component to handle file uploads and parsing more efficiently. - Updated ConfigureStep component to use Ant Design Form for better data handling and validation. - Improved PreviewStep component to navigate back to the operator market. - Added support for additional file types in UploadStep component. - Implemented delete operator functionality in OperatorMarketPage with confirmation prompts. - Cleaned up unused API functions in operator.api.ts to streamline the codebase. - Fixed number formatting utility to handle zero values correctly. * Refactor Knowledge Generation to Knowledge Base - Created new API service for Knowledge Base operations including querying, creating, updating, and deleting knowledge bases and files. - Added constants for Knowledge Base status and type mappings. - Defined models for Knowledge Base and related files. - Removed obsolete Knowledge Base creation and home components, replacing them with new implementations under the Knowledge Base structure. - Updated routing to reflect the new Knowledge Base paths. - Adjusted menu items to align with the new Knowledge Base terminology. - Modified ModelAccess interface to include modelName and type properties. * feat: Implement Knowledge Base Page with CRUD operations and data management - Added KnowledgeBasePage component for displaying and managing knowledge bases. - Integrated search and filter functionalities with SearchControls component. - Implemented CreateKnowledgeBase component for creating and editing knowledge bases. - Enhanced AddDataDialog for file uploads and dataset selections. - Introduced TableTransfer component for managing data transfers between tables. - Updated API functions for knowledge base operations, including file management. - Refactored knowledge base model to include file status and metadata. - Adjusted routing to point to the new KnowledgeBasePage. * feat: enhance OperatorPluginCreate and ConfigureStep for better upload handling and UI updates --- .../OperatorMarket/Create/OperatorPluginCreate.tsx | 13 +++++++------ .../Create/components/ConfigureStep.tsx | 8 ++++++++ .../pages/OperatorMarket/Home/components/List.tsx | 5 +++-- .../src/pages/TaskManagement/TaskManagement.tsx | 0 4 files changed, 18 insertions(+), 8 deletions(-) delete mode 100644 frontend/src/pages/TaskManagement/TaskManagement.tsx diff --git a/frontend/src/pages/OperatorMarket/Create/OperatorPluginCreate.tsx b/frontend/src/pages/OperatorMarket/Create/OperatorPluginCreate.tsx index 19509ee..427d5d2 100644 --- a/frontend/src/pages/OperatorMarket/Create/OperatorPluginCreate.tsx +++ b/frontend/src/pages/OperatorMarket/Create/OperatorPluginCreate.tsx @@ -29,7 +29,7 @@ export default function OperatorPluginCreate() { const { message } = App.useApp(); const [uploadStep, setUploadStep] = useState< "upload" | "parsing" | "configure" | "preview" - >("upload"); + >(id ? "configure" : "upload"); const [isUploading, setIsUploading] = useState(false); const [parsedInfo, setParsedInfo] = useState({}); const [parseError, setParseError] = useState(null); @@ -63,10 +63,10 @@ export default function OperatorPluginCreate() { }, ], // 假设只上传一个文件 }); - setParsedInfo({ ...parsedInfo, fileName, percent: 100 }); // 上传完成,进度100% + setParsedInfo({ ...parsedInfo, percent: 100 }); // 上传完成,进度100% // 解析文件过程 const res = await uploadOperatorUsingPost({ fileName }); - setParsedInfo({ ...parsedInfo, ...res.data }); + setParsedInfo({ ...parsedInfo, ...res.data, fileName }); } catch (err) { setParseError("文件解析失败," + err.data.message); } finally { @@ -92,7 +92,6 @@ export default function OperatorPluginCreate() { // 编辑模式,加载已有算子信息逻辑待实现 const { data } = await queryOperatorByIdUsingGet(operatorId); setParsedInfo(data); - setUploadStep("configure"); }; useEffect(() => { @@ -110,7 +109,9 @@ export default function OperatorPluginCreate() { -

上传算子

+

+ {id ? "更新算子" : "上传算子"} +

)} diff --git a/frontend/src/pages/OperatorMarket/Create/components/ConfigureStep.tsx b/frontend/src/pages/OperatorMarket/Create/components/ConfigureStep.tsx index e317d1a..96bc02a 100644 --- a/frontend/src/pages/OperatorMarket/Create/components/ConfigureStep.tsx +++ b/frontend/src/pages/OperatorMarket/Create/components/ConfigureStep.tsx @@ -1,11 +1,18 @@ import { Alert, Input, Form } from "antd"; import TextArea from "antd/es/input/TextArea"; +import { useEffect } from "react"; export default function ConfigureStep({ parsedInfo, parseError, setParsedInfo, }) { + const [form] = Form.useForm(); + + useEffect(() => { + form.setFieldsValue(parsedInfo); + }, [parsedInfo]); + return ( <> {/* 解析结果 */} @@ -20,6 +27,7 @@ export default function ConfigureStep({ {parsedInfo && (
{ diff --git a/frontend/src/pages/OperatorMarket/Home/components/List.tsx b/frontend/src/pages/OperatorMarket/Home/components/List.tsx index 010e1e9..dbeac1b 100644 --- a/frontend/src/pages/OperatorMarket/Home/components/List.tsx +++ b/frontend/src/pages/OperatorMarket/Home/components/List.tsx @@ -89,6 +89,7 @@ export function ListView({ operators = [], pagination, operations }) { size="small" title={operation.label} icon={operation.icon} + danger={operation.danger} onClick={() => operation.onClick(operator)} /> )), @@ -117,12 +118,12 @@ export function ListView({ operators = [], pagination, operations }) { description={
{operator.description}
-
+ {/*
作者: {operator.author} 类型: {operator.type} 框架: {operator.framework} 使用次数: {operator?.usage?.toLocaleString()} -
+
*/}
} /> diff --git a/frontend/src/pages/TaskManagement/TaskManagement.tsx b/frontend/src/pages/TaskManagement/TaskManagement.tsx deleted file mode 100644 index e69de29..0000000