Skip to content

Commit 1797e22

Browse files
authored
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
1 parent e854a02 commit 1797e22

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

frontend/src/pages/OperatorMarket/Create/OperatorPluginCreate.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function OperatorPluginCreate() {
2929
const { message } = App.useApp();
3030
const [uploadStep, setUploadStep] = useState<
3131
"upload" | "parsing" | "configure" | "preview"
32-
>("upload");
32+
>(id ? "configure" : "upload");
3333
const [isUploading, setIsUploading] = useState(false);
3434
const [parsedInfo, setParsedInfo] = useState({});
3535
const [parseError, setParseError] = useState<string | null>(null);
@@ -63,10 +63,10 @@ export default function OperatorPluginCreate() {
6363
},
6464
], // 假设只上传一个文件
6565
});
66-
setParsedInfo({ ...parsedInfo, fileName, percent: 100 }); // 上传完成,进度100%
66+
setParsedInfo({ ...parsedInfo, percent: 100 }); // 上传完成,进度100%
6767
// 解析文件过程
6868
const res = await uploadOperatorUsingPost({ fileName });
69-
setParsedInfo({ ...parsedInfo, ...res.data });
69+
setParsedInfo({ ...parsedInfo, ...res.data, fileName });
7070
} catch (err) {
7171
setParseError("文件解析失败," + err.data.message);
7272
} finally {
@@ -92,7 +92,6 @@ export default function OperatorPluginCreate() {
9292
// 编辑模式,加载已有算子信息逻辑待实现
9393
const { data } = await queryOperatorByIdUsingGet(operatorId);
9494
setParsedInfo(data);
95-
setUploadStep("configure");
9695
};
9796

9897
useEffect(() => {
@@ -110,7 +109,9 @@ export default function OperatorPluginCreate() {
110109
<Button type="text" onClick={() => navigate("/data/operator-market")}>
111110
<ArrowLeft className="w-4 h-4" />
112111
</Button>
113-
<h1 className="text-xl font-bold text-gray-900">上传算子</h1>
112+
<h1 className="text-xl font-bold text-gray-900">
113+
{id ? "更新算子" : "上传算子"}
114+
</h1>
114115
</div>
115116
<div className="w-1/2">
116117
<Steps
@@ -173,7 +174,7 @@ export default function OperatorPluginCreate() {
173174
<div className="flex justify-end gap-3 mt-8">
174175
<Button onClick={() => setUploadStep("upload")}>重新上传</Button>
175176
<Button type="primary" onClick={handlePublish}>
176-
发布算子
177+
{id ? "更新" : "发布"}算子
177178
</Button>
178179
</div>
179180
)}

frontend/src/pages/OperatorMarket/Create/components/ConfigureStep.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import { Alert, Input, Form } from "antd";
22
import TextArea from "antd/es/input/TextArea";
3+
import { useEffect } from "react";
34

45
export default function ConfigureStep({
56
parsedInfo,
67
parseError,
78
setParsedInfo,
89
}) {
10+
const [form] = Form.useForm();
11+
12+
useEffect(() => {
13+
form.setFieldsValue(parsedInfo);
14+
}, [parsedInfo]);
15+
916
return (
1017
<>
1118
{/* 解析结果 */}
@@ -20,6 +27,7 @@ export default function ConfigureStep({
2027

2128
{parsedInfo && (
2229
<Form
30+
form={form}
2331
layout="vertical"
2432
initialValues={parsedInfo}
2533
onValuesChange={(_, allValues) => {

frontend/src/pages/OperatorMarket/Home/components/List.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export function ListView({ operators = [], pagination, operations }) {
8989
size="small"
9090
title={operation.label}
9191
icon={operation.icon}
92+
danger={operation.danger}
9293
onClick={() => operation.onClick(operator)}
9394
/>
9495
)),
@@ -117,12 +118,12 @@ export function ListView({ operators = [], pagination, operations }) {
117118
description={
118119
<div className="space-y-2">
119120
<div className="text-gray-600 ">{operator.description}</div>
120-
<div className="flex items-center gap-4 text-xs text-gray-500">
121+
{/* <div className="flex items-center gap-4 text-xs text-gray-500">
121122
<span>作者: {operator.author}</span>
122123
<span>类型: {operator.type}</span>
123124
<span>框架: {operator.framework}</span>
124125
<span>使用次数: {operator?.usage?.toLocaleString()}</span>
125-
</div>
126+
</div> */}
126127
</div>
127128
}
128129
/>

frontend/src/pages/TaskManagement/TaskManagement.tsx

Whitespace-only changes.

0 commit comments

Comments
 (0)