适配QA问答对数据结构

This commit is contained in:
wh
2026-05-09 23:46:56 +08:00
parent e637e8a6a4
commit 9425ff3a1e
16 changed files with 359 additions and 101 deletions

View File

@@ -9,7 +9,7 @@ public record MergeReviewResultRequest(
@Schema(description = "合并后的答案映射key为qa记录IDvalue为合并后的答案")
Map<String, String> mergedAnswers,
@Schema(description = "审核备注")
String reviewComment
@Schema(description = "每条QA记录的审核评论映射key为qa记录IDvalue为审核评论")
Map<String, String> reviewComments
) {
}

View File

@@ -18,10 +18,25 @@ public record AnnotationResultCompareResponse(
@Schema(description = "问答记录")
public record QaRecord(
@Schema(description = "记录ID", example = "qa_001") String id,
@Schema(description = "批次ID", example = "50") Long batchId,
@Schema(description = "问题", example = "运输时效是多久?") String question,
@Schema(description = "答案", example = "3天") String answer,
@Schema(description = "是否需要审核", example = "true") Boolean requiresReview
) {}
@Schema(description = "是否需要审核", example = "true") Boolean requiresReview,
@Schema(description = "源片段信息") SourceSegments sourceSegments,
@Schema(description = "问题分类") String questionCategory,
@Schema(description = "评分") Scores scores,
@Schema(description = "审核评论") String reviewComment
) {
}
@Schema(description = "源片段信息")
public record SourceSegments(
@Schema(description = "片段内容") String segment,
@Schema(description = "块索引", example = "0") Integer chunkIndex,
@Schema(description = "块标题") String chunkTitle,
@Schema(description = "块内容") String chunkContent
) {
}
@Schema(description = "差异记录")
public record DiffRecord(
@@ -30,6 +45,19 @@ public record AnnotationResultCompareResponse(
@Schema(description = "提取模型答案", example = "3天") String extractAnswer,
@Schema(description = "校验模型答案", example = "72小时") String verifyAnswer,
@Schema(description = "差异原因", example = "时间单位不一致") String diffReason,
@Schema(description = "合并后的最终答案", example = "72小时3天") String mergedAnswer
) {}
@Schema(description = "合并后的最终答案", example = "72小时3天") String mergedAnswer,
@Schema(description = "问题分类") String questionCategory,
@Schema(description = "评分") Scores scores
) {
}
@Schema(description = "评分结构")
public record Scores(
@Schema(description = "相似度", example = "0.7") Double similarity,
@Schema(description = "置信度1", example = "0.9") Double confidence1,
@Schema(description = "置信度2", example = "0.85") Double confidence2,
@Schema(description = "幻觉检测", example = "0.9") Double hallucination,
@Schema(description = "信任度", example = "0.64") Double trust
) {
}
}

View File

@@ -25,8 +25,6 @@ public record AnnotationResultDetailResponse(
@Schema(description = "问答内容") QaContentDto qaContent,
@Schema(description = "差异摘要(需要审核时有值)") DiffContentDto diffSummary,
@Schema(description = "审核备注", example = "需统一时间字段口径。") String reviewComment,
@Schema(description = "审核时间", example = "2026-04-27T11:00:00") LocalDateTime reviewedAt,
@Schema(description = "创建时间", example = "2026-04-27T10:40:00") LocalDateTime createdAt
) {
@Schema(description = "问答内容结构")
@@ -38,9 +36,23 @@ public record AnnotationResultDetailResponse(
@Schema(description = "问答记录")
public record QaRecordDto(
@Schema(description = "记录ID", example = "q1") String id,
@Schema(description = "批次ID", example = "50") Long batchId,
@Schema(description = "问题", example = "产品重量是多少?") String question,
@Schema(description = "答案", example = "5kg") String answer,
@Schema(description = "是否需要审核", example = "false") Boolean requiresReview
@Schema(description = "是否需要审核", example = "false") Boolean requiresReview,
@Schema(description = "源片段信息") SourceSegmentsDto sourceSegments,
@Schema(description = "问题分类") String questionCategory,
@Schema(description = "评分") ScoresDto scores,
@Schema(description = "审核评论") String reviewComment
) {
}
@Schema(description = "源片段信息")
public record SourceSegmentsDto(
@Schema(description = "片段内容") String segment,
@Schema(description = "块索引", example = "0") Integer chunkIndex,
@Schema(description = "块标题") String chunkTitle,
@Schema(description = "块内容") String chunkContent
) {
}
@@ -57,7 +69,19 @@ public record AnnotationResultDetailResponse(
@Schema(description = "抽取答案", example = "2年") String extractAnswer,
@Schema(description = "验证答案", example = "3年") String verifyAnswer,
@Schema(description = "差异原因", example = "抽取与验证结果不一致") String diffReason,
@Schema(description = "合并后答案") String mergedAnswer
@Schema(description = "合并后答案") String mergedAnswer,
@Schema(description = "问题分类") String questionCategory,
@Schema(description = "评分") ScoresDto scores
) {
}
@Schema(description = "评分结构")
public record ScoresDto(
@Schema(description = "相似度", example = "0.7") Double similarity,
@Schema(description = "置信度1", example = "0.9") Double confidence1,
@Schema(description = "置信度2", example = "0.85") Double confidence2,
@Schema(description = "幻觉检测", example = "0.9") Double hallucination,
@Schema(description = "信任度", example = "0.64") Double trust
) {
}
}

View File

@@ -0,0 +1,63 @@
package com.labelsys.backend.dto.response;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "归档历史详情响应")
public record AnnotationResultHistoryDetailResponse(
@Schema(description = "历史记录ID", example = "901") Long id,
@Schema(description = "任务ID", example = "191000000000000301") Long taskId,
@Schema(description = "任务名称", example = "产品说明书标注") String taskName,
@Schema(description = "资源ID", example = "191000000000000101") Long resourceId,
@Schema(description = "资源名称", example = "产品A说明书.pdf") String resourceName,
@Schema(description = "问答内容文件路径", example = "annotation-results/2/qa/802.json") String qaContentFilePath,
@Schema(description = "问答内容") QaContentDto qaContent,
@Schema(description = "归档原因", example = "审核通过后归档") String archiveReason,
@Schema(description = "归档操作人ID", example = "5") Long archivedBy,
@Schema(description = "归档时间", example = "2026-05-06T10:30:00") LocalDateTime archivedAt,
@Schema(description = "创建时间", example = "2026-05-06T10:30:00") LocalDateTime createdAt,
@Schema(description = "审核人ID自动归档时为null", example = "5") Long reviewerId,
@Schema(description = "审核人姓名自动归档时为auto", example = "张三") String reviewerName
) {
@Schema(description = "问答内容结构")
public record QaContentDto(
@Schema(description = "问答记录列表") List<QaRecordDto> records
) {
}
@Schema(description = "问答记录")
public record QaRecordDto(
@Schema(description = "记录ID", example = "q1") String id,
@Schema(description = "批次ID", example = "50") Long batchId,
@Schema(description = "问题", example = "产品重量是多少?") String question,
@Schema(description = "答案", example = "5kg") String answer,
@Schema(description = "是否需要审核", example = "false") Boolean requiresReview,
@Schema(description = "源片段信息") SourceSegmentsDto sourceSegments,
@Schema(description = "问题分类") String questionCategory,
@Schema(description = "评分") ScoresDto scores,
@Schema(description = "审核评论") String reviewComment
) {
}
@Schema(description = "源片段信息")
public record SourceSegmentsDto(
@Schema(description = "片段内容") String segment,
@Schema(description = "块索引", example = "0") Integer chunkIndex,
@Schema(description = "块标题") String chunkTitle,
@Schema(description = "块内容") String chunkContent
) {
}
@Schema(description = "评分结构")
public record ScoresDto(
@Schema(description = "相似度", example = "0.7") Double similarity,
@Schema(description = "置信度1", example = "0.9") Double confidence1,
@Schema(description = "置信度2", example = "0.85") Double confidence2,
@Schema(description = "幻觉检测", example = "0.9") Double hallucination,
@Schema(description = "信任度", example = "0.64") Double trust
) {
}
}

View File

@@ -20,7 +20,6 @@ public record AnnotationResultHistoryResponse(
@Schema(description = "归档时间", example = "2026-05-06T10:30:00") LocalDateTime archivedAt,
@Schema(description = "创建时间", example = "2026-05-06T10:30:00") LocalDateTime createdAt,
@Schema(description = "审核人ID自动归档时为null", example = "5") Long reviewerId,
@Schema(description = "审核人姓名自动归档时为auto", example = "张三") String reviewerName,
@Schema(description = "审核意见自动归档时为auto", example = "内容符合要求") String reviewerComment
@Schema(description = "审核人姓名自动归档时为auto", example = "张三") String reviewerName
) {
}

View File

@@ -17,8 +17,6 @@ public record AnnotationResultResponse(
@Schema(description = "是否已删除", example = "false") Boolean isDeleted,
@Schema(description = "问答内容文件路径", example = "annotation-results/2/qa/801.json") String qaContentFilePath,
@Schema(description = "差异摘要文件路径", example = "annotation-results/2/diff/801.json") String diffSummaryFilePath,
@Schema(description = "审核备注", example = "需统一时间字段口径。") String reviewComment,
@Schema(description = "审核时间", example = "2026-04-27T11:00:00") LocalDateTime reviewedAt,
@Schema(description = "创建时间", example = "2026-04-27T10:40:00") LocalDateTime createdAt
) {
}