feat(aihr): trace sop feedback to search review
This commit is contained in:
+2
-2
@@ -38,13 +38,13 @@ public final class AihrSopDto {
|
||||
public record SopReviewResponse(Long id, Boolean usable, String status, String reviewedAt) {
|
||||
}
|
||||
|
||||
public record AnswerFeedbackRequest(String queryText, Long fragmentId, List<Long> fragmentIds, String verdict, String category, String position, String source) {
|
||||
public record AnswerFeedbackRequest(String queryText, Long fragmentId, List<Long> fragmentIds, String verdict, String category, String position, String source, Long reviewId) {
|
||||
}
|
||||
|
||||
public record AnswerFeedbackResponse(Integer saved, String verdict, String reviewStatus) {
|
||||
}
|
||||
|
||||
public record AnswerFeedbackItemResponse(Long id, String queryText, String queryNorm, Long fragmentId, String verdict, String category, String position, String source, String reviewStatus, String createTime, String updateTime) {
|
||||
public record AnswerFeedbackItemResponse(Long id, String queryText, String queryNorm, Long fragmentId, String verdict, String category, String position, String source, Long reviewId, String reviewStatus, String createTime, String updateTime) {
|
||||
}
|
||||
|
||||
public record AnswerFeedbackReviewResponse(Long id, String reviewStatus) {
|
||||
|
||||
+8
-3
@@ -232,14 +232,15 @@ public class AihrSopSeedService {
|
||||
for (Long fragmentId : fragmentIds) {
|
||||
saved += jdbcTemplate.update("""
|
||||
INSERT INTO aihr_knowledge_answer_feedback
|
||||
(tenant_id, query_text, query_norm, fragment_id, verdict, category, position, source, review_status, create_time, update_time)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
(tenant_id, query_text, query_norm, fragment_id, verdict, category, position, source, review_id, review_status, create_time, update_time)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
query_text = VALUES(query_text),
|
||||
verdict = VALUES(verdict),
|
||||
category = VALUES(category),
|
||||
position = VALUES(position),
|
||||
source = VALUES(source),
|
||||
review_id = VALUES(review_id),
|
||||
review_status = VALUES(review_status),
|
||||
update_time = VALUES(update_time)
|
||||
""",
|
||||
@@ -251,6 +252,7 @@ public class AihrSopSeedService {
|
||||
firstNonBlank(request.category(), "sop"),
|
||||
firstNonBlank(request.position(), "生活顾问"),
|
||||
normalizeSearchSource(request.source()),
|
||||
request.reviewId(),
|
||||
reviewStatus,
|
||||
now,
|
||||
now
|
||||
@@ -264,7 +266,7 @@ public class AihrSopSeedService {
|
||||
String reviewStatus = firstNonBlank(status, "待复核");
|
||||
int limitValue = Math.max(1, Math.min(limit, 200));
|
||||
return jdbcTemplate.query("""
|
||||
SELECT id, query_text, query_norm, fragment_id, verdict, category, position, source, review_status, create_time, update_time
|
||||
SELECT id, query_text, query_norm, fragment_id, verdict, category, position, source, review_id, review_status, create_time, update_time
|
||||
FROM aihr_knowledge_answer_feedback
|
||||
WHERE tenant_id = ?
|
||||
AND (? = '' OR review_status = ?)
|
||||
@@ -279,6 +281,7 @@ public class AihrSopSeedService {
|
||||
rs.getString("category"),
|
||||
rs.getString("position"),
|
||||
rs.getString("source"),
|
||||
rs.getObject("review_id") == null ? null : rs.getLong("review_id"),
|
||||
rs.getString("review_status"),
|
||||
formatTimestamp(rs.getTimestamp("create_time")),
|
||||
formatTimestamp(rs.getTimestamp("update_time"))
|
||||
@@ -1968,6 +1971,7 @@ public class AihrSopSeedService {
|
||||
`category` varchar(100) DEFAULT NULL COMMENT '知识分类',
|
||||
`position` varchar(80) DEFAULT NULL COMMENT '岗位',
|
||||
`source` varchar(50) DEFAULT 'knowledge_search' COMMENT '来源',
|
||||
`review_id` bigint DEFAULT NULL COMMENT '对应SOP问答评审ID',
|
||||
`review_status` varchar(30) DEFAULT '待复核' COMMENT '复核状态',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
@@ -1977,6 +1981,7 @@ public class AihrSopSeedService {
|
||||
KEY `idx_aihr_answer_feedback_review` (`tenant_id`, `review_status`, `create_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='AI HR 知识答案反馈';
|
||||
""");
|
||||
ensureColumn("aihr_knowledge_answer_feedback", "review_id", "ALTER TABLE aihr_knowledge_answer_feedback ADD COLUMN `review_id` bigint DEFAULT NULL COMMENT '对应SOP问答评审ID' AFTER `source`");
|
||||
answerFeedbackTableReady = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ CREATE TABLE IF NOT EXISTS `aihr_knowledge_answer_feedback` (
|
||||
`category` varchar(100) DEFAULT NULL COMMENT '知识分类',
|
||||
`position` varchar(80) DEFAULT NULL COMMENT '岗位',
|
||||
`source` varchar(50) DEFAULT 'knowledge_search' COMMENT '来源',
|
||||
`review_id` bigint DEFAULT NULL COMMENT '对应SOP问答评审ID',
|
||||
`review_status` varchar(30) DEFAULT '待复核' COMMENT '复核状态',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
|
||||
Reference in New Issue
Block a user