Chat Module¶
Overview¶
The Chat module handles conversational interactions between users and the BidScript AI assistant, providing API endpoints for processing queries and generating AI-powered responses.
Module Structure¶
chat/
├── chat.module.ts # Module definition and dependency configuration
├── chat.controller.ts # API endpoint for chat interactions
├── chat.service.ts # Core chat processing logic
├── chat-context.service.ts # Document context processing service
└── chat.dto.ts # Data Transfer Objects for chat operations
Key Components¶
ChatModule¶
The root module that configures dependencies and providers:
- Imports: AzureModule, VectorstoreModule, LangchainModule
- Controllers: ChatController
- Providers: ChatService, ConversationService, ChatContextService
- Exports: ChatContextService
ChatService¶
Handles processing chat messages: - Integrates with vector storage for semantic search - Manages conversation history - Generates LLM responses - Handles errors and retries
ChatContextService¶
Processes document context for chat interactions to enhance AI responses.
ChatController¶
Exposes REST API endpoints for chat interactions.
DTO Objects¶
- CreateChatDto: Structure for chat request (userID, query, conversationUUID, documents)
- ChatResponse: Structure for chat response (response, timestamp, metadata, error)
Dependencies¶
The Chat module depends on: - AzureModule: For AI services - VectorstoreModule: For semantic search - LangchainModule: For LLM integration - ConversationService: For history management