Skip to content

Repository files navigation

AstraMindChat 🌌

A multi-agent AI chat application with a React frontend and FastAPI backend, supporting multiple LLM providers, custom agents, analytics, and prompt optimization tools.


📋 Table of Contents


Overview

AstraMindChat is a full-stack AI chat platform that lets users interact with specialized AI agents powered by Google Gemini or Groq (Llama 3). It features a live analytics dashboard, exportable chat history, prompt templates, a Prompt Reviewer panel, and a custom agent builder — all wrapped in a clean dark-mode UI.


✨ Features

Feature Description
🤖 Multi-Agent Chat 6 built-in AI agents, each with a specialized system prompt
🧠 Dual LLM Providers Switch between Google Gemini and Groq (Llama 3)
🔍 Prompt Reviewer Real-time AI-powered prompt quality analysis via Groq
✍️ Prompt Generator Rewrites your rough input into an optimized prompt
📊 Analytics Dashboard Tracks total prompts, agent usage, provider usage, and mode breakdowns
📁 Chat Export Download conversation history as JSON or TXT
📝 Prompt Templates Pre-built templates to speed up common queries
🛠️ Custom Agent Builder Create, save, and delete your own agents with custom system prompts
🌙 Dark / Light Mode Persistent theme toggle
💾 Persistent Storage Chat history and analytics saved to a SQLite database via FastAPI

🛠️ Tech Stack

Frontend

  • React 19 with Vite
  • Lucide React for icons
  • Vanilla CSS (custom design system with CSS variables)
  • localStorage for client-side persistence (theme, API keys, analytics)

Backend

  • FastAPI — REST API server
  • SQLModel — ORM on top of SQLAlchemy
  • SQLite — Embedded database (astramind.db)
  • Pydantic — Request/response validation

AI / LLM

  • Google Gemini API (default provider)
  • Groq API — Llama 3, used for the Prompt Reviewer panel

📁 Project Structure

internship-eval-proj/
├── backend/
│   └── venv/
│       └── main.py          # FastAPI app — all routes and DB models
│
└── frontend/
    ├── index.html
    ├── vite.config.js
    ├── package.json
    └── src/
        ├── App.jsx                  # Root component, global state
        ├── main.jsx
        ├── agents/
        │   └── agents.jsx           # Built-in agent definitions + merge util
        ├── components/
        │   ├── analytics/
        │   │   └── AnalyticsView.jsx
        │   ├── chat/
        │   │   ├── ChatWindow.jsx
        │   │   ├── InputBox.jsx
        │   │   ├── MessageBubble.jsx
        │   │   ├── PromptGenerator.jsx
        │   │   └── PromptReviewerPanel.jsx
        │   ├── header/
        │   │   └── Header.jsx
        │   ├── settings/
        │   │   └── Settings.jsx
        │   └── sidebar/
        │       └── Sidebar.jsx
        ├── hooks/
        │   └── useLocalStorage.js
        ├── styles/
        │   └── global.css
        ├── templates/
        │   └── templates.js
        └── utils/
            └── exportUtils.js

🚀 Getting Started

Prerequisites

  • Node.js v18+ and npm
  • Python 3.10+
  • A Google Gemini API KeyGet one here
  • (Optional) A Groq API Key for the Prompt Reviewer → Get one here

Backend Setup

# 1. Navigate to the backend venv directory
cd backend/venv

# 2. Install dependencies
pip install fastapi uvicorn sqlmodel

# 3. Start the server
uvicorn main:app --reload --port 8000

The backend will be available at http://localhost:8000.
The SQLite database (astramind.db) is created automatically on first run.


Frontend Setup

# 1. Navigate to the frontend directory
cd frontend

# 2. Install dependencies
npm install

# 3. Start the development server
npm run dev

The app will be available at http://localhost:5173.


⚙️ Configuration

All configuration is done from the Settings view inside the app:

Setting Options Description
Tone Friendly, Formal, Casual, Creative, Technical Controls the AI's conversational tone
Response Style Short, Medium, Long, Detailed Controls response length
Model Mode Online, Offline Switches between live API and offline mode
LLM Provider Gemini (Default), Groq (Llama 3) Selects which AI provider to use
Gemini API Key (your key) Stored in localStorage
Groq API Key (your key) Used for the Prompt Reviewer panel

🤖 Built-in Agents

Agent ID Description
Astra Chat general Friendly general-purpose assistant
DevCore code Elite coding assistant for clean, optimized code
Scribe writer Expert writing and rewriting assistant
LogicNode math Step-by-step mathematical reasoning
Strategist planner Structured planning and goal breakdown
PromptGenerator prompt Rewrites user queries into optimized prompts

You can also create custom agents from the Settings panel by providing a name, system prompt, color, and emoji icon. Custom agents are persisted in the backend database.


📡 API Reference

The backend runs on http://localhost:8000.

Messages

Method Endpoint Description
POST /api/message Save a chat message
GET /api/history Retrieve all chat messages

Analytics

Method Endpoint Description
POST /api/analytics Save analytics data
GET /api/analytics Retrieve analytics data

Custom Agents

Method Endpoint Description
POST /api/agents Create a new custom agent
GET /api/agents List all custom agents
DELETE /api/agents/{id} Delete a custom agent by ID

System

Method Endpoint Description
GET / Health check
DELETE /api/reset Clear all messages, analytics, and custom agents

📖 Usage Guide

  1. Enter your API key in Settings → Gemini API Key.
  2. Pick an agent from the dropdown in the chat input (or leave on "Auto").
  3. Type your message and press Send (or Enter).
  4. Use Generate Prompt to let AI refine your input before sending.
  5. The Prompt Reviewer Panel (requires Groq API Key) gives real-time feedback on your draft.
  6. Browse the Sidebar to load prompt templates or export/reset your chat.
  7. Switch to the Analytics view to see your usage breakdown.

About

AstraMindChat is a multi-agent AI chat app built with React + FastAPI. It supports Google Gemini and Groq, custom agent creation, prompt optimization, and usage analytics.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages