Giter VIP home page Giter VIP logo

chatgpt-postgres-qa-bot's Introduction

ChatGPT-Postgres-QA-Bot

This is a question-answering bot developed using Node.js. The technologies used are:

  • ๐Ÿ’พ Storage: Postgres + pgvector + Sequelize (ORM)
  • ๐Ÿ” Indexing: OpenAI's Embedding model
  • ๐Ÿค– Question-answering: OpenAI's GPT-3.5 model

Quick Start

First, you need to install [docker-compose] on your computer.

Then create an openai.env file in the env folder (you can refer to the openai.env.example file).

Run in Production Mode

pnpm run build                          # (need nodejs) build on host
# bash ./scripts/build-in-docker.sh     # or build in docker

bash ./scripts/prod-gen.sh              # generate ./docker-compose.prod.yml
docker compose -f docker-compose.prod.yml up --build # add `-d` to run in background

Environment

Since the network situation is kinda limited, I added these special changes. If you don't need them, please remove:

  • TZ in ./env/openai.env -- timezone
  • HTTP_PROXY in ./env/openai.env -- http proxy to bypass firewall
  • NPM_REGISTRY in many files -- npm mirror. you can safely remove those lines

Develop and Debug

Directly run the docker-compose and your program will run in development mode.

pnpm run build                          # (need nodejs) build on host
# bash ./scripts/build-in-docker.sh     # or build in docker

docker compose up --build -d                   # Run all container in background

Debugger

It will enable Inspector Port 9229. You can attach to the container process in VSCode easily.

Edit Code then Re-run

In Development Mode, docker-compose will mount host's ./backend/lib directory into the app Docker container's /app/lib.

Therefore, you can run the newest code, without rebuilding images (unless you installed new npm packages).

Please run these commands at the same time, in different terminal panes:

# [1]
# observe outputs
bash ./scripts/dev-observe-logs.sh

# [2]
# build when sources change
# you will need nodejs >= 16, pnpm
pnpm run dev

# [3]
# restart app. run this when needed
docker compose restart -t 1 app
# docker compose up -d --build app      # if package.json changes

chatgpt-postgres-qa-bot's People

Contributors

lyonbot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.