Skip to content

sarthak03dot/Agent-X

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

AI Agent Web Application

A full-stack AI-powered web application featuring a FastAPI backend and a Next.js frontend. This project supports AI chat, voice chat, and user usage tracking.

Technology Stack

  • Frontend: Next.js 16, React 19, Tailwind CSS 4, Axios.
  • Backend: FastAPI, Motor (MongoDB Async Driver), Pydantic, Jose (JWT).
  • Database: MongoDB.
  • AI Engine: Ollama (local) or OpenAI API.

Prerequisites

Before setting up the project, ensure you have the following installed:


Project Setup

1. Clone the repository

git clone <repository-url>
cd ai-agent-web

2. Backend Setup

Windows (PowerShell)

cd backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt

macOS / Linux

cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Environment Configuration

Create a .env file in the backend/ directory:

MONGO_URL=mongodb://localhost:27017
SECRET_KEY=your-secret-key-change-me
OLLAMA_URL=http://localhost:11434/api/generate
MODEL=qwen2.5-coder:1.5b-base

3. Frontend Setup

All Platforms

cd frontend
npm install

Environment Configuration

Create a .env.local file in the frontend/ directory (if needed for API URLs).


Running the Application

Start the Backend

From the backend/ directory (with virtual environment active):

uvicorn main:app --reload

The backend will be available at http://localhost:8000.

Start the Frontend

From the frontend/ directory:

npm run dev

The frontend will be available at http://localhost:3000.


Features

  • AI Chat: Interact with AI models via a clean web interface.
  • Voice Chat: Simulated voice interaction (requires login).
  • Authentication: JWT-based user registration and login.
  • Usage Limits: Daily chat and voice limits for guests and registered users.
  • Chat History: Persists chat sessions in MongoDB for authenticated users.

Troubleshooting

  • MongoDB Connection: Ensure MongoDB is running and the MONGO_URL in backend/.env is correct.
  • AI Connection: If using Ollama, ensure it is running and the model specified in MODEL is pulled (ollama pull qwen2.5-coder:1.5b-base).
  • Python Path: On Windows, if python doesn't work, try py. On macOS/Linux, use python3.

About

A full-stack AI-powered web application featuring a FastAPI backend and a Next.js frontend. This project supports AI chat, voice chat, and user usage tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors