From 3234f6f2d790de0afe76c5771a639d06c669c62f Mon Sep 17 00:00:00 2001 From: sunxiqing <2240398334@qq.com> Date: Sat, 11 Oct 2025 18:14:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(llm):=20=E6=B7=BB=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=A0=87=E6=B3=A8=E7=AE=A1=E7=90=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 AnnotationController 控制器,提供标注保存接口- 新增 AnnotationInfoCreateDTO 数据传输对象,用于接收标注信息 - 新增 DataResponseBody 统一响应体类,规范接口返回格式 - 新增 Dataset 数据集实体类,定义数据集基本属性和状态 - 新增 DatasetCreateDTO 和 DatasetCustomCreateDTO 数据集创建传输对象- 新增 DatasetTypeEnum 枚举类,定义数据集类型 - 新增 DataStateCodeConstant 常量类,定义数据集状态码 - 新增 AnnotationService 接口及其实现类 AnnotationServiceImpl- 新增系统权限相关 DTO 类 SysPermissionDTO - 添加数据集相关的 DTO、VO、枚举等辅助类 --- .../admin/rest/AnnotationController.java | 67 +++++++ .../admin/rest/dto/DatasetCreateDTO.java | 115 +++++++++++ .../rest/dto/DatasetCustomCreateDTO.java | 59 ++++++ .../rest/enums/DataStateCodeConstant.java | 84 ++++++++ .../admin/rest/enums/DatasetTypeEnum.java | 67 +++++++ .../rest/vo/AnnotationInfoCreateDTO.java | 60 ++++++ .../admin/rest/vo/DataResponseBody.java | 69 +++++++ .../admin/rest/vo/DatasetVersionQueryVO.java | 39 ++++ .../admin/rest/vo/SysPermissionDTO.java | 38 ++++ .../controller/admin/rest/vo/SysRoleDTO.java | 48 +++++ .../admin/rest/vo/SysUserConfigDTO.java | 54 +++++ .../llm/controller/admin/rest/vo/TeamDTO.java | 53 +++++ .../llm/controller/admin/rest/vo/UserDTO.java | 68 +++++++ .../admin/rest/vo/UserSmallDTO.java | 38 ++++ .../llm/dal/dataobject/rest/Dataset.java | 185 ++++++++++++++++++ .../llm/dal/mysql/rest/DatasetMapper.java | 111 +++++++++++ .../llm/service/rest/AnnotationService.java | 39 ++++ .../service/rest/AnnotationServiceImpl.java | 91 +++++++++ .../llm/service/rest/DatasetService.java | 27 +++ .../llm/service/rest/DatasetServiceImpl.java | 40 ++++ 20 files changed, 1352 insertions(+) create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/AnnotationController.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCreateDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCustomCreateDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DataStateCodeConstant.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DatasetTypeEnum.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/AnnotationInfoCreateDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DataResponseBody.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DatasetVersionQueryVO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysPermissionDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysRoleDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysUserConfigDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/TeamDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserSmallDTO.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/dataobject/rest/Dataset.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/mysql/rest/DatasetMapper.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationService.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationServiceImpl.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetService.java create mode 100644 yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetServiceImpl.java diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/AnnotationController.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/AnnotationController.java new file mode 100644 index 000000000..af20e2a18 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/AnnotationController.java @@ -0,0 +1,67 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest; + +import cn.iocoder.yudao.module.llm.controller.admin.rest.vo.AnnotationInfoCreateDTO; +import cn.iocoder.yudao.module.llm.controller.admin.rest.vo.DataResponseBody; +import cn.iocoder.yudao.module.llm.service.rest.AnnotationService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * @description 标注管理 + * @date 2020-04-10 + */ +@Tag(name = "数据处理:标注") +@RestController +@RequestMapping("/datasets/files") +@Validated +public class AnnotationController { + + /** + * 标注服务实现类 + */ + @Autowired + @Lazy + private AnnotationService annotationService; + + + + @Operation(summary = "标注保存") + @PostMapping(value = "/{datasetId}/{fileId}/annotations") + public DataResponseBody save(@PathVariable(value = "fileId") Long fileId, + @PathVariable(value = "datasetId") Long datasetId, + @Validated @RequestBody AnnotationInfoCreateDTO annotationInfoCreateDTO) { + annotationService.save(fileId,datasetId, annotationInfoCreateDTO); + return new DataResponseBody(); + } + + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCreateDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCreateDTO.java new file mode 100644 index 000000000..157313372 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCreateDTO.java @@ -0,0 +1,115 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.dto; + +import cn.iocoder.yudao.module.llm.controller.admin.rest.enums.DataStateCodeConstant; +import cn.iocoder.yudao.module.llm.dal.dataobject.rest.Dataset; +import com.baomidou.mybatisplus.annotation.EnumValue; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * @description 数据集 + * @date 2020-04-17 + */ +@NoArgsConstructor +@AllArgsConstructor +@Data +@Builder +public class DatasetCreateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotBlank(message = "数据名不能为空", groups = Create.class) + @Size(min = 1, max = 50, message = "数据名长度范围只能是1~50", groups = Create.class) + private String name; + + @Schema(description = "备注信息") + private String remark; + + @Schema(description = "类型 0: private 私有数据, 1:team 团队数据 2:public 公开数据") + @NotNull(message = "类型不能为空", groups = Create.class) +// @EnumValue(enumClass = DatasetTypeEnum.class, enumMethod = "isValid", +// message = "类型参数不对,请使用 0-私有数据, 1-团队数据 2-公开数据", groups = Create.class) + private Integer type; + + @Schema(description = "团队编号") + private Long teamId; + + @Schema(description = "数据类型:0图片,1视频, 2文本") + @NotNull(message = "数据类型不能为空", groups = Create.class) +// @EnumValue(enumClass = DatatypeEnum.class, enumMethod = "isValid", message = Constant.DATA_TYPE_RULE, groups = Create.class) + private Integer dataType; + + @Schema(description = "标注类型:101分类,102目标检测,201目标跟踪 301文本分类") + @NotNull(message = "数据用于标注的类型不能为空", groups = Create.class) +// @EnumValue(enumClass = AnnotateTypeEnum.class, enumMethod = "isValid", message = Constant.ANNOTATE_TYPE_RULE, groups = Create.class) + private Integer annotateType; + + @Schema(description = "标签组Id") + private Long labelGroupId; + + @Schema(description = "预置标签类型 2:imageNet 3:MS COCO") + private Integer presetLabelType; + + @Schema(description = "是否用户导入") + @TableField(value = "is_import") + private boolean isImport; + + @Schema(description = "模板") + private Integer templateType; + + @Schema(description = "所属模块") + private Integer module; + + public @interface Create { + } + + /** + * DatasetCreateDTO 转换Dataset + * + * @param datasetCreateDTO 数据集创建DTO + * @return 数据集 + */ + public static Dataset from(DatasetCreateDTO datasetCreateDTO) { + Dataset dataset = new Dataset(datasetCreateDTO); + dataset.setStatus(DataStateCodeConstant.NOT_ANNOTATION_STATE); + dataset.setModule(datasetCreateDTO.getModule()); + return dataset; + } + + /** + * 更新数据集 + * + * @param datasetCreateDTO 数据集创建DTO + * @return 数据集 + */ + public static Dataset update(DatasetCreateDTO datasetCreateDTO) { + return new Dataset(datasetCreateDTO); + } + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCustomCreateDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCustomCreateDTO.java new file mode 100644 index 000000000..17086597c --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/dto/DatasetCustomCreateDTO.java @@ -0,0 +1,59 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.dto; + + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; + +/** + * @description 自定义数据集 + * @date 2020-07-28 + */ +@Data +public class DatasetCustomCreateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "数据集名称") + @Size(min = 1, max = 50, message = "数据名长度范围只能是1~50", groups = Create.class) + private String name; + + @Schema(description = "数据集描述") + private String desc; + + @Schema(description = "数据集压缩包地址") + @NotNull(message = "请上传压缩包!", groups = Create.class) + private String archiveUrl; + + @Schema(description = "数据集类型") + @NotNull(message = "请指定上传的数据集类型!", groups = Create.class) + private Integer datasetType; + + @Schema(description = "标注类型") + @NotNull(message = "请指定需要的标注类型!", groups = Create.class) + private Integer annotateType; + + public @interface Create { + } + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DataStateCodeConstant.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DataStateCodeConstant.java new file mode 100644 index 000000000..0c264dc7d --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DataStateCodeConstant.java @@ -0,0 +1,84 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ +package cn.iocoder.yudao.module.llm.controller.admin.rest.enums; + +/** + * @description 数据集状态码 + * @date 2020-09-03 + */ +public class DataStateCodeConstant { + + private DataStateCodeConstant() { + } + + /** + * 未标注 + */ + public static final Integer NOT_ANNOTATION_STATE = 101; + /** + * 手动标注中 + */ + public static final Integer MANUAL_ANNOTATION_STATE = 102; + /** + * 自动标注中 + */ + public static final Integer AUTOMATIC_LABELING_STATE = 103; + /** + * 自动标注完成 + */ + public static final Integer AUTO_TAG_COMPLETE_STATE = 104; + /** + * 标注完成 + */ + public static final Integer ANNOTATION_COMPLETE_STATE = 105; + + /** + * 目标跟踪中 + */ + public static final Integer TARGET_FOLLOW_STATE = 201; + /** + * 目标跟踪完成 + */ + public static final Integer TARGET_COMPLETE_STATE = 202; + /** + * 目标跟踪失败 + */ + public static final Integer TARGET_FAILURE_STATE = 203; + + /** + * 未采样 + */ + public static final Integer NOT_SAMPLED_STATE = 301; + /** + * 采样中 + */ + public static final Integer SAMPLING_STATE = 302; + /** + * 采样失败 + */ + public static final Integer SAMPLED_FAILURE_STATE = 303; + + /** + * 增强中 + */ + public static final Integer STRENGTHENING_STATE = 401; + /** + * 导入中 + */ + public static final Integer IN_THE_IMPORT_STATE = 402; + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DatasetTypeEnum.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DatasetTypeEnum.java new file mode 100644 index 000000000..fa601c303 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/enums/DatasetTypeEnum.java @@ -0,0 +1,67 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.enums; + + +import lombok.Getter; + +/** + * @description 数据集类型 + * @date 2020-11-25 + */ +@Getter +public enum DatasetTypeEnum { + + /** + * 私有数据 + */ + PRIVATE(0, "私有数据"), + /** + * 团队数据 + */ + TEAM(1, "团队数据"), + /** + * 公开数据 + */ + PUBLIC(2, "公开数据"); + + DatasetTypeEnum(Integer value, String msg) { + this.value = value; + this.msg = msg; + } + + private Integer value; + + private String msg; + + /** + * 数据类型校验 用户web端接口调用时参数校验 + * + * @param value 数据类型 + * @return 参数校验结果 + */ + public static boolean isValid(Integer value) { + for (DatasetTypeEnum datasetTypeEnum : DatasetTypeEnum.values()) { + if (datasetTypeEnum.value.equals(value)) { + return true; + } + } + return false; + } + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/AnnotationInfoCreateDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/AnnotationInfoCreateDTO.java new file mode 100644 index 000000000..1c570b532 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/AnnotationInfoCreateDTO.java @@ -0,0 +1,60 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @description 标注文件保存 + * @date 2020-04-10 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class AnnotationInfoCreateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "标注信息") + @NotBlank(message = "标注信息不能为空") + private String annotation; + + @Schema(description = "文件id") + @NotNull(message = "文件id不能为空") + private Long id; + + @Schema(description = "数据集ID") + private Long datasetId; + + @Schema(description = "当前版本") + private String currentVersionName; + + @Schema(description = "数据集类型") + private Integer dataType; + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DataResponseBody.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DataResponseBody.java new file mode 100644 index 000000000..15dee0e53 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DataResponseBody.java @@ -0,0 +1,69 @@ +/** + * Copyright 2020 Zhejiang Lab. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + + +import lombok.Data; +import org.slf4j.MDC; + +import java.io.Serializable; + +/** + * @description 统一的公共响应体 + * @date 2020-03-16 + */ +@Data +public class DataResponseBody implements Serializable { + + /** + * 返回状态码 + */ + private Integer code; + /** + * 返回信息 + */ + private String msg; + /** + * 泛型数据 + */ + private T data; + /** + * 链路追踪ID + */ + private String traceId; + + public DataResponseBody() { + this(200, null); + } + + public DataResponseBody(T data) { + this(200, null, data); + } + + public DataResponseBody(Integer code, String msg) { + this(code, msg, null); + } + + public DataResponseBody(Integer code, String msg, T data) { + this.code = code; + this.msg = msg; + this.data = data; + this.traceId = MDC.get("traceId"); + } + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DatasetVersionQueryVO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DatasetVersionQueryVO.java new file mode 100644 index 000000000..b493eb3a8 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/DatasetVersionQueryVO.java @@ -0,0 +1,39 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + + +import lombok.Data; + +import java.io.Serializable; + +/** + * @description 数据集版本查询 + * @date 2020-6-10 + */ +@Data +public class DatasetVersionQueryVO implements Serializable { + private static final long serialVersionUID = 1L; + +// @ApiModelProperty("数据集ID") + private Long id; + +// @ApiModelProperty("数据集名称") + private String name; + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysPermissionDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysPermissionDTO.java new file mode 100644 index 000000000..f7a60b5e1 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysPermissionDTO.java @@ -0,0 +1,38 @@ +/** + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * @description 系统权限DTO + * @date 2020-06-29 + */ +@Data +public class SysPermissionDTO implements Serializable { + + private static final long serialVersionUID = -3836401769559845765L; + + private Long roleId; + + private String permission; + + private String name; + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysRoleDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysRoleDTO.java new file mode 100644 index 000000000..3007b799e --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysRoleDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * @description 系统角色DTO + * @date 2020-06-29 + */ +@Data +public class SysRoleDTO implements Serializable { + + private static final long serialVersionUID = -3836401769559845765L; + + /** + * 权限列表 + */ + private List permissions; + + /** + * 角色名称 + */ + private String name; + + /** + * 角色ID + */ + private Long id; + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysUserConfigDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysUserConfigDTO.java new file mode 100644 index 000000000..829ea7958 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/SysUserConfigDTO.java @@ -0,0 +1,54 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @description 系统用户配置 DTO + * @date 2021-7-5 + */ +@Data +@Accessors(chain = true) +public class SysUserConfigDTO implements Serializable{ + + private static final long serialVersionUID = 1L; + + /** + * Notebook 延迟删除时间配置 + */ + private Integer notebookDelayDeleteTime; + + /** + * CPU 资源限制配置 + */ + private Integer cpuLimit; + + /** + * 内存资源限制配置 + */ + private Integer memoryLimit; + + /** + * GPU 资源限制配置 + */ + private Integer gpuLimit; + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/TeamDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/TeamDTO.java new file mode 100644 index 000000000..79f36ffb2 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/TeamDTO.java @@ -0,0 +1,53 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + +import lombok.Data; + + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +/** + * @description 团队转换DTO + * @date 2020-06-01 + */ +@Data +public class TeamDTO implements Serializable { + + private static final long serialVersionUID = -7049447715255649751L; + private Long id; + + private String name; + + private Boolean enabled; + + private Long pid; + + /** + * 团队成员 + */ + private List teamUserList; + + private Timestamp createTime; + + public String getLabel() { + return name; + } +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserDTO.java new file mode 100644 index 000000000..23df9f1d1 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserDTO.java @@ -0,0 +1,68 @@ +/** + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +/** + * @description 用户信息 + * @date 2020-06-29 + */ +@Data +public class UserDTO implements Serializable { + + private Long id; + + private String username; + + private String nickName; + + private String sex; + + private String email; + + private String phone; + + private Boolean enabled; + + private String remark; + + private Date lastPasswordResetTime; + + private Timestamp createTime; + + /** + * 头像路径 + */ + private String userAvatarPath; + + /** + * 角色 + */ + private List roles; + + /** + * 用户配置 + */ + private SysUserConfigDTO userConfig; + + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserSmallDTO.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserSmallDTO.java new file mode 100644 index 000000000..58e48b5c0 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/controller/admin/rest/vo/UserSmallDTO.java @@ -0,0 +1,38 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.controller.admin.rest.vo; + +import lombok.Data; + +/** + * @description 用户信息DTO + * @date 2020-06-01 + */ +@Data +public class UserSmallDTO { + private String username; + private String nickName; + + public UserSmallDTO() {} + + public UserSmallDTO(UserDTO userDTO) { + this.username = userDTO.getUsername(); + this.nickName = userDTO.getNickName(); + } + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/dataobject/rest/Dataset.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/dataobject/rest/Dataset.java new file mode 100644 index 000000000..e2f759484 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/dataobject/rest/Dataset.java @@ -0,0 +1,185 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.dal.dataobject.rest; + +import cn.iocoder.yudao.module.llm.controller.admin.rest.dto.DatasetCreateDTO; +import cn.iocoder.yudao.module.llm.controller.admin.rest.dto.DatasetCustomCreateDTO; +import cn.iocoder.yudao.module.llm.controller.admin.rest.enums.DataStateCodeConstant; +import cn.iocoder.yudao.module.llm.controller.admin.rest.enums.DatasetTypeEnum; +import cn.iocoder.yudao.module.llm.controller.admin.rest.vo.TeamDTO; +import cn.iocoder.yudao.module.llm.controller.admin.rest.vo.UserDTO; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.sql.Timestamp; + +/** + * @description 数据集 + * @date 2020-04-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("data_dataset") +//@ApiModel(value = "Dataset对象", description = "数据集管理") +@Builder +@ToString +@AllArgsConstructor +public class Dataset { + + private static final long serialVersionUID = 1L; + + @TableField("deleted") + private Boolean deleted = false; + + /** + * 数据集名称 + */ + private String name; + + /** + * 数据集备注 + */ + private String remark; + +// @ApiModelProperty(value = "类型 0: private 私有数据, 1:team 团队数据 2:public 公开数据") + private Integer type; + +// @ApiModelProperty(value = "数据类型:0图片,1视频, 2文本") + private Integer dataType; + +// @ApiModelProperty(value = "标注类型:2分类,1目标检测,5目标跟踪,6本文分类") + private Integer annotateType; + + private Long teamId; + + @TableId(type = IdType.AUTO) + private Long id; + +// @ApiModelProperty(value = "数据集存储位置") + private String uri; + +// @ApiModelProperty(value = "0:未标注,1:手动标注中,2:自动标注中,3:自动标注完成,4:标注完成") + private Integer status; + +// @ApiModelProperty(value = "当前版本号") + private String currentVersionName; + +// @ApiModelProperty(value = "是否用户导入") + @TableField(value = "is_import") + private boolean isImport; + +// @ApiModelProperty(value = "用户导入数据集压缩包地址") + private String archiveUrl; + +// @ApiModelProperty(value = "解压状态: 0未解压 1解压中 2解压完成 3解压失败") + private Integer decompressState; + +// @ApiModelProperty(value = "解压失败原因") + private String decompressFailReason; + +// @ApiModelProperty(value = "是否置顶") + @TableField(value = "is_top") + private boolean isTop; + +// @ApiModelProperty(value = "标签组Id") + private Long labelGroupId; + +// @ApiModelProperty(value = "数据集源ID") + private Long sourceId; + + /** + * 团队 + */ + @TableField(exist = false) + private TeamDTO team; + + /** + * 创建用户 + */ + @TableField(exist = false) + private UserDTO createUser; + + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Timestamp createTime; + + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private Timestamp updateTime; + + @TableField(value = "create_user_id", fill = FieldFill.INSERT) + private Long createUserId; + + @TableField(value = "update_user_id", fill = FieldFill.INSERT_UPDATE) + private Long updateUserId; + + private Long originUserId; + + @TableField(exist = false) + private UserDTO updateUser; + +// @ApiModelProperty(value = "模板") + private Integer templateType; + +// @ApiModelProperty(value = "所属模块") + private Integer module; + + public Dataset() { + } + + public Dataset(Long id, Integer status) { + this.id = id; + this.status = status; + } + + public Dataset(DatasetCreateDTO datasetCreateDTO) { + this.name = datasetCreateDTO.getName(); + this.remark = datasetCreateDTO.getRemark(); + this.type = datasetCreateDTO.getType(); + this.teamId = datasetCreateDTO.getTeamId(); + this.dataType = datasetCreateDTO.getDataType(); + this.annotateType = datasetCreateDTO.getAnnotateType(); + this.isImport = datasetCreateDTO.isImport(); + this.labelGroupId = datasetCreateDTO.getLabelGroupId(); + this.templateType=datasetCreateDTO.getTemplateType(); + } + + /** + * 用户自定义数据集 + * @param datasetCustomCreateDTO + */ + public Dataset(DatasetCustomCreateDTO datasetCustomCreateDTO) { + this.name = datasetCustomCreateDTO.getName(); + this.remark = datasetCustomCreateDTO.getDesc(); + this.type = DatasetTypeEnum.PRIVATE.getValue(); + this.dataType = datasetCustomCreateDTO.getDatasetType(); + this.annotateType = datasetCustomCreateDTO.getAnnotateType(); + this.status = DataStateCodeConstant.ANNOTATION_COMPLETE_STATE; + this.archiveUrl = datasetCustomCreateDTO.getArchiveUrl(); + this.isImport = true; + } + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/mysql/rest/DatasetMapper.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/mysql/rest/DatasetMapper.java new file mode 100644 index 000000000..47ce3a91d --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/dal/mysql/rest/DatasetMapper.java @@ -0,0 +1,111 @@ +///** +// * Copyright 2020 Tianshu AI Platform. All Rights Reserved. +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); +// * you may not use this file except in compliance with the License. +// * You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the License is distributed on an "AS IS" BASIS, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the License for the specific language governing permissions and +// * limitations under the License. +// * ============================================================= +// */ +// +//package cn.iocoder.yudao.module.llm.dal.mysql.rest; +// +//import cn.iocoder.yudao.module.llm.controller.admin.rest.vo.DatasetVersionQueryVO; +//import cn.iocoder.yudao.module.llm.dal.dataobject.rest.Dataset; +//import com.baomidou.mybatisplus.core.conditions.Wrapper; +//import com.baomidou.mybatisplus.core.mapper.BaseMapper; +//import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +//import org.apache.ibatis.annotations.Delete; +//import org.apache.ibatis.annotations.Param; +//import org.apache.ibatis.annotations.Select; +//import org.apache.ibatis.annotations.Update; +// +// +//import java.util.List; +// +///** +// * @description 数据集管理 Mapper 接口 +// * @date 2020-04-10 +// */ +////@DataPermission(ignoresMethod = {"insert", "selectById", "selectCountByPublic", "selectList", "dataVersionListVO"}) +//public interface DatasetMapper extends BaseMapper { +// +// /** +// * 分页获取数据集 +// * +// * @param page 分页插件 +// * @param queryWrapper 查询条件 +// * @return Page数据集列表 +// */ +// @Select("SELECT * FROM data_dataset ${ew.customSqlSegment}") +// Page listPage(Page page, @Param("ew") Wrapper queryWrapper); +// +// /** +// * 修改数据集当前版本 +// * +// * @param id 数据集ID +// * @param versionName 数据集版本名称 +// */ +// @Update("update data_dataset set current_version_name = #{versionName} where id = #{id}") +// void updateVersionName(@Param("id") Long id, @Param("versionName") String versionName); +// +// /** +// * 更新数据集状态 +// * +// * @param datasetId 数据集ID +// * @param status 数据集状态 +// */ +// @Update("update data_dataset set status = #{status} where id = #{datasetId}") +// void updateStatus(@Param("datasetId") Long datasetId, @Param("status") Integer status); +// +// +// /** +// * 获取指定类型数据集的数量 +// * +// * @param type 数据集类型 +// * @return int 公共数据集的数量 +// */ +// @Select("SELECT count(1) FROM data_dataset where type = #{type} and deleted = #{deleted}") +// int selectCountByPublic(@Param("type") Integer type,@Param("deleted") Integer deleted); +// +// +// /** +// * 根据标签组ID查询关联的数据集数量 +// * +// * @param labelGroupId 标签组ID +// * @return int 数量 +// */ +// @Select("SELECT count(1) FROM data_dataset where label_group_id = #{labelGroupId} and deleted =0") +// int getCountByLabelGroupId(@Param("labelGroupId") Long labelGroupId); +// +// +// /** +// * 数据集数据删除 +// * +// * @param id 数据集id +// * @param deleteFlag 删除标识 +// * @return int 数量 +// */ +// @Update("update data_dataset set deleted = #{deleteFlag} where id = #{id}") +// int updateStatusById(@Param("id") Long id, @Param("deleteFlag") boolean deleteFlag); +// +// /** +// * 根据数据集ID删除数据信息 +// * +// * @param datasetId 数据集ID +// */ +// @Delete("delete from data_dataset where id = #{datasetId}") +// void deleteInfoById(@Param("datasetId") Long datasetId); +// +// List dataVersionListVO(@Param("annotateType") Integer annotateType, +// @Param("module") Integer module, @Param("ids") List ids, +// @Param("currentUserId") Long currentUserId); +// +//} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationService.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationService.java new file mode 100644 index 000000000..72112513b --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationService.java @@ -0,0 +1,39 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.service.rest; + + +import cn.iocoder.yudao.module.llm.controller.admin.rest.vo.AnnotationInfoCreateDTO; + +/** + * @description 标注信息服务类 + * @date 2020-07-16 + */ +public interface AnnotationService { + + /** + * 保存标注(单个) + * + * @param fileId 文件ID + * @param datasetId 数据集ID + * @param annotationInfoCreateDTO 保存标注参数 + * @return int 标注成功数量 + */ + void save(Long fileId,Long datasetId, AnnotationInfoCreateDTO annotationInfoCreateDTO); + +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationServiceImpl.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationServiceImpl.java new file mode 100644 index 000000000..37402de38 --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/AnnotationServiceImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright 2020 Tianshu AI Platform. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================= + */ + +package cn.iocoder.yudao.module.llm.service.rest; + + +import cn.iocoder.yudao.module.llm.controller.admin.rest.vo.AnnotationInfoCreateDTO; +import cn.iocoder.yudao.module.llm.dal.dataobject.rest.Dataset; +import cn.iocoder.yudao.module.llm.service.dataset.DatasetService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +/** + * @description 标注service + * @date 2020-03-27 + */ +@Service +@Validated +public class AnnotationServiceImpl implements AnnotationService { + + /** + * 数据集服务类 + */ +// @Resource +// private DatasetService datasetService; + + @Override + public void save(Long fileId, Long datasetId, AnnotationInfoCreateDTO annotationInfoCreateDTO) { + + } + + /** + * 标注保存(单个) + * + * @param annotationInfoCreateDTO 标注信息 + */ +// @Override +// public void save(Long fileId, Long datasetId, AnnotationInfoCreateDTO annotationInfoCreateDTO) { +// Dataset dataset = datasetService.getOneById(datasetId); +// if (dataset == null) { +// throw new BusinessException(ErrorEnum.DATASET_ABSENT); +// } +// datasetService.checkPublic(dataset, OperationTypeEnum.UPDATE); +// //判断数据集是否在发布中 +// if (!StringUtils.isBlank(dataset.getCurrentVersionName())) { +// if (datasetVersionService.getDatasetVersionSourceVersion(dataset).getDataConversion().equals(NumberConstant.NUMBER_4)) { +// throw new BusinessException(ErrorEnum.DATASET_PUBLISH_ERROR); +// } +// } +// annotationInfoCreateDTO.setId(fileId); +// annotationInfoCreateDTO.setDatasetId(datasetId); +// annotationInfoCreateDTO.setCurrentVersionName(dataset.getCurrentVersionName()); +// annotationInfoCreateDTO.setDataType(dataset.getDataType()); +// doSave(annotationInfoCreateDTO); +// saveDatasetFileAnnotationsByImage(annotationInfoCreateDTO); +// //改变数据集的状态为标注中 +// StateMachineUtil.stateChange(new StateChangeDTO() {{ +// setObjectParam(new Object[]{dataset}); +// setEventMethodName(DataStateMachineConstant.DATA_MANUAL_ANNOTATION_SAVE_EVENT); +// setStateMachineType(DataStateMachineConstant.DATA_STATE_MACHINE); +// }}); +// //将文件改为标注中的状态 +// StateMachineUtil.stateChange(new StateChangeDTO() {{ +// setObjectParam(new Object[]{new DatasetVersionFile() {{ +// setDatasetId(dataset.getId()); +// setFileId(fileId); +// setVersionName(dataset.getCurrentVersionName()); +// }}}); +// setEventMethodName(FileStateMachineConstant.FILE_MANUAL_ANNOTATION_SAVE_EVENT); +// setStateMachineType(FileStateMachineConstant.FILE_STATE_MACHINE); +// }}); +// } +} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetService.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetService.java new file mode 100644 index 000000000..f0a994c5f --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetService.java @@ -0,0 +1,27 @@ +///** +// * Copyright 2020 Tianshu AI Platform. All Rights Reserved. +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); +// * you may not use this file except in compliance with the License. +// * You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the License is distributed on an "AS IS" BASIS, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the License for the specific language governing permissions and +// * limitations under the License. +// * ============================================================= +// */ +// +//package cn.iocoder.yudao.module.llm.service.rest; +// +// +///** +// * @description 数据集信息服务 +// * @date 2020-04-10 +// */ +//public interface DatasetService { +// +//} diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetServiceImpl.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetServiceImpl.java new file mode 100644 index 000000000..87955655f --- /dev/null +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/rest/DatasetServiceImpl.java @@ -0,0 +1,40 @@ +///** +// * Copyright 2020 Tianshu AI Platform. All Rights Reserved. +// * +// * Licensed under the Apache License, Version 2.0 (the "License"); +// * you may not use this file except in compliance with the License. +// * You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, software +// * distributed under the License is distributed on an "AS IS" BASIS, +// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// * See the License for the specific language governing permissions and +// * limitations under the License. +// * ============================================================= +// */ +// +//package cn.iocoder.yudao.module.llm.service.rest; +// +// +//import cn.iocoder.yudao.module.llm.dal.dataobject.rest.Dataset; +//import cn.iocoder.yudao.module.llm.dal.mysql.rest.DatasetMapper; +//import cn.iocoder.yudao.module.llm.service.dataset.DatasetService; +//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +//import org.springframework.context.annotation.EnableAspectJAutoProxy; +//import org.springframework.stereotype.Service; +// +///** +// * @description 数据集服务实现类 +// * @date 2020-04-10 +// */ +//@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) +//@Service +//public class DatasetServiceImpl extends ServiceImpl implements DatasetService { +// +// @Override +// public boolean save(Dataset entity) { +// return super.save(entity); +// } +//}