File size: 916 Bytes
0c4cf03
 
 
 
 
e943a05
 
0c4cf03
 
 
 
ebac87f
 
 
0c4cf03
 
e943a05
 
 
 
4606755
e943a05
0c4cf03
ebac87f
 
 
 
4606755
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c22da3
4606755
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
import type { ObjectId } from "mongodb";
import type { Conversation } from "./Conversation";
import type { Timestamps } from "./Timestamps";

export interface WebSearch extends Timestamps {
	_id?: ObjectId;
	convId?: Conversation["_id"];

	prompt: string;

	searchQuery: string;
	results: WebSearchSource[];
	context: string;
	contextSources: WebSearchSource[];
}

export interface WebSearchSource {
	title: string;
	link: string;
	hostname: string;
	text?: string; // You.com provides text of webpage right away
}

export type WebSearchMessageSources = {
	type: "sources";
	sources: WebSearchSource[];
};

export interface YouWebSearch {
	hits: YouSearchHit[];
	latency: number;
}

interface YouSearchHit {
	url: string;
	title: string;
	description: string;
	snippets: string[];
}

// eslint-disable-next-line no-shadow
export enum WebSearchProvider {
	GOOGLE = "Google",
	YOU = "You.com",
	SEARXNG = "SearXNG",
}