Skip to content

fares3010/askquo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 

Repository files navigation

AskQuo - Django AI Chatbot Platform

AskQuo is a powerful Django-based platform that enables users to create, configure, and deploy AI agents. It provides a comprehensive suite of features for document processing, website integration, real-time conversations, subscription management, and team collaboration.

Table of Contents

Project Overview

AskQuo is designed to simplify the creation and deployment of AI-powered chatbots. Users can upload various document types, connect their websites for content scraping, and manage interactive conversations through a robust REST API. The platform also includes features for user authentication, subscription management, team collaboration, and usage analytics.

Purpose

The primary goals of AskQuo are to:

  • Provide a user-friendly interface for creating and managing AI agents.
  • Facilitate the processing of diverse document formats and website content for AI knowledge bases.
  • Enable seamless, real-time conversations with AI agents.
  • Offer comprehensive subscription and payment management.
  • Support team-based collaboration for shared agent development.
  • Provide insights into platform usage and performance.

Technologies Used

Backend Framework:

  • Django 5.2.4
  • Django REST Framework 3.16.0
  • Django CORS Headers 4.7.0

Database:

  • PostgreSQL (via psycopg2-binary)
  • SQLite (for development)

AI/ML:

  • OpenAI 1.97.1 (GPT models)
  • LangChain OpenAI 0.3.28
  • Pinecone (vector database)
  • Tiktoken 0.9.0

Authentication:

  • Django REST Framework Simple JWT 5.5.1
  • Django Allauth 65.10.0 (Google/Facebook OAuth)

File Storage:

  • Google Cloud Storage 2.10.0
  • Django Storages 1.14.2
  • Pillow 10.4.0 (image processing)

Web Scraping:

  • Playwright 1.44.0
  • BeautifulSoup4 4.13.4

Payment Processing:

  • Stripe (via webhooks)
  • PayPal REST SDK 1.13.3
  • Paymob integration

Other:

  • Python-dotenv 1.1.1
  • Requests 2.32.4
  • Aiohttp 3.12.14

Project Structure

bot/
├── accounts/          # User authentication & management
├── bot/              # Core app (settings, middleware, storage)
├── conversations/    # Chat/conversation management
├── create_agent/     # Agent creation & management
├── dashboard/        # User dashboard
├── integrations/     # Third-party integrations
├── plans/            # Subscription plans & payments
└── manage.py         # Django management script

Key Features

  1. Agent Management

    • Create, update, and delete AI agents.
    • Upload various document formats (PDF, DOCX, TXT, CSV, etc.) to train agents.
    • Connect websites for automated content scraping to enrich agent knowledge.
    • Configure agent settings, visibility, and behavior.
  2. Conversation System

    • Engage in real-time chat with deployed AI agents.
    • Maintain message history and support for attachments in conversations.
    • Organize conversations with tagging and add private notes.
    • Provide feedback and ratings for agent interactions.
  3. Document Processing

    • Support for multiple document formats for ingestion.
    • Integration with Pinecone for vector embeddings and efficient data retrieval.
    • Seamless file storage with Google Cloud Storage.
    • Advanced document analysis and parsing capabilities.
  4. Authentication & Authorization

    • Secure email-based authentication.
    • JWT token-based API authentication.
    • Support for Google/Facebook OAuth for easy sign-in.
    • Granular, team-based permissions and role management.
  5. Subscription Management

    • Flexible multiple subscription plans with varying features.
    • Integration with popular payment gateways: Stripe, PayPal, and Paymob.
    • Detailed usage tracking (tokens, conversations, messages).
    • Support for trial periods for new users.
  6. Team Collaboration

    • Create and manage teams for collaborative agent development.
    • Role-based permissions (admin, member, viewer) for team members.
    • Share agents and resources among team members.

Setup Instructions

Prerequisites

Before you begin, ensure you have the following installed:

  • Python 3.12+
  • A PostgreSQL database instance
  • (Optional) A Google Cloud Storage account for file storage
  • API keys for: OpenAI, Pinecone, Stripe/PayPal/Paymob (as needed for desired features)

Installation Steps

  1. Clone the repository:

    git clone https://github.com/your-username/chatbot_django.git
    cd chatbot_django
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: `venv\Scripts\activate`
  3. Install project dependencies:

    cd bot
    pip install -r requirements.txt
  4. Set up environment variables: Create a .env file in the bot/ directory with the following variables. Replace placeholder values with your actual credentials and settings.

    # Django Settings
    DJANGO_SECRET_KEY=your-secret-key-here
    DEBUG=True
    
    # Database (PostgreSQL example)
    DB_NAME=your_database_name
    DB_USER=your_database_user
    DB_PASSWORD=your_database_password
    DB_HOST=your_database_host
    DB_PORT=5432
    
    # OpenAI
    OPENAI_API_KEY=your-openai-api-key
    
    # Pinecone
    PINECONE_API_KEY=your-pinecone-api-key
    PINECONE_ENVIRONMENT=your-pinecone-environment
    
    # Google Cloud Storage (optional)
    USE_GCS=False
    GCS_BUCKET_NAME=your-bucket-name
    GS_PROJECT_ID=your-project-id
    GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
    
    # OAuth (optional)
    GOOGLE_CLIENT_ID=your-google-client-id
    GOOGLE_CLIENT_SECRET=your-google-client-secret
    GOOGLE_REDIRECT_URI=http://localhost:3000/auth/google/callback
    
    # Payment Gateways (optional)
    STRIPE_SECRET_KEY=your-stripe-secret-key
    STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secret
    # PAYPAL_CLIENT_ID=your-paypal-client-id
    # PAYPAL_CLIENT_SECRET=your-paypal-client-secret
    # PAYMOB_API_KEY=your-paymob-api-key
  5. Run database migrations:

    python manage.py migrate
  6. Create a superuser (optional, for admin access):

    python manage.py createsuperuser
  7. Install Playwright browsers (required for web scraping):

    python manage.py install_playwright

Running the Application

Development Server

To start the Django development server:

python manage.py runserver

The application will be accessible at http://localhost:8000.

Important Endpoints

  • Admin Interface: http://localhost:8000/admin/
  • API Root: http://localhost:8000/
  • Accounts: http://localhost:8000/accounts/
  • Agents: http://localhost:8000/agents/
  • Conversations: http://localhost:8000/conversations/
  • Dashboard: http://localhost:8000/dashboard/
  • Plans: http://localhost:8000/plans/

API Authentication

The AskQuo API utilizes JWT (JSON Web Token) for authentication. After a successful login, you will receive a JWT token. Include this token in the Authorization header of your API requests:

Authorization: Bearer <your-jwt-token>

Additional Resources

Refer to the following documentation files within the bot/ directory for detailed setup and configuration guides:

  • bot/GCS_INTEGRATION_GUIDE.md: Google Cloud Storage integration.
  • bot/DYNAMIC_CORS_SETUP.md: Dynamic CORS configuration.
  • bot/GOOGLE_OAUTH_SETUP.md: Google OAuth setup.
  • bot/PLAYWRIGHT_SETUP_GUIDE.md: Playwright browser setup.
  • bot/WEBHOOK_TROUBLESHOOTING.md: Payment gateway webhook troubleshooting.

This README provides a comprehensive overview to get you started with AskQuo.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages