You've already forked DataMate
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
This commit is contained in:
@@ -29,7 +29,7 @@ export default function OperatorPluginCreate() {
|
|||||||
const { message } = App.useApp();
|
const { message } = App.useApp();
|
||||||
const [uploadStep, setUploadStep] = useState<
|
const [uploadStep, setUploadStep] = useState<
|
||||||
"upload" | "parsing" | "configure" | "preview"
|
"upload" | "parsing" | "configure" | "preview"
|
||||||
>("upload");
|
>(id ? "configure" : "upload");
|
||||||
const [isUploading, setIsUploading] = useState(false);
|
const [isUploading, setIsUploading] = useState(false);
|
||||||
const [parsedInfo, setParsedInfo] = useState({});
|
const [parsedInfo, setParsedInfo] = useState({});
|
||||||
const [parseError, setParseError] = useState<string | null>(null);
|
const [parseError, setParseError] = useState<string | null>(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 });
|
const res = await uploadOperatorUsingPost({ fileName });
|
||||||
setParsedInfo({ ...parsedInfo, ...res.data });
|
setParsedInfo({ ...parsedInfo, ...res.data, fileName });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setParseError("文件解析失败," + err.data.message);
|
setParseError("文件解析失败," + err.data.message);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -92,7 +92,6 @@ export default function OperatorPluginCreate() {
|
|||||||
// 编辑模式,加载已有算子信息逻辑待实现
|
// 编辑模式,加载已有算子信息逻辑待实现
|
||||||
const { data } = await queryOperatorByIdUsingGet(operatorId);
|
const { data } = await queryOperatorByIdUsingGet(operatorId);
|
||||||
setParsedInfo(data);
|
setParsedInfo(data);
|
||||||
setUploadStep("configure");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -110,7 +109,9 @@ export default function OperatorPluginCreate() {
|
|||||||
<Button type="text" onClick={() => navigate("/data/operator-market")}>
|
<Button type="text" onClick={() => navigate("/data/operator-market")}>
|
||||||
<ArrowLeft className="w-4 h-4" />
|
<ArrowLeft className="w-4 h-4" />
|
||||||
</Button>
|
</Button>
|
||||||
<h1 className="text-xl font-bold text-gray-900">上传算子</h1>
|
<h1 className="text-xl font-bold text-gray-900">
|
||||||
|
{id ? "更新算子" : "上传算子"}
|
||||||
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-1/2">
|
<div className="w-1/2">
|
||||||
<Steps
|
<Steps
|
||||||
@@ -173,7 +174,7 @@ export default function OperatorPluginCreate() {
|
|||||||
<div className="flex justify-end gap-3 mt-8">
|
<div className="flex justify-end gap-3 mt-8">
|
||||||
<Button onClick={() => setUploadStep("upload")}>重新上传</Button>
|
<Button onClick={() => setUploadStep("upload")}>重新上传</Button>
|
||||||
<Button type="primary" onClick={handlePublish}>
|
<Button type="primary" onClick={handlePublish}>
|
||||||
发布算子
|
{id ? "更新" : "发布"}算子
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
import { Alert, Input, Form } from "antd";
|
import { Alert, Input, Form } from "antd";
|
||||||
import TextArea from "antd/es/input/TextArea";
|
import TextArea from "antd/es/input/TextArea";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
export default function ConfigureStep({
|
export default function ConfigureStep({
|
||||||
parsedInfo,
|
parsedInfo,
|
||||||
parseError,
|
parseError,
|
||||||
setParsedInfo,
|
setParsedInfo,
|
||||||
}) {
|
}) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
form.setFieldsValue(parsedInfo);
|
||||||
|
}, [parsedInfo]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* 解析结果 */}
|
{/* 解析结果 */}
|
||||||
@@ -20,6 +27,7 @@ export default function ConfigureStep({
|
|||||||
|
|
||||||
{parsedInfo && (
|
{parsedInfo && (
|
||||||
<Form
|
<Form
|
||||||
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
initialValues={parsedInfo}
|
initialValues={parsedInfo}
|
||||||
onValuesChange={(_, allValues) => {
|
onValuesChange={(_, allValues) => {
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export function ListView({ operators = [], pagination, operations }) {
|
|||||||
size="small"
|
size="small"
|
||||||
title={operation.label}
|
title={operation.label}
|
||||||
icon={operation.icon}
|
icon={operation.icon}
|
||||||
|
danger={operation.danger}
|
||||||
onClick={() => operation.onClick(operator)}
|
onClick={() => operation.onClick(operator)}
|
||||||
/>
|
/>
|
||||||
)),
|
)),
|
||||||
@@ -117,12 +118,12 @@ export function ListView({ operators = [], pagination, operations }) {
|
|||||||
description={
|
description={
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="text-gray-600 ">{operator.description}</div>
|
<div className="text-gray-600 ">{operator.description}</div>
|
||||||
<div className="flex items-center gap-4 text-xs text-gray-500">
|
{/* <div className="flex items-center gap-4 text-xs text-gray-500">
|
||||||
<span>作者: {operator.author}</span>
|
<span>作者: {operator.author}</span>
|
||||||
<span>类型: {operator.type}</span>
|
<span>类型: {operator.type}</span>
|
||||||
<span>框架: {operator.framework}</span>
|
<span>框架: {operator.framework}</span>
|
||||||
<span>使用次数: {operator?.usage?.toLocaleString()}</span>
|
<span>使用次数: {operator?.usage?.toLocaleString()}</span>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user