Spaces:
Running
Running
File size: 3,212 Bytes
37b5223 42a0d15 37b5223 | 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | // Ukweli — shared types
// --- API Response Types ---
export interface Report {
report_id: string
title: string
slug: string
source_url: string
pdf_url: string | null
pdf_filename: string | null
report_type: string
fiscal_year: string | null
audit_period: string | null
auditee: string | null
auditee_type: string
county_name: string | null
page_count: number | null
file_size_bytes: number | null
content_hash: string | null
audit_opinion: string | null
published_date: string | null
uploaded_date: string | null
crawled_at: string
status: string
s3_url: string | null
}
export interface Citation {
document_id: string
title: string
page: number
paragraph: number
url: string
excerpt: string
}
export interface QueryResponse {
answer: string
citations: Citation[]
retrieval_metadata: {
chunks_considered: number
latency_ms: number
graph_entities_used: string[]
}
confidence: 'high' | 'medium' | 'low' | 'insufficient_context'
suggested_followups: string[]
}
export interface ChatMessage {
id: string
role: 'user' | 'assistant' | 'system'
content: string
citations?: Citation[]
confidence?: string
timestamp: string
isStreaming?: boolean
}
export interface GraphNode {
id: string
label: string
type: 'auditee' | 'report' | 'finding' | 'legal' | 'amount'
properties: Record<string, any>
}
export interface GraphEdge {
source: string
target: string
type: string
properties: Record<string, any>
}
export interface GraphData {
nodes: GraphNode[]
edges: GraphEdge[]
}
export interface SearchFilters {
auditee?: string[]
fy?: string[]
report_type?: string[]
finding_type?: string[]
county?: string[]
}
export interface FeedbackPayload {
query_id: string
rating: number
correction?: string
suggested_citation?: string
}
export interface StreamEvent {
event: 'retrieval' | 'citation' | 'delta' | 'done' | 'error'
data: any
}
// --- Auth Types ---
export type AuthTier = 'public' | 'registered' | 'api' | 'enterprise'
export interface AuthUser {
id: string
email: string
tier: AuthTier
display_name: string | null
organization: string | null
created_at: string
}
export interface RateInfo {
tier: AuthTier
limit: number // -1 = unlimited
used: number
remaining: number
reset_at: string
soft_warning?: boolean
}
export interface RegisterResponse {
status: 'otp_sent'
message: string
expires_in_seconds: number
}
export interface TokenResponse {
access_token: string
token_type: 'bearer'
expires_in: number
user: AuthUser
rate_info: RateInfo
}
export interface MeResponse {
tier: AuthTier
user: AuthUser | null
rate_info: RateInfo
}
export interface ApiKeySummary {
id: string
key_id: string
name: string
description: string | null
tier: AuthTier
quota_per_day: number
requests_today: number
last_used_at: string | null
status: 'active' | 'revoked' | 'expired'
created_at: string
expires_at: string | null
}
export interface ApiKeyCreateResponse extends ApiKeySummary {
secret: string
message: string
}
export interface ApiKeyListResponse {
keys: ApiKeySummary[]
total: number
}
|