-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
78 lines (67 loc) · 1.59 KB
/
types.ts
File metadata and controls
78 lines (67 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
export enum MessageRole {
USER = 'user',
ASSISTANT = 'assistant',
}
export interface Message {
id: string;
role: MessageRole;
content: string;
timestamp: string;
}
export interface ChatSession {
id:string;
title: string;
messages: Message[];
createdAt: string;
analysis?: AnalysisResult | null;
}
export interface User {
id: string;
username: string;
email: string;
avatarUrl?: string;
}
export interface TextStats {
words: number;
characters: number;
sentences: number;
readingTime: number; // in minutes
}
// Types for Structured Document Analysis
export interface Flag {
id: string;
title: string;
clause: string;
explanation: string;
severity: 'Low' | 'Medium' | 'High';
suggestedRewrite: string;
}
export interface Risk {
area: string;
assessment: string;
score: number; // A score from 1 (low risk) to 10 (high risk)
}
export interface Insight {
id: string;
recommendation: string;
justification: string;
}
// This represents the structured data we expect from the AI's JSON output.
export interface AIAnalysisData {
plainLanguageSummary: string;
flags: Flag[];
riskAssessment: {
overallSummary: string;
risks: Risk[];
};
aiInsights: {
overallSummary: string;
recommendations: Insight[];
};
detectedDocType?: string;
}
// This is the full analysis object used in the app state, combining AI data with client-side processed info.
export interface AnalysisResult extends AIAnalysisData {
docType: string;
stats: TextStats;
}