dengun_ai-admin-client
Version:
Cliente simples para integração com o AI Admin Dashboard - Plug and Play
57 lines (56 loc) • 1.34 kB
TypeScript
export interface ClientConfig {
dashboardUrl: string;
botId: string;
botSecret: string;
options?: {
autoReportUsage?: boolean;
autoReportErrors?: boolean;
reportInterval?: number;
maxRetries?: number;
timeout?: number;
debug?: boolean;
};
}
export interface UserSession {
userId: string;
tenantId: string;
sessionId: string;
permissions?: string[];
metadata?: Record<string, any>;
}
export interface BotUsage {
sessionId: string;
userId: string;
tenantId: string;
action: string;
tokensUsed: number;
timestamp: number;
metadata?: Record<string, any>;
}
export interface ErrorReport {
sessionId?: string;
userId?: string;
tenantId?: string;
error: string;
errorCode?: string;
stack?: string;
context?: Record<string, any>;
timestamp: number;
}
export interface DashboardResponse<T = any> {
success: boolean;
data?: T;
error?: string;
message?: string;
}
export interface ConnectionStatus {
connected: boolean;
authenticated: boolean;
lastPing: number;
error?: string;
}
export interface TelemetryEvent {
type: 'usage' | 'error' | 'connection' | 'custom';
data: BotUsage | ErrorReport | ConnectionStatus | Record<string, any>;
timestamp: number;
}