UNPKG

@aptos-labs/ai-chatbot-client

Version:

Aptos AI Developer Assistant - A React-based chatbot interface for the Aptos Developer Assistant API

100 lines (87 loc) 1.89 kB
export enum RagProvider { DEVELOPER_DOCS = 'developer-docs', APTOS_LEARN = 'aptos-learn', } export interface Message { id: string; content: string; role: 'user' | 'assistant'; timestamp: string; feedback?: 'positive' | 'negative'; } export interface Chat { id: string | null; title: string; timestamp: string; lastMessage?: string; messages: Message[]; metadata?: { client_id: string; rag_provider?: RagProvider; [key: string]: any; }; } export interface ChatbotConfig { apiKey?: string; apiUrl: string; clientId?: string; ragProvider?: RagProvider; githubRepo?: string; fastMode?: boolean; onRateLimitExceeded?: () => void; } // API request types export interface ChatMessageRequest { content: string; client_id: string; message_id?: string; chat_id?: string; shared_chat_id?: string; // For auto-forking shared chats role?: 'user' | 'assistant'; rag_provider?: RagProvider; temperature?: number; } // API response types export interface ChatHistoriesResponse { histories: Chat[]; totalCount: number; } export interface StatusResponse { success: boolean; message: string; } export type SendMessageOptions = { signal?: AbortSignal; onProgress?: (content: string) => void; messageId?: string; }; export interface ChatResponse { message: Message; isComplete: boolean; } export interface ChatHistory { messages: Message[]; hasMore: boolean; } // Shared chat types export interface SharedChat { share_id: string; title: string; messages: Message[]; created_at: string; expires_at?: string; metadata?: { rag_provider?: RagProvider; [key: string]: any; }; } export interface ShareChatRequest { client_id: string; title?: string; expires_in_hours?: number; } export interface ShareChatResponse { share_id: string; share_url: string; expires_at?: string; }