@digitalsingularity/agent-ui-chat-components
Version:
Reusable UI components for agent chat and management interfaces
59 lines (58 loc) • 2 kB
TypeScript
import { AgentContext } from './ai-agent';
export interface AgentService {
sendMessage(message: string, context: AgentContext, agentId: string, onChunk: (chunk: string) => void, onError: (error: any) => void, onCompletion: () => void): Promise<void>;
getAgents(): Promise<AiAgent[]>;
getAgent(id: string): Promise<AiAgent>;
createAgent(agent: Omit<AiAgent, 'id' | 'userId' | 'createdAt' | 'updatedAt'>): Promise<AiAgent>;
updateAgent(id: string, agent: Partial<AiAgent>): Promise<AiAgent>;
deleteAgent(id: string): Promise<void>;
}
export interface UIComponents {
Button: React.ComponentType<any>;
Input: React.ComponentType<any>;
Textarea: React.ComponentType<any>;
Avatar: React.ComponentType<any>;
AvatarImage: React.ComponentType<any>;
AvatarFallback: React.ComponentType<any>;
Dialog: React.ComponentType<any>;
DialogContent: React.ComponentType<any>;
DialogHeader: React.ComponentType<any>;
DialogTitle: React.ComponentType<any>;
DialogDescription: React.ComponentType<any>;
ScrollArea: React.ComponentType<any>;
}
export interface AuthProvider {
getToken(): Promise<string | null>;
getCurrentUser(): Promise<any>;
}
export interface ToastOptions {
title?: string;
description?: string;
variant?: 'default' | 'destructive';
}
export interface ToastProvider {
toast(options: ToastOptions): void;
}
export interface AgentLibraryConfig {
agentService: AgentService;
uiComponents: UIComponents;
authProvider?: AuthProvider;
toastProvider?: ToastProvider;
}
export interface AiAgent {
id: string;
userId: string;
name: string;
description: string | null;
systemInstruction: string;
temperature: number;
model: string;
personalityTags: string[];
avatarType?: 'none' | 'generated' | 'uploaded';
avatarUrl?: string | null;
avatarPrompt?: string | null;
isPublic?: boolean;
isOwner?: boolean;
createdAt: string;
updatedAt: string;
}