mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-12-14 15:48:15 +00:00
103 lines
1.6 KiB
TypeScript
103 lines
1.6 KiB
TypeScript
import { ToolCall } from './models/types';
|
|
|
|
export type SystemMessage = {
|
|
role: 'system';
|
|
content: string;
|
|
};
|
|
|
|
export type AssistantMessage = {
|
|
role: 'assistant';
|
|
content: string;
|
|
tool_calls?: ToolCall[];
|
|
};
|
|
|
|
export type UserMessage = {
|
|
role: 'user';
|
|
content: string;
|
|
};
|
|
|
|
export type ToolMessage = {
|
|
role: 'tool';
|
|
id: string;
|
|
name: string;
|
|
content: string;
|
|
};
|
|
|
|
export type ChatTurnMessage = UserMessage | AssistantMessage;
|
|
|
|
export type Message =
|
|
| UserMessage
|
|
| AssistantMessage
|
|
| SystemMessage
|
|
| ToolMessage;
|
|
|
|
export type Chunk = {
|
|
content: string;
|
|
metadata: Record<string, any>;
|
|
};
|
|
|
|
export type TextBlock = {
|
|
id: string;
|
|
type: 'text';
|
|
data: string;
|
|
};
|
|
|
|
export type SourceBlock = {
|
|
id: string;
|
|
type: 'source';
|
|
data: Chunk[];
|
|
};
|
|
|
|
export type SuggestionBlock = {
|
|
id: string;
|
|
type: 'suggestion';
|
|
data: string[];
|
|
};
|
|
|
|
export type WidgetBlock = {
|
|
id: string;
|
|
type: 'widget';
|
|
data: {
|
|
widgetType: string;
|
|
params: Record<string, any>;
|
|
};
|
|
};
|
|
|
|
export type ReasoningResearchBlock = {
|
|
id: string;
|
|
type: 'reasoning';
|
|
reasoning: string;
|
|
};
|
|
|
|
export type SearchingResearchBlock = {
|
|
id: string;
|
|
type: 'searching';
|
|
searching: string[];
|
|
};
|
|
|
|
export type ReadingResearchBlock = {
|
|
id: string;
|
|
type: 'reading';
|
|
reading: Chunk[];
|
|
};
|
|
|
|
export type ResearchBlockSubStep =
|
|
| ReasoningResearchBlock
|
|
| SearchingResearchBlock
|
|
| ReadingResearchBlock;
|
|
|
|
export type ResearchBlock = {
|
|
id: string;
|
|
type: 'research';
|
|
data: {
|
|
subSteps: ResearchBlockSubStep[];
|
|
};
|
|
};
|
|
|
|
export type Block =
|
|
| TextBlock
|
|
| SourceBlock
|
|
| SuggestionBlock
|
|
| WidgetBlock
|
|
| ResearchBlock;
|