From 0c94361cdeb7b949e5048d6487c85921ad4ad997 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sun, 18 Jan 2026 22:08:20 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat(annotation):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=A8=A1=E6=9D=BF=E7=A4=BA=E4=BE=8B=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a2b0fc3674dd0efd437af90aa388da2fc0637079. --- .../Template/TemplateDetail.tsx | 65 +---------- .../pages/DataAnnotation/annotation.model.ts | 6 -- .../components/TemplateConfigurationForm.tsx | 101 ------------------ .../app/module/annotation/schema/template.py | 7 +- 4 files changed, 2 insertions(+), 177 deletions(-) diff --git a/frontend/src/pages/DataAnnotation/Template/TemplateDetail.tsx b/frontend/src/pages/DataAnnotation/Template/TemplateDetail.tsx index 091eadf..202aa6f 100644 --- a/frontend/src/pages/DataAnnotation/Template/TemplateDetail.tsx +++ b/frontend/src/pages/DataAnnotation/Template/TemplateDetail.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Modal, Descriptions, Tag, Space, Divider, Card, Typography, Image, Empty } from "antd"; +import { Modal, Descriptions, Tag, Space, Divider, Card, Typography } from "antd"; import type { AnnotationTemplate } from "../annotation.model"; const { Text, Paragraph } = Typography; @@ -81,69 +81,6 @@ const TemplateDetail: React.FC = ({ - {/* 示例数据预览 */} - - {template.configuration.exampleData && - Object.keys(template.configuration.exampleData).length > 0 ? ( - - {template.configuration.objects.map((obj, index) => { - const varName = obj.value?.replace(/^\$/, "") || obj.name; - const exampleValue = template.configuration.exampleData?.[varName]; - - if (!exampleValue) return null; - - return ( - - -
- {obj.name} - - ({obj.type}) - -
- {/* 根据类型渲染不同的预览 */} - {obj.type === "Image" ? ( - {`示例: - ) : obj.type === "Audio" ? ( -
-
- ); - })} -
- ) : ( - - )} -
- {template.configuration.labels.map((label, index) => ( diff --git a/frontend/src/pages/DataAnnotation/annotation.model.ts b/frontend/src/pages/DataAnnotation/annotation.model.ts index 42b4e23..e74859a 100644 --- a/frontend/src/pages/DataAnnotation/annotation.model.ts +++ b/frontend/src/pages/DataAnnotation/annotation.model.ts @@ -53,12 +53,6 @@ export interface TemplateConfiguration { labels: LabelDefinition[]; objects: ObjectDefinition[]; metadata?: Record; - /** - * 示例数据,用于模板预览 - * key: 变量名(不带$前缀,如 "image"、"text") - * value: 示例内容(URL 或文本) - */ - exampleData?: Record; } export interface AnnotationTemplate { diff --git a/frontend/src/pages/DataAnnotation/components/TemplateConfigurationForm.tsx b/frontend/src/pages/DataAnnotation/components/TemplateConfigurationForm.tsx index 708039c..90995ea 100644 --- a/frontend/src/pages/DataAnnotation/components/TemplateConfigurationForm.tsx +++ b/frontend/src/pages/DataAnnotation/components/TemplateConfigurationForm.tsx @@ -8,15 +8,11 @@ import { Divider, Card, Checkbox, - Typography, - Image, } from "antd"; import { PlusOutlined, MinusCircleOutlined } from "@ant-design/icons"; import TagSelector from "../Template/components/TagSelector"; const { Option } = Select; -const { TextArea } = Input; -const { Text } = Typography; interface TemplateConfigurationFormProps { form: any; @@ -31,31 +27,6 @@ const TemplateConfigurationForm: React.FC = ({ ); }; - /** 判断对象类型是否为文本类 */ - const isTextType = (type: string) => { - return ["Text", "HyperText", "Table", "List"].includes(type); - }; - - /** 判断对象类型是否为图片类 */ - const isImageType = (type: string) => { - return ["Image"].includes(type); - }; - - /** 获取示例数据输入提示 */ - const getExamplePlaceholder = (type: string) => { - const map: Record = { - Text: "输入示例文本内容...", - HyperText: "输入示例 HTML 内容...", - Image: "输入图片 URL,如 https://example.com/image.jpg", - Audio: "输入音频 URL,如 https://example.com/audio.mp3", - Video: "输入视频 URL,如 https://example.com/video.mp4", - Table: "输入示例表格数据(JSON 格式)...", - List: "输入示例列表数据(JSON 格式)...", - TimeSeries: "输入时间序列数据 URL...", - }; - return map[type] || "输入示例数据..."; - }; - return ( <> 数据对象 @@ -316,78 +287,6 @@ const TemplateConfigurationForm: React.FC = ({ )} - - 示例数据(可选) - - - 为数据对象提供示例数据,帮助用户在模板预览时直观了解标注效果 - - prev.objects !== curr.objects}> - {({ getFieldValue }) => { - const objects = getFieldValue("objects") || []; - if (objects.length === 0) { - return ( - 请先添加数据对象 - ); - } - return ( - - {objects.map((obj: any, index: number) => { - if (!obj?.name) return null; - const varName = obj.value?.replace(/^\$/, "") || obj.name; - const objType = obj.type || "Text"; - - return ( - - -
- {obj.name} - - ({objType}) - -
- - {isTextType(objType) ? ( -