A full-featured AI chat application built with C# .NET 8 and the Groq API. Features a modern dark-themed Windows Forms UI, persistent conversation history, and support for multiple AI models including Qwen, Llama 3, Mixtral, and more.
- Modern dark UI β sleek navy/charcoal theme with blue accent colors
- Chat bubbles β rounded message bubbles (blue for user, dark gray for AI)
- Typing indicator β animated dots while waiting for AI response
- Sidebar β quick access to new chats and conversation history
- Settings dialog β configure API key and model without restarting
- Auto-resize input β input box grows as you type
- Persistent history β conversations saved to
%AppData%\AiMemoryWinForms\ - Keyboard shortcuts β
Enterto send,Shift+Enterfor new line
- Color-coded output β cyan for user, green for AI, red for errors
- Lightweight β runs in any terminal
- Same core engine β shared library with the WinForms app
- Persistent memory β conversation history saved to JSON
- Secure by default β API key via environment variable (never hardcoded)
- Multi-model support β switch between Groq models at runtime
- Rate limit handling β automatic retry with user feedback
- Error resilience β graceful handling of network/API errors
- .NET 8 SDK
- Groq API key (free tier available)
git clone https://github.com/Mariomedhat899/AiMemory.git
cd AiMemory
dotnet buildWindows PowerShell (permanent, user-level):
[Environment]::SetEnvironmentVariable("GROQ_API_KEY", "gsk_YOUR_KEY_HERE", "User")
β οΈ Restart your terminal/IDE after setting.
Linux / macOS (add to ~/.bashrc or ~/.zshrc):
export GROQ_API_KEY="gsk_YOUR_KEY_HERE"Temporary (current session only):
# PowerShell
$env:GROQ_API_KEY = "gsk_YOUR_KEY_HERE"
# Linux/macOS
export GROQ_API_KEY="gsk_YOUR_KEY_HERE"dotnet run --project AiMemoryWinFormsdotnet run --project MemoryManagmentWhen prompted (console) or in Settings (WinForms), pick a model:
| Model | Speed | Best For |
|---|---|---|
llama-3.1-8b-instant |
β‘β‘β‘ | Fast chat, testing |
qwen/qwen3-32b |
β‘ | Multilingual, coding |
llama-3.3-70b-versatile |
β‘ | Complex reasoning |
mixtral-8x7b-32768 |
β‘β‘ | Long context (32K) |
gemma2-9b-it |
β‘β‘ | Lightweight tasks |
Full model list: Groq Console
- Launch the app
- Click β Settings β enter your Groq API key
- Type a message and press Enter or click Send
- Click π Clear to wipe the current conversation
- Click β New Chat to start fresh
--- Using qwen/qwen3-32b on Groq | Type '/exit' to quit | '/clear' to reset ---
You: Hello! What can you do?
AI: Hello! I can help with coding, writing, analysis, and more...
You: /clear
--- System: Memory wiped. ---
You: /exit
π Goodbye!
| Command | Action |
|---|---|
/exit |
Quit the application |
/clear |
Wipe conversation memory |
AiMemory/
βββ AiMemoryManagment/ # Shared class library (.NET 8)
β βββ Classes/
β β βββ Message.cs # Message model for JSON serialization
β β βββ ChatRequest.cs # Chat request model
β βββ AiMemoryManagment.csproj
β
βββ MemoryManagment/ # Console app (.NET 8)
β βββ Program.cs # Console chat loop & API logic
β βββ MemoryManagment.csproj
β
βββ AiMemoryWinForms/ # Windows Forms app (.NET 8)
β βββ MainForm.cs # Full chat UI with dark theme
β βββ Program.cs # Application entry point
β βββ AiMemoryWinForms.csproj
β
βββ AiMemoryManagment.slnx # Solution file
βββ .gitignore # Excludes secrets, build artifacts, etc.
βββ README.md # This file
βββββββββββββββββββββββ βββββββββββββββββββββββ
β MemoryManagment β β AiMemoryWinForms β
β (Console App) β β (Windows Forms) β
ββββββββββ¬βββββββββββββ ββββββββββ¬ββββββββββββββ
β β
βββββββββββββ¬ββββββββββββββββ
β
βββββββββββββΌββββββββββββββββ
β AiMemoryManagment β
β (Shared Library) β
β β’ Message.cs β
β β’ ChatRequest.cs β
βββββββββββββ¬ββββββββββββββββ
β
βββββββββββββΌββββββββββββββββ
β Groq API β
β api.groq.com β
βββββββββββββββββββββββββββββ
- β
API key is read from environment variable (
GROQ_API_KEY) β never hardcoded - β
chat_history.jsonis stored in%AppData%(not in the repo) - β
.gitignoreexcludes build artifacts, secrets, and local files - β Never commit your API key or real conversation logs
- π Regenerate keys if accidentally exposed
Just type the model ID when prompted β no code changes needed! The app supports any model available on Groq.
Console app β edit historyPath in MemoryManagment/Program.cs:
string historyPath = "chat_history.json";WinForms app β history is saved to:
%AppData%\AiMemoryWinForms\chat_history.json
Groq supports streaming responses. Both apps can be extended to use stream: true in the request body. See Groq API Docs.
dotnet builddotnet test- Fork the repository
- Create a feature branch:
git checkout -b feat/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feat/amazing-feature - Open a Pull Request
This project is licensed under the MIT License.