File size: 1,115 Bytes
2accaeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { Chat } from "@google/genai";

export type MessageSender = 'user' | 'model';

export interface UploadedFile {
  name: string;
  type: string; // MIME type
  size: number;
  dataUrl?: string; // For image previews (base64) or to send to Gemini
  // rawFile?: File; // Transient, for processing, not for storage ideally
}

export interface ChatMessage {
  id: string;
  text: string;
  sender: MessageSender;
  timestamp: number;
  isStreaming?: boolean;
  error?: string;
  groundingChunks?: GroundingChunk[];
  file?: UploadedFile; // To store info about an attached file
}

export interface ChatSession {
  id: string;
  name: string;
  messages: ChatMessage[];
  createdAt: number;
  // geminiChatInstance is transient, not stored in localStorage directly
}

// Structure for grounding metadata from Gemini API
export interface GroundingChunkWeb {
  uri: string;
  title: string;
}
export interface GroundingChunk {
  web: GroundingChunkWeb;
}

// Keep this minimal, actual API Key is from process.env
export interface GeminiServiceConfig {
  apiKey?: string; // Optional here as it's primarily from env
}