@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
255 lines (236 loc) • 5.66 kB
text/typescript
/**
* @fileoverview Comprehensive type definitions for the RAG chatbot system
* @module types
*
* This module provides centralized type definitions used across the
* entire RAG chatbot system, including core types, component props,
* API responses, hooks, and events.
*/
// Re-export core types from the context
export type {
ChatbotContextType,
ChatbotConfig,
ChatbotError,
VectorStoreConfig,
LLMConfig,
StorageConfig,
Document,
Conversation,
ConversationMessage,
VectorStoreState,
LLMState,
StorageState,
ChatbotContextState,
} from "../core/contexts/ChatbotContext";
export {
ChatbotStatus,
VectorStoreType,
LLMProvider,
} from "../core/contexts/ChatbotContext";
// API-related types
export * from "./api";
export type {
ApiResponse,
PaginatedResponse,
UploadProgress,
SearchMetadata,
ProcessingStatus,
VectorStoreHealth,
LLMHealth,
StorageHealth,
SystemHealth,
} from "./api";
// Component props types
export * from "./components";
export type {
BaseChatbotProps,
ChatbotProviderProps,
ChatWidgetProps,
FloatingChatButtonProps,
KnowledgeManagementProps,
DocumentUploaderProps,
RAGManagerProps,
SuggestedQuestionsProps,
ThemeProps,
I18nProps,
} from "./components";
// Hook types
export * from "./hooks";
export type {
UseChatbotReturn,
UseChatbotOptions,
UseDocumentsReturn,
UseDocumentsOptions,
UseConversationsReturn,
UseMessagesReturn,
UseThemeReturn,
UseI18nReturn,
UseSearchReturn,
UseUploadReturn,
} from "./hooks";
// Event types
export * from "./events";
export type {
BaseEvent,
ChatbotEvent,
EventListener,
EventEmitter,
ChatbotInitializedEvent,
ConversationStartedEvent,
MessageSentEvent,
DocumentUploadCompletedEvent,
SystemHealthCheckEvent,
} from "./events";
// Import ChatbotError type for use in interface
import type { ChatbotError } from "../core/contexts/ChatbotContext";
/**
* Common interface for chatbot component props
* @deprecated Use BaseChatbotProps instead
*/
export interface ChatbotComponentProps {
/** CSS class name for styling */
className?: string;
/** Whether the component is disabled */
disabled?: boolean;
/** Optional callback when errors occur */
onError?: (error: ChatbotError) => void;
}
/**
* Configuration for theme customization
* @deprecated Use ThemeProps instead
*/
export interface ThemeConfig {
/** Primary color scheme */
primary: string;
/** Secondary color scheme */
secondary: string;
/** Background colors */
background: {
primary: string;
secondary: string;
};
/** Text colors */
text: {
primary: string;
secondary: string;
muted: string;
};
/** Border radius values */
borderRadius: {
small: string;
medium: string;
large: string;
};
}
/**
* Internationalization support
* @deprecated Use I18nProps instead
*/
export interface I18nConfig {
/** Current language code */
language: string;
/** Available language codes */
supportedLanguages: string[];
/** Translation function */
t: (key: string, params?: Record<string, any>) => string;
}
/**
* Generic callback function type
*/
export type CallbackFunction<T = void> = (...args: any[]) => T;
/**
* Generic async callback function type
*/
export type AsyncCallbackFunction<T = void> = (...args: any[]) => Promise<T>;
/**
* Configuration options for initializing the chatbot system
*/
export interface InitializationOptions {
/** Whether to skip vector store initialization */
skipVectorStore?: boolean;
/** Whether to skip LLM initialization */
skipLLM?: boolean;
/** Whether to skip storage initialization */
skipStorage?: boolean;
/** Custom timeout for initialization in milliseconds */
timeout?: number;
/** Whether to retry failed connections */
retryOnFailure?: boolean;
/** Number of retry attempts */
maxRetries?: number;
}
/**
* File upload constraints
*/
export interface FileUploadConstraints {
/** Maximum file size in bytes */
maxSize: number;
/** Minimum file size in bytes */
minSize?: number;
/** Allowed file types (MIME types) */
allowedTypes: string[];
/** Maximum number of files in a single upload */
maxFiles?: number;
/** Whether to allow duplicate files */
allowDuplicates?: boolean;
}
/**
* Search configuration options
*/
export interface SearchOptions {
/** Search method to use */
method?: "vector" | "keyword" | "hybrid";
/** Maximum number of results */
limit?: number;
/** Minimum similarity score (0-1) */
minScore?: number;
/** Additional filters */
filters?: Record<string, any>;
/** Whether to include document content in results */
includeContent?: boolean;
/** Whether to include metadata in results */
includeMetadata?: boolean;
}
/**
* Pagination configuration
*/
export interface PaginationConfig {
/** Current page number (1-based) */
page: number;
/** Number of items per page */
limit: number;
/** Total number of items */
total?: number;
/** Whether there are more pages */
hasMore?: boolean;
}
/**
* Sort configuration
*/
export interface SortConfig {
/** Field to sort by */
field: string;
/** Sort direction */
direction: "asc" | "desc";
}
/**
* Filter configuration for document queries
*/
export interface FilterConfig {
/** Filter by document type */
type?: string[];
/** Filter by creation date range */
dateRange?: {
start?: Date;
end?: Date;
};
/** Filter by file size range */
sizeRange?: {
min?: number;
max?: number;
};
/** Filter by metadata fields */
metadata?: Record<string, any>;
/** Filter by tags */
tags?: string[];
}