MelesAI is a robust, scalable, and secure AI conversation platform engineered with Clean Architecture principles. It bridges the gap between complex LLM interactions and user-friendly web interfaces, offering features like real-time streaming, dynamic context management, and provider-agnostic AI integration.
- Clean Architecture: Strictly decoupled layers (Core, Data, Service, API, Web) ensuring maintainability, testability, and separation of concerns.
- Async & Resilience: Built from the ground up with asynchronous patterns and retry policies to handle API failures gracefully.
- Data Isolation: Multi-tenant design where every user's data is strictly isolated, ensuring privacy and security.
- Rate Limiting: Intelligent throttling mechanisms to prevent abuse and manage API quotas effectively.
- Multi-Conversation Support: Users can manage concurrent chat sessions with distinct contexts and histories.
- Provider Abstraction: flexible backend that supports swapping AI providers (e.g., Groq, Ollama/Local AI, OpenAI) without code changes.
- Streaming (Typewriter Effect): Real-time, token-by-token response streaming using Server-Sent Events (SSE) for a responsive UX.
- Streaming Cancel & Resume: Full control for users to interrupt generation and resume or regenerate as needed.
- Conversation State Machine: sophisticated state management to handle complex dialogue flows and transitions reliably.
- Memory Scope (Persona/Profile): Dynamic system prompts that adapt to the user's occupation, interests, and tone preferences.
- Context Window Optimization: Automated summarization and quiz generation to keep the context window efficient without losing critical history.
- Memory Opt-in / Opt-out: Granular user control over what data the AI retains for future interactions.
- Cost Awareness: Built-in token usage tracking and cost estimation logic to monitor AI resource consumption.
- Auth + Session Management: Secure authentication via ASP.NET Core Identity with persistent session handling.
- Prompt Injection Protection: Advanced sanitization layers to detect and neutralize malicious prompt engineering attacks.
- AI Request Tracing: Comprehensive logging of the request/response lifecycle for debugging and performance monitoring.
- Data Privacy: Strict adherence to data isolation protocols.
- Syntax Highlighting (Markdown): Rich text rendering with
highlight.jssupport for code blocks in multiple languages. - Tool Registry: A centralized registry for defining and managing AI-callable functions (Tools).
- Deterministic Tool Execution: Ensures tools invoked by the AI produce predictable and reliable outputs.
- Unit Testing: Extensive test coverage for core business logic and services.
- Documentation: Comprehensive
READMEand design documents located in the/docsdirectory. - Project Management: Trackable progress via GitHub Issues and Milestones.
The project follows a strict N-Layered Architecture:
- MelesAI.Core: Contains the domain entities, DTOs, and abstract interfaces. It has no dependencies.
- MelesAI.Data: Implements the database context (EF Core), migrations, and repositories.
- MelesAI.Service: Contains the business logic, AI provider implementations (Groq/Ollama), and AutoMapper profiles.
- MelesAI.API: Exposes RESTful endpoints and handles JWT authentication and SSE streaming.
- MelesAI.Web: A modern MVC frontend using Bootstrap 5 and vanilla JavaScript for interactivity.
| Category | Technology |
|---|---|
| Framework | .NET 8, ASP.NET Core |
| Database | MS SQL Server (Entity Framework Core) |
| AI Providers | Groq (Llama 3.3), Ollama (Local Models) |
| Frontend | MVC, Bootstrap 5, JavaScript (ES6+) |
| Libraries | Marked.js, Highlight.js, jsPDF, AutoMapper |
| Security | ASP.NET Core Identity, JWT, User Secrets |
- .NET 8 SDK
- SQL Server (LocalDB or Docker)
- Groq API Key (optional, for cloud inference)
-
Clone the repository
git clone [https://github.com/yourusername/MelesAI.git](https://github.com/enesimo16/MelesAI.git) cd MelesAI -
Configure User Secrets (Securely) Avoid hardcoding keys. Use the .NET Secret Manager:
cd MelesAI.API dotnet user-secrets init dotnet user-secrets set "Groq:ApiKey" "YOUR_GROQ_API_KEY"
3 Configure Database (LocalDB)
The project is pre-configured to use SQL Server LocalDB for development. Ensure your appsettings.Development.json (in MelesAI.API) or User Secrets contains the correct connection string:
```json
"ConnectionStrings": {
"SqlServer": "Server=(localdb)\\mssqllocaldb;Database=MelesAIDb;Trusted_Connection=True;MultipleActiveResultSets=true"
}
```
-
Database Migration Apply the schema to your local database:
dotnet ef database update --project ../MelesAI.Data
-
Run the Application Set multiple startup projects (API + Web) in Visual Studio, or run them via terminal:
# Terminal 1 dotnet run --project MelesAI.API # Terminal 2 dotnet run --project MelesAI.Web
- A streamlined central hub designed to manage your AI interactions, providing quick access to recent activities and the ability to initiate new conversations instantly.
- An advanced chat interface featuring real-time response streaming, conversation organization tools like pinning and archiving, and an integrated system for context-aware note-taking.
- A dedicated settings area where you define your professional identity and interests, enabling the AI to dynamically tailor its persona and responses to your specific needs.
Contributions are welcome! We follow a structured workflow:
- Check the Issues tab for open tasks.
- Fork the project and create a feature branch.
- Ensure all Unit Tests pass.
- Submit a Pull Request detailed with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.
*Built with by Enes Yel