Skip to content

React - Django application for interacting with LLM's hosted locally with Ollama.

License

Notifications You must be signed in to change notification settings

ethanlchristensen/BS-LLM-WebUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BS-LLM-WebUI

Inspired by nulzo - Ollama WebUI

BRUH SHELL

Description

BS-LLM-WebUI is a web application with a frontend built using React and Vite, and a backend powered by Django with a Poetry-managed virtual environment.

Table of Contents

Prerequisites

  • Node.js: Make sure you have Node.js installed to manage frontend dependencies.
  • Python: Ensure that Python 3.11+ is installed for running the Django backend.
  • Poetry: Make sure you have Poetry installed to manage Python dependencies.
  • Ollama: Ensure you have Ollama installed on your machine, or a machine on your local network.
  • Check to ensure each folder (frontend, backend, nginx) have their .env files created. Look at the sample.env files for examples.

Frontend Environment Variables

  • VITE_APP_BACKEND_API_URL: The url the frontend will use to access the backend.
    • If locally, http://127.0.0.1:8000/api/v1/
    • If with docker compose, /api/v1/

Backend Environment Variables

  • ALLOWED_HOSTS: The allowed hosts lists for django.
  • OLLAMA_ENDPOINT: The endpoint to access Ollama running locally.
    • If you are using docker on the same system that is running Ollama, you may need to use http://host.docker.internal:11434. Otherwise, it can be the IP address of the device hosting Ollama on your local network.
  • OPENAI_API_KEY: API Key to interact with OpenAI apis.
  • ANTHROPIC_API_KEY: API Key to interact with Anthropic apis.
  • GEMINI_API_KEY: API Key to interact with Google AI apis.
  • AZURE_OPENAI_ENDPOINT: Endpoint for Azure Open AI resource.
  • AZURE_OPENAI_API_KEY: API Key for Azure Open AI resource.
  • AZURE_OPENAI_VERSION: API Version of Azure Open AI resource.

Azure Open AI is not fully supported yet

Root Environment Variables

  • DJANGO_SUPERUSER_USERNAME: Username of the Django super user.
  • DJANGO_SUPERUSER_PASSWORD: Password of the Django super user.
  • DJANGO_SUPERUSER_EMAIL: Email of the Django super user.
  • OLLAMA_ENDPOINT: The endpoint to access Ollama running locally.
    • If you are using docker on the same system that is running Ollama, you may need to use http://host.docker.internal:11434. Otherwise, it can be the IP address of the device hosting Ollama on your local network.
  • VITE_APP_BACKEND_API_URL: The url the frontend will use to access the backend.
    • If locally, http://127.0.0.1:8000/api/v1/
    • If with docker compose, /api/v1/

Quickstart using Docker

docker compose up --build -d

Then the app will be accessible on http://127.0.0.1:8008 (or the ip of the device running the app on your local network)

Frontend Setup (React with Vite)

1. Navigate to the Frontend Directory

cd frontend

2. Install Dependencies

npm install

3. Start the Development Server & Tailwind watch

make run
make tailw

This will start the Vite development server, and you should be able to access the frontend at http://localhost:5173 by default.

Backend Setup (Django with Poetry)

1. Navigate to the Backend Directory

cd backend

2. Install Dependencies via Poetry

poetry install

3. Apply Database Migrations

poetry run python manage.py migrate

4. Create a Superuser (Optional, but recommended)

poetry run python manage.py createsuperuser

5. Populate the Models table

poetry run python manage.py populate_models

6. Start the Django Development Server

poetry run python manage.py runserver

This will start the Django development server, which will be accessible at http://localhost:8000 by default.

Running the Application

To run the application, start both the frontend and backend servers as described above:

  1. Start the Vite development server in the frontend directory.
  2. Start the Django development server in the backend directory.

The frontend React application will communicate with the Django backend via API calls.

You can then access the site at http://localhost:5173 (or the ip of the device on the local network)

Gallery

Landing Page

image

Utilize Custom Tools and Analyze Images

image

Custom Defined Tools

image image

Profile

image

Auth

image image

Themes

image image image

License

This project is licensed under the MIT License. See the LICENSE file for details.