File size: 1,242 Bytes
e675bdb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 interface UploadResponse {
  document_id: string
  filename: string
  text_preview: string
  char_count: number
}

export interface BuildGraphResponse {
  document_id: string
  chunks: number
  triples: number
  nodes: number
  edges: number
  cycles: string[][]
  warnings: string[]
}

export interface CausalTriple {
  id: string
  cause: string
  relation: string
  effect: string
  theme: string
  evidence: string
  confidence: number
  source_chunk_id: string
}

export interface GraphNode {
  id: string
  label: string
  type: string
  theme: string
}

export interface GraphEdge {
  id: string
  source: string
  target: string
  label: string
  confidence: number
  evidence: string
  theme: string
}

export interface GraphData {
  nodes: GraphNode[]
  edges: GraphEdge[]
}

export interface ChainEdge {
  cause: string
  relation: string
  effect: string
  confidence: number
  evidence: string
}

export interface CausalChain {
  score: number
  direction: string
  path: string[]
  edges: ChainEdge[]
}

export interface ChatResponse {
  answer: string
  chains: CausalChain[]
}

export interface AppSettings {
  openaiModel: string
  maxDepth: number
  topKChains: number
  confidenceThreshold: number
  theme: string
}