feat(broadcast): finish multi-role insight experience

This commit is contained in:
2026-07-25 15:18:58 +08:00
parent 7990db6883
commit 230dfb4dfc
20 changed files with 552 additions and 81 deletions
+34 -2
View File
@@ -4,6 +4,7 @@ export const broadcastQuestionContextStorageKey = 'aihr_broadcast_question_conte
export const broadcastQuestionContextTtlMs = 15 * 60 * 1000;
export type BroadcastMessageScope = 'ALL' | 'RELATED' | 'REQUIRED_UNREAD';
export type BroadcastInsightStatus = 'NOT_PROCESSED' | 'PENDING' | 'READY' | 'PARTIAL' | 'FAILED';
export interface BroadcastQuestionContext {
messageId: number;
@@ -26,6 +27,22 @@ export interface BroadcastMessage extends BroadcastMessageSummary {
attachment?: BroadcastAttachment;
}
export interface BroadcastEvidence {
paragraphIndex: number;
quote: string;
}
export interface BroadcastPerspective {
code: string;
label: string;
summary?: string;
concerns: string[];
impacts: string[];
actions: string[];
risks: string[];
evidence: BroadcastEvidence[];
}
export interface BroadcastAttachment {
id: number;
fileName: string;
@@ -34,6 +51,10 @@ export interface BroadcastAttachment {
status: 'READY';
summary?: string;
downloadUrl: string;
insightStatus: BroadcastInsightStatus;
defaultPerspectiveCode?: string;
perspectiveLabels: string[];
perspectives: BroadcastPerspective[];
}
export interface BroadcastMessagePage {
@@ -59,12 +80,23 @@ export const listBroadcastMessages = (pageNum = 1, pageSize = 20, scope: Broadca
timeout: 15000
});
export const getBroadcastMessage = (id: number) =>
apiRequest<BroadcastMessage>({
const normalizeBroadcastAttachment = (attachment: BroadcastAttachment): BroadcastAttachment => ({
...attachment,
insightStatus: attachment.insightStatus || 'NOT_PROCESSED',
perspectiveLabels: Array.isArray(attachment.perspectiveLabels) ? attachment.perspectiveLabels : [],
perspectives: Array.isArray(attachment.perspectives) ? attachment.perspectives : []
});
export const getBroadcastMessage = async (id: number) => {
const message = await apiRequest<BroadcastMessage>({
url: `/api/aihr/broadcast/messages/${id}`,
method: 'GET',
timeout: 15000
});
return message.attachment
? { ...message, attachment: normalizeBroadcastAttachment(message.attachment) }
: message;
};
export const markBroadcastMessageRead = (id: number) =>
apiRequest<void>({