feat(broadcast): add multi-role insight contract
This commit is contained in:
+45
-1
@@ -61,8 +61,52 @@ public final class AihrBroadcastDto {
|
||||
String status,
|
||||
String summary,
|
||||
String errorMessage,
|
||||
String downloadUrl
|
||||
String downloadUrl,
|
||||
String insightStatus,
|
||||
String defaultPerspectiveCode,
|
||||
List<String> perspectiveLabels,
|
||||
List<BroadcastPerspective> perspectives
|
||||
) {
|
||||
public BroadcastAttachmentResponse {
|
||||
perspectiveLabels = perspectiveLabels == null ? List.of() : List.copyOf(perspectiveLabels);
|
||||
perspectives = perspectives == null ? List.of() : List.copyOf(perspectives);
|
||||
}
|
||||
|
||||
public BroadcastAttachmentResponse(
|
||||
Long id,
|
||||
String fileName,
|
||||
long fileSize,
|
||||
String contentType,
|
||||
String status,
|
||||
String summary,
|
||||
String errorMessage,
|
||||
String downloadUrl
|
||||
) {
|
||||
this(id, fileName, fileSize, contentType, status, summary, errorMessage, downloadUrl,
|
||||
"NOT_PROCESSED", null, List.of(), List.of());
|
||||
}
|
||||
}
|
||||
|
||||
public record BroadcastEvidence(int paragraphIndex, String quote) {
|
||||
}
|
||||
|
||||
public record BroadcastPerspective(
|
||||
String code,
|
||||
String label,
|
||||
String summary,
|
||||
List<String> concerns,
|
||||
List<String> impacts,
|
||||
List<String> actions,
|
||||
List<String> risks,
|
||||
List<BroadcastEvidence> evidence
|
||||
) {
|
||||
public BroadcastPerspective {
|
||||
concerns = concerns == null ? List.of() : List.copyOf(concerns);
|
||||
impacts = impacts == null ? List.of() : List.copyOf(impacts);
|
||||
actions = actions == null ? List.of() : List.copyOf(actions);
|
||||
risks = risks == null ? List.of() : List.copyOf(risks);
|
||||
evidence = evidence == null ? List.of() : List.copyOf(evidence);
|
||||
}
|
||||
}
|
||||
|
||||
public record AdminBroadcastListResponse(
|
||||
|
||||
+4
@@ -29,6 +29,10 @@ class AihrBroadcastAttachmentContractTest {
|
||||
assertTrue(context.contains("消息正文"));
|
||||
assertTrue(context.contains("原文件提取内容"));
|
||||
assertFalse(responseFields.contains("extractedText"));
|
||||
assertFalse(responseFields.contains("insightsJson"));
|
||||
assertTrue(responseFields.contains("insightStatus"));
|
||||
assertTrue(responseFields.contains("defaultPerspectiveCode"));
|
||||
assertTrue(responseFields.contains("perspectives"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
-- 公司消息 R4:同一公司文件的多岗位 AI 解读。
|
||||
-- 可重复执行,需在 aihr_20260724_broadcast_attachment_mysql8.sql 之后执行。
|
||||
|
||||
SET @has_broadcast_insight_status := (
|
||||
SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'aihr_broadcast_attachment'
|
||||
AND column_name = 'insight_status'
|
||||
);
|
||||
SET @broadcast_insight_ddl := IF(
|
||||
@has_broadcast_insight_status = 0,
|
||||
'ALTER TABLE aihr_broadcast_attachment ADD COLUMN insight_status varchar(20) NOT NULL DEFAULT ''NOT_PROCESSED'' COMMENT ''NOT_PROCESSED/PENDING/PROCESSING/READY/PARTIAL/FAILED'' AFTER summary',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE broadcast_insight_stmt FROM @broadcast_insight_ddl; EXECUTE broadcast_insight_stmt; DEALLOCATE PREPARE broadcast_insight_stmt;
|
||||
|
||||
SET @has_broadcast_insights_json := (
|
||||
SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'aihr_broadcast_attachment'
|
||||
AND column_name = 'insights_json'
|
||||
);
|
||||
SET @broadcast_insight_ddl := IF(
|
||||
@has_broadcast_insights_json = 0,
|
||||
'ALTER TABLE aihr_broadcast_attachment ADD COLUMN insights_json longtext DEFAULT NULL COMMENT ''经原文引用校验的多岗位解读 JSON'' AFTER insight_status',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE broadcast_insight_stmt FROM @broadcast_insight_ddl; EXECUTE broadcast_insight_stmt; DEALLOCATE PREPARE broadcast_insight_stmt;
|
||||
|
||||
SET @has_broadcast_insight_version := (
|
||||
SELECT COUNT(*) FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE() AND table_name = 'aihr_broadcast_attachment'
|
||||
AND column_name = 'insight_version'
|
||||
);
|
||||
SET @broadcast_insight_ddl := IF(
|
||||
@has_broadcast_insight_version = 0,
|
||||
'ALTER TABLE aihr_broadcast_attachment ADD COLUMN insight_version varchar(30) DEFAULT NULL COMMENT ''解读规则版本'' AFTER insights_json',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE broadcast_insight_stmt FROM @broadcast_insight_ddl; EXECUTE broadcast_insight_stmt; DEALLOCATE PREPARE broadcast_insight_stmt;
|
||||
|
||||
SET @has_broadcast_insight_queue_index := (
|
||||
SELECT COUNT(*) FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE() AND table_name = 'aihr_broadcast_attachment'
|
||||
AND index_name = 'idx_aihr_broadcast_attachment_insight_queue'
|
||||
);
|
||||
SET @broadcast_insight_ddl := IF(
|
||||
@has_broadcast_insight_queue_index = 0,
|
||||
'ALTER TABLE aihr_broadcast_attachment ADD KEY idx_aihr_broadcast_attachment_insight_queue (insight_status, status, update_time)',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE broadcast_insight_stmt FROM @broadcast_insight_ddl; EXECUTE broadcast_insight_stmt; DEALLOCATE PREPARE broadcast_insight_stmt;
|
||||
|
||||
SET @has_broadcast_insight_status := NULL;
|
||||
SET @has_broadcast_insights_json := NULL;
|
||||
SET @has_broadcast_insight_version := NULL;
|
||||
SET @has_broadcast_insight_queue_index := NULL;
|
||||
SET @broadcast_insight_ddl := NULL;
|
||||
Reference in New Issue
Block a user