Skip to content

B1gB4dB4ng/ChatBotAssistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart Knowledge Assistant

A modern, full-stack chatbot application with user authentication, conversation management, and OpenAI integration. Built with FastAPI backend and React TypeScript frontend.

πŸš€ Features

  • User Authentication & Authorization: JWT-based authentication with role-based access control
  • Intelligent Chat Interface: OpenAI-powered conversations with context awareness
  • Conversation Management: Save, retrieve, and organize chat histories
  • Data Source Integration: Upload and process CSV files for contextual responses
  • Admin Dashboard: User management, analytics, and system monitoring
  • Dark/Light Theme: Customizable UI themes
  • Real-time Analytics: Usage statistics and conversation insights

Architecture

β”œβ”€β”€ backend/          # FastAPI REST API
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ models/   # Database models (SQLAlchemy)
β”‚   β”‚   β”œβ”€β”€ routers/  # API endpoints
β”‚   β”‚   β”œβ”€β”€ schemas/  # Pydantic models
β”‚   β”‚   └── services/ # Business logic
β”‚   └── uploads/      # File storage
β”œβ”€β”€ frontend/         # React TypeScript SPA
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ contexts/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   └── services/
β”‚   └── public/

πŸ“‹ Prerequisites

System Requirements

  • Node.js: 18.0.0 or higher
  • Python: 3.8 or higher
  • npm or yarn: Latest stable version

Required API Keys

  • OpenAI API Key: Required for chat functionality

πŸ› οΈ Installation & Setup

1. Clone the Repository

git clone https://github.com/B1gB4dB4ng/ChatBotAssistant.git
cd ChatBotAssistant

2. Backend Setup

Navigate to Backend Directory

cd backend

Create Python Virtual Environment

# Windows
python -m venv venv
venv\Scripts\activate

# macOS/Linux
python3 -m venv venv
source venv/bin/activate

Install Python Dependencies

pip install -r requirements.txt

Environment Configuration

  1. Copy the environment template:

    cp .env.example .env
  2. Edit .env file with your configuration:

    OPENAI_API_KEY=your_openai_api_key_here
    ENVIRONMENT=development
    LOG_LEVEL=INFO
    API_HOST=0.0.0.0
    API_PORT=8000
    
    # Database Configuration
    DATABASE_URL=sqlite:///./smart_assistant.db
    
    # JWT Authentication
    SECRET_KEY=your-secret-key-here-change-in-production-minimum-32-characters
    ACCESS_TOKEN_EXPIRE_MINUTES=43200

    ⚠️ Important: Replace your_openai_api_key_here with your actual OpenAI API key and generate a secure secret key (minimum 32 characters).

Initialize Database

python -m app.init_db

Start Backend Server

uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

The API will be available at http://localhost:8000

  • API Documentation: http://localhost:8000/docs
  • Alternative Docs: http://localhost:8000/redoc

3. Frontend Setup

Navigate to Frontend Directory (New Terminal)

cd frontend

Install Node.js Dependencies

npm install

Start Development Server

npm run dev

The application will be available at http://localhost:5173

πŸš€ Usage

First Time Setup

  1. Navigate to http://localhost:5173
  2. Register a new account
  3. Login with your credentials
  4. Start chatting with the AI assistant

Admin Features

  • First registered user automatically becomes admin
  • Access admin dashboard via user menu
  • Manage users, view analytics, and monitor system health

Data Sources

  • Upload CSV files through the admin interface
  • Files are processed and made available for contextual AI responses
  • Supported formats: CSV with headers

πŸ”§ Development

Backend Development

cd backend
# Activate virtual environment
source venv/bin/activate  # or venv\Scripts\activate on Windows

# Install development dependencies
pip install -r requirements.txt

# Run with auto-reload
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Frontend Development

cd frontend
# Install dependencies
npm install

# Start development server
npm run dev



## πŸ“Š API Documentation

### Key Endpoints
- `GET /` - API health check and information
- `POST /api/v1/auth/login` - User authentication
- `POST /api/v1/auth/register` - User registration
- `POST /api/v1/chat/message` - Send chat message
- `GET /api/v1/conversations` - List user conversations
- `GET /api/v1/admin/users` - Admin user management

Full API documentation available at `http://localhost:8000/docs`

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published