Skip to content

Twilight-Tales/Twilight-Chat

Repository files navigation

Twilight Chat

Twilight Chat Logo

Twilight Chat is a virtual book club host that helps elderly to engage in reading activities, in order to help mediate cognitive declines.

Concept

As chatbots evolve, ...

Features

  • Flexible Integration: Develop chatbots for various front-end delivery mechanisms, integration with Twilio and other system.
  • Database Integration: Robust support for databases to store and retrieve essential chatbot data.
  • Language Model Integration: Seamless integration with third-party LLMs like OpenAI or self-hosted models.
  • API Deployment: Deploy your chatbot logic as a scalable API, ready to integrate with various front-end channels.
  • Developer-Centric Tools: Comprehensive tools, from conversation flow design to testing and deployment.

Getting Started

  1. Clone the repository:
git clone https://github.com/Twilight-Tales/Twilight-Chat.git
  1. Set up your environment:

Copy example.env into .env and change the values.

  1. Docker:

If you are running docker and vLLM on the same machine, you need to set

VLLM_URL=http://host.docker.internal:8000/v1

instead of localhost for docker to access vllm on the host machine.

To just run the app:

docker build -t twilight .
docker run --env-file ./.env -p 1680:1680 -d twilight

Hot reload during development:

docker run -v $(pwd):/app --env-file ./.env -p 1680:1680 --add-host=host.docker.internal:host-gateway twilight \
python -m chainlit run /app/app.py -h --port 1680 -w
  1. Run in pure python env: Create and activate your python virtual env:
python -m venv .venv
source .venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Run chainlit chatbot:

chainlit run app.py -w
  1. Deploy on k8s:

Create k8s secrets from .env file:

kubectl create secret generic twilight-secret --from-env-file=.env

push image to registry:

docker tag twilight quay.io/twilight_chat/twilight_chat
docker push quay.io/twilight_chat/twilight_chat

run this will create both app and service

kubectl apply -f twilight-app-k8s.yaml

port forward to host:

kubectl port-forward service/twilight-service 1680:1680

port forward in background:

kubectl port-forward service/twilight-service 1680:1680 > /dev/null 2>&1 &

confirm port forwarding works:

ps aux | grep 'kubectl port-forward'
  1. Some of the commands above are included in the Makefile for your convenience. For example:

Build the docker image:

make build

Build and push image, update k8s deployment and restart port-forwarding:

make update-app

Checkout more short-cut commands in the Makefile.

Contributing

We welcome contributions! Whether it's bug reports, feature requests, or pull requests, we encourage you to share and contribute to Twilight's growth. Please read our CONTRIBUTING.md for guidelines on how to contribute.

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.

Acknowledgements

Thanks to all our contributors and supporters.