Skip to content

An app that helps you to practice negotiations with AI

Notifications You must be signed in to change notification settings

initialcapacity/negotiator

Repository files navigation

Negotiator

An app that helps you to practice negotiations with ChatGPT.

Architecture

Negotiator is a server side rendered app using Flask. It uses Lit to create web components to add dynamic capabilities to each page. Lit web components are developed and tested in the web components directory, and build Javascript and CSS artifacts are copied to the Flask app's static directory. This approach allows for the simplicity of server side rendered app with the dynamic features of a single page app.

Build and run

  1. Install python and dependencies

    brew install [email protected] nodejs postgresql@14
    python -m venv venv
    pip install -r requirements.txt
    npm install --prefix web-components
  2. Set up the environment

    cp .env.example .env
    vi .env
    source .env
  3. Set up the database

    psql postgres < databases/drop_and_create_databases.sql
    make migrate migrate-test
  4. Build the frontend and watch for changes

    npm run build:watch --prefix web-components
  5. Run the fake oauth server in a separate terminal

    python fake_auth_server.py
  6. Run the app in a separate terminal

    source .env
    python -m negotiator

Running tests

mypy negotiator tests
python -m unittest
npm run test --prefix web-components

Running with Docker

  1. Install dependencies and run via gunicorn

    pip install -r requirements.txt
    gunicorn -w 4 'negotiator.app:create_app()' --bind=0.0.0.0:${PORT}
  2. Pack and run via docker

    pack build negotiator --builder=gcr.io/buildpacks/builder:v1
    docker run -p 8081:8081 --env-file .env.docker negotiator