/ src / server / storage / chat / types.ts
types.ts
 1  import type {
 2    ChatMessage,
 3    MemoryItem,
 4    UploadKind,
 5  } from '@/lib/shared/chat'
 6  
 7  export interface SessionRow {
 8    id: string
 9    created_at: string
10    updated_at: string
11    compacted_summary: string
12    chat_model_id_override: string | null
13    thinking_level: string | null
14    reasoning_level: string | null
15    used_capabilities_json: string
16  }
17  
18  export interface MessageRow {
19    id: string
20    session_id: string
21    role: ChatMessage['role']
22    text: string
23    attachments_json: string
24    created_at: string
25  }
26  
27  export interface MemoryRow {
28    id: string
29    session_id: string
30    memory_key: string
31    value: string
32    category: MemoryItem['category']
33    confidence: number
34    created_at: string
35    updated_at: string
36  }
37  
38  export interface MemoryEmbeddingRow {
39    memory_id: string
40    session_id: string
41    provider: string
42    model: string | null
43    dimensions: number
44    vector_json: string
45    created_at: string
46    updated_at: string
47  }
48  
49  export interface UploadRow {
50    id: string
51    session_id: string
52    kind: UploadKind
53    file_name: string
54    mime_type: string
55    size: number
56    disk_path: string
57    created_at: string
58  }
59  
60  export interface SessionListRow {
61    id: string
62    created_at: string
63    updated_at: string
64    compacted_summary: string
65    chat_model_id_override: string | null
66    thinking_level: string | null
67    reasoning_level: string | null
68    message_count: number
69    last_message_text: string | null
70    last_message_role: ChatMessage['role'] | null
71  }
72  
73  export interface SessionListItem {
74    id: string
75    createdAt: string
76    updatedAt: string
77    compactedSummary: string
78    chatModelOverride: string | null
79    thinkingLevel: string | null
80    reasoningLevel: string | null
81    messageCount: number
82    lastMessageText: string | null
83    lastMessageRole: ChatMessage['role'] | null
84  }
85  
86  export interface StoredMemoryEmbedding {
87    memoryId: string
88    sessionId: string
89    provider: string
90    model: string | null
91    dimensions: number
92    vector: number[]
93    createdAt: string
94    updatedAt: string
95  }