Skip to content

dimagi/open-chat-studio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Chat Studio

Experiments with AI, GPT and LLMs. See this wiki for more information.

Deploy

Dev Environment Setup

This project uses Invoke for dev automation. You can view the list of available commands with:

inv -l

New commands / updates can be made to the tasks.py file.

1. Install dependencies

Setup a virtualenv and install requirements:

python -m venv venv
pip install -r dev-requirements.txt

Python 3.11 is recommended.

2. Run the automated setup

inv setup-dev-env

This will:

Install the pre-commit hooks

pre-commit install --install-hooks

Set up database

Start the database and redis services and run the DB migrations:

docker compose -f docker-compose-dev.yml up -d  # equivalent of `inv up`
cp .env.example .env
./manage.py migrate

Build the front-end resources

To build JavaScript and CSS files, first install npm packages:

inv npm --install
# or
npm install
npm run dev

Note

You should be using node >= 18.0.0. If you have nvm installed, you can run nvm use to switch to the correct version.

To check which version you are using use node --version.

Create a superuser

./manage.py createsuperuser

Running server

./manage.py runserver

Running Celery

Celery can be used to run background tasks.

Note: Celery is required to run in order to get a response from an LLM, so you'll need to run this if you want to test end-to-end conversations.

You can run it using:

inv celery
# or
celery -A gpt_playground worker -l INFO -B --pool=solo

To run a celery process more similar to production, you can use the following command:

inv celery --gevent
# or
celery -A gpt_playground worker -l INFO -B --pool gevent --concurrency 10

Updating translations

inv translations

Updating requirements

inv requirements

Options:
  -p STRING, --upgrade-package=STRING
  -u, --upgrade-all

Installing Git commit hooks

To install the Git commit hooks run the following:

$ pre-commit install --install-hooks

Once these are installed they will be run on every commit.

Running Tests

To run tests:

pytest

Or to test a specific app/module:

pytest apps/utils/tests/test_slugs.py

Notes

Signup page

By default the signup page is disabled. To enable it, you should set the SIGNUP_ENABLED environment variable to true

Testing webhooks

To test the webhooks, you can use a tool like ngrok to forward webhook data to your local machine.

Auditing

We use the django-field-audit library for auditing. Please see the table of audited methods and familiarize yourself on how to audit "special" functions like QuerySet.bulk_create().

Linting

We use ruff for linting and formatting. You can run it directly or with the inv ruff command:

Usage: inv ruff [--options]

Docstring:
  Run ruff checks and formatting. Use --unsafe-fixes to apply unsafe fixes.

Options:
  -n, --no-fix
  -u, --unsafe-fixes

About

A web based platform for building Chatbots backed by Large Language Models

Resources

License

Stars

Watchers

Forks

Releases

No releases published