How 0xroco/ludereai works
Main Components
• Frontend Client (LudereAI.WPF): A WPF desktop application that provides the interactive chat interface, game state visualization, voice synthesis feedback, and user interactions.
• Backend API (LudereAI.API): A .NET-based web API hosting various controllers (for Accounts, Assistant functionality, Authentication, Conversations, Health checks) that serve as the entry point for client requests.
• Application and Domain Layers:
• Application Layer (LudereAI.Application): Defines interfaces for services (authentication, accounts, conversations, messages, etc.) and factories used to abstract business logic.
• Domain Layer (LudereAI.Domain): Contains the core domain models, mappers, and business entities representing accounts, chats, messages, configuration, and feature flags.
• Infrastructure Layer (LudereAI.Infrastructure): Implements the interfaces defined in the Application Layer, including concrete services like AccountService, AuthService, ConversationsService, repositories accessing the MySQL database via DatabaseContext, and factories for accounts and chat clients. Note also the addition of middleware like CloudflareMiddleware and additional functionality like screenshot processing.
• Shared Components (LudereAI.Shared): Offers common data transfer objects (DTOs), enums, result classes, and other utilities that are used throughout the system.
• External Services Integration:
• Integration with the OpenAI API (or Gemini via OpenAI-compatible endpoints) for AI responses.
• Integration with ElevenLabs and/or Piper for voice synthesis.
• A MySQL database is used for conversation history, user preferences, and authentication.
Relationships and Data Flow
• The WPF client communicates with the backend API by consuming endpoints exposed through controllers.
• The API routes client requests to the appropriate application services.
• Application services act as an intermediary between the API’s controllers and the underlying infrastructure (repositories, external integrations).
• The Infrastructure layer handles direct interactions with:
• The MySQL database (via DatabaseContext and repositories),
• External APIs such as OpenAI for AI responses and ElevenLabs/Piper for text-to-speech.
• Shared components (DTOs, enums, etc.) are used across layers to standardize communication.
Incorporate Architectural Patterns & Design Principles
• Clear separation of concerns: Each project (API, Application, Domain, Infrastructure, Shared) and each folder (e.g., Controllers, Services, Repositories) represents a specific responsibility.
• Use of Factory and Repository patterns: Factories in Infrastructure and Repository interfaces in Application indicate a design focused on loose coupling and extensibility.
Technological Details
• Technologies and frameworks should be labeled:
• Backend: .NET 9 (C#)
• Frontend: WPF
• AI integration: OpenAI API (or Gemini)
• Voice Synthesis: ElevenLabs API or self-hosted Piper
• Storage: MySQL for persistent data
• That custom middleware (e.g., CloudflareMiddleware) and additional services (instruction loader, timestamp interceptor) support extended functionality.
Final Touches
• Keep it detailed enough so that the core architectural flows and integration points (such as screenshot analysis for computer vision and consequent textual/audio responses) are well-illustrated.
Happy diagramming!