chat-ui / src /lib /types /WebSearch.ts
Mishig
[Websearch] change context schema (#944)
2e2f16c unverified
raw history blame
No virus
1.01 kB
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[];
contextSources: WebSearchUsedSource[];
}
export interface WebSearchSource {
title: string;
link: string;
hostname: string;
text?: string; // You.com provides text of webpage right away
}
export interface WebSearchUsedSource extends WebSearchSource {
context: { idx: number; text: string }[];
}
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",
}