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.