feat: AI chat now more accurate, has access to data from user, and can generate graphs, charts etc

This commit is contained in:
Jakob Wennberg
2026-02-27 08:48:28 +01:00
parent 0c422fcd25
commit 547fd053ec
24 changed files with 1954 additions and 51 deletions
+41 -1
View File
@@ -7,6 +7,7 @@ export interface ChatMessage {
role: 'user' | 'assistant'
content: string
sources: SourceReference[]
artifact?: ArtifactSpec | null
created_at: string
}
@@ -48,8 +49,47 @@ export interface ChatResponse {
}
export interface StreamChunk {
type: 'content' | 'sources' | 'done' | 'error'
type: 'content' | 'sources' | 'done' | 'error' | 'tool_start' | 'artifact'
content?: string
sources?: SourceReference[]
error?: string
toolName?: string
artifact?: ArtifactSpec
}
// ── Artifact Types ──────────────────────────────────────────────
export type ArtifactSpec =
| ChartArtifact
| TableArtifact
| KpiCardsArtifact
| AgingBucketsArtifact
export interface ChartArtifact {
type: 'bar_chart' | 'line_chart' | 'pie_chart' | 'stacked_bar'
title: string
data: { label: string; value: number; color?: string }[]
unit?: string
subtitle?: string
}
export interface TableArtifact {
type: 'table'
title: string
columns: { key: string; label: string; align?: 'left' | 'right' }[]
rows: Record<string, string | number>[]
summary_row?: Record<string, string | number>
}
export interface KpiCardsArtifact {
type: 'kpi_cards'
title?: string
cards: { label: string; value: string; trend?: 'up' | 'down' | 'flat'; change?: string }[]
}
export interface AgingBucketsArtifact {
type: 'aging_buckets'
title: string
buckets: { label: string; amount: number; count: number }[]
total: number
}