Skip to content

hanstanawi/telegram-gpt

Repository files navigation

Telegram-GPT

A Telegram Bot named Samantha, inspired by the film "Her" that leverages Chat-GPT features with OpenAI.

Getting Started

  1. Install dependencies:

    Make sure you have pnpm installed. Learn more about installing pnpm.

    pnpm install
  2. Run the database

    Since this project uses Prisma ORM. The Postgres database container needs to be running upon the project init to avoid any Prisma connection error.

    pnpm db:up

    To learn more about running databases using Docker. Checkout the Prisma section.

  3. Run the app in dev mode

    pnpm start:dev

Commands

  • reset - To reset your character and bot chat history
  • start - To initialize your bot
  • model - To show the list of available models and select your model.
  • voice - To show the list of available speakers.
  • character - To enter your bot character prompt and select predefined character. To enter custom character prompt, use: e.g. /character i am an assistant
  • profile - To show your profile system preferences

Docker

You can run this project without having Node.js installed on your machine by running it using Docker as a container. You can learn more about Docker here.

Make sure Docker is installed and Docker daemon is running on your machine. You can learn more how to download and setup Docker here.

  1. Run the Docker containers using Docker Compose

    docker compose up -d --build
  2. Stop running containers

    docker compose down

You can also run these commands with make command based on this project's Makefile configuration to avoid memorizing the long docker commands.

  1. Run containers

    make docker-run
  2. Stop container

    make docker-stop

Prisma

This NestJS starter template comes with Prisma ORM, a modern Node.js and TypeScript ORM that works really well with NestJS. You can check the full official guide to get started with NestJS and Prisma here.

  1. Running the database

    It only runs Postgres container with Docker Compose

    pnpm db:up
  2. Create a database migration

    Whenever you make any changes in the schema.prisma file, you need to create a migration to reflect the changes you made on the schema to the database.

    To create a migration, simply run this command, then enter the name of the migration. e.g. add_user_table

    pnpm prisma migrate dev
  3. Run existing migrations

    pnpm db:deploy
  4. Generate Prisma Client

    It runs the prisma generate command under the hood to generate type definitions based on the schema.prisma schema.

    pnpm db:generate
  5. Run Prisma Studio

    It runs the Prisma Studio tools to open Prisma database admin client tools.

    pnpm db:studio

Unit Testing

This starter template has Jest setup to run unit and integration API tests. Tests are automatically executed on every pull request and push by GitHub Actions CI workflow.

You can run unit tests and e2e tests manually on your machine:

  • Run all unit tests
    pnpm test
  • Run test in watch mode
    pnpm test:watch
  • Unit test coverage
    pnpm test:cov

Releases

No releases published

Packages

No packages published