How ln0330/ai-chat-demo works
Project type and purpose
• This is a full-stack desktop + web solution (“AI-Chat-Demo”) built in C#.
• Purpose: A WPF client that communicates via REST to an ASP.NET Core Web API which powers an AI Q&A interface using a local Llama model and persists chat history in MySQL.
File structure
• Top-level solution: WpfAIGreeting.sln
• Two main projects/directories:
• GreetingAPI – ASP.NET Core REST API
· Controllers (GreetingController.cs)
· Models (AskAIRequest, HistoryItem)
· Program.cs, appsettings.json (incl. MySQL connection), launch settings
· .http test file for endpoints
• WpfClient – WPF desktop application
· App.xaml / MainWindow.xaml (UI)
· Models (HistoryItem)
• Configuration and deployment artifacts (.config, .gitignore, .gitattributes)
Key insights from the README
• Frontend (WPF) and backend (ASP.NET Core) are separated.
• Uses MVC concept, RESTful API, MySQL datastore, local Llama AI model.
• Demo shows UI exchanging messages with API, which calls AI engine and logs history.
Main components and their interactions
a. Components:
1) WPF Client (Desktop UI)
2) ASP.NET Core Web API
– Presentation Layer (Controllers)
– Business Logic Layer (AI service integration)
– Data Access Layer (MySQL repository)
3) MySQL Database
4) Local Llama AI Engine (model inference)
5) External HTTP testing tool (.http file)
b. Relationships / Data flow:
• WPF Client → HTTP (REST) → GreetingAPI Controller
• Controller → invokes AI service → Llama Engine → returns answer
• Controller → writes/reads chat HistoryItem → MySQL DB
• API → HTTP response → WPF Client updates UI
c. Architectural patterns and principles:
• Separation of concerns: UI, API, AI logic, persistence
• MVC in API (Controllers + Models)
• RESTful communications
• Dependency Injection in ASP.NET Core
d. Key technologies:
• WPF (.NET desktop)
• ASP.NET Core Web API
• MySQL (Connector in appsettings.json)
• Local Llama model library (in Business Logic)
• Visual Studio 2022
Final advice
• Keep labels concise but descriptive.
• This level of detail captures the essential architecture without overcomplicating.