From ed7a5c6873da891b0e4108bc556a7ec23a3640d5 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 19 Jan 2026 16:10:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(annotation):=20=E6=B7=BB=E5=8A=A0=E6=A0=87?= =?UTF-8?q?=E6=B3=A8=E7=BC=96=E8=BE=91=E5=99=A8=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 引入 MenuFoldOutlined 和 MenuUnfoldOutlined 图标用于侧边栏控制 - 添加 sidebarCollapsed 状态管理侧边栏展开/收起状态 - 扩展 Label Studio 界面配置,启用完整的标注界面组件 - 实现可折叠的左侧文件列表,支持展开/收起操作 - 优化顶部工具栏布局,调整标题层级和按钮标签 - 改进文件列表样式,添加悬停效果和更清晰的状态标识 - 调整整体布局结构,提升编辑器区域的空间利用率 --- .../Annotate/LabelStudioTextEditor.tsx | 163 +++++++++++------- 1 file changed, 97 insertions(+), 66 deletions(-) diff --git a/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx b/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx index b58cd09..a526737 100644 --- a/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx +++ b/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useRef, useState } from "react"; import { App, Button, Card, List, Spin, Typography } from "antd"; -import { LeftOutlined, ReloadOutlined, SaveOutlined } from "@ant-design/icons"; +import { LeftOutlined, ReloadOutlined, SaveOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons"; import { useNavigate, useParams } from "react-router"; import { @@ -54,6 +54,7 @@ export default function LabelStudioTextEditor() { const [project, setProject] = useState(null); const [tasks, setTasks] = useState([]); const [selectedFileId, setSelectedFileId] = useState(""); + const [sidebarCollapsed, setSidebarCollapsed] = useState(false); const postToIframe = (type: string, payload?: any) => { const win = iframeRef.current?.contentWindow; @@ -128,15 +129,29 @@ export default function LabelStudioTextEditor() { labelConfig: project.labelConfig, task, user: { id: "datamate" }, + // 完整的 Label Studio 原生界面配置 interfaces: [ - "panel", - "update", - "controls", + // 核心面板 + "panel", // 导航面板(undo/redo/reset) + "update", // 更新按钮 + "submit", // 提交按钮 + "controls", // 控制面板 + // 侧边栏(包含 Outliner 和 Details) "side-column", + // 标注管理 "annotations:tabs", "annotations:menu", "annotations:current", + "annotations:add-new", + "annotations:delete", + "annotations:view-all", "annotations:history", + // 预测 + "predictions:tabs", + "predictions:menu", + // 其他 + "auto-annotation", + "edit-history", ], selectedAnnotationIndex: 0, allowCreateEmptyAnnotation: true, @@ -282,19 +297,25 @@ export default function LabelStudioTextEditor() { } return ( -
-
+
+ {/* 顶部工具栏 */} +
- - 标注 +
-
- + {/* 左侧文件列表 - 可折叠 */} +
- ( - setSelectedFileId(item.fileId)} - > -
-
- {item.fileName} - - {item.hasAnnotation ? "已标注" : "未标注"} +
+ 文件列表 +
+
+ ( + setSelectedFileId(item.fileId)} + > +
+ + {item.fileName} +
+ + {item.hasAnnotation ? "已标注" : "未标注"} + + {item.annotationUpdatedAt && ( + + {item.annotationUpdatedAt} + + )} +
- {item.annotationUpdatedAt && ( - - 更新: {item.annotationUpdatedAt} - - )} -
- - )} - /> - - - -
- {(!iframeReady || loadingTaskDetail || (selectedFileId && !lsReady)) && ( -
- -
- )} -