File size: 1,355 Bytes
9cacba2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
/**
 * Represents a chat message with role and content
 */
export type ChatMessage = {
  /** Role of the message sender */
  role: "system" | "user" | "assistant";
  /** Content of the message */
  content: string;
};
/**
 * Represents a text search result tuple
 */
export type TextSearchResult = [title: string, snippet: string, url: string];
/**
 * Represents an image search result tuple
 */
export type ImageSearchResult = [
  title: string,
  url: string,
  thumbnailUrl: string,
  sourceUrl: string,
];

/**
 * Array of text search results
 */
export type TextSearchResults = TextSearchResult[];
/**
 * Array of image search results
 */
export type ImageSearchResults = ImageSearchResult[];

/**
 * Possible states for search operations
 */
export type SearchState = "idle" | "running" | "failed" | "completed";

/**
 * Combined search results containing both text and image results
 */
export type SearchResults = {
  /** Array of text search results */
  textResults: TextSearchResult[];
  /** Array of image search results */
  imageResults: ImageSearchResult[];
};

/**
 * Possible states for text generation operations
 */
export type TextGenerationState =
  | "idle"
  | "awaitingModelDownloadAllowance"
  | "loadingModel"
  | "awaitingSearchResults"
  | "preparingToGenerate"
  | "generating"
  | "interrupted"
  | "failed"
  | "completed";