@@ -5,6 +5,7 @@ This repository contains the source code for a Telegram bot that leverages DocsG
5
5
## Features
6
6
- Responds to user queries with intelligent answers using DocsGPT.
7
7
- Maintains conversation history for context-aware responses.
8
+ - Supports multiple storage backends for conversation history (in-memory or MongoDB).
8
9
- Easily deployable using Docker.
9
10
10
11
## Prerequisites
@@ -44,7 +45,18 @@ Before you begin, ensure you have met the following requirements:
44
45
` ` ` plaintext
45
46
TELEGRAM_BOT_TOKEN=< your-telegram-bot-token>
46
47
API_KEY=< your-api-key>
48
+ # Optional: Storage Configuration (Defaults to in-memory)
49
+ # STORAGE_TYPE=mongodb
50
+ # MONGODB_URI=<your-mongodb-connection-string>
51
+ # MONGODB_DB_NAME=telegram_bot_memory
52
+ # MONGODB_COLLECTION_NAME=chat_histories
47
53
` ` `
54
+ - ` TELEGRAM_BOT_TOKEN` : Your Telegram bot token from BotFather.
55
+ - ` API_KEY` : Your DocsGPT API key.
56
+ - ` STORAGE_TYPE` : (Optional) Specifies where to store conversation history. Defaults to ` memory` . Set to ` mongodb` to use MongoDB.
57
+ - ` MONGODB_URI` : (Required if ` STORAGE_TYPE=mongodb` ) Your MongoDB connection string.
58
+ - ` MONGODB_DB_NAME` : (Optional, defaults to ` telegram_bot_memory` ) The name of the MongoDB database.
59
+ - ` MONGODB_COLLECTION_NAME` : (Optional, defaults to ` chat_histories` ) The name of the MongoDB collection.
48
60
49
61
5. Run the bot:
50
62
` ` ` bash
@@ -68,7 +80,13 @@ Before you begin, ensure you have met the following requirements:
68
80
` ` ` plaintext
69
81
TELEGRAM_BOT_TOKEN=< your-telegram-bot-token>
70
82
API_KEY=< your-api-key>
83
+ # Optional: Storage Configuration (Defaults to in-memory)
84
+ # STORAGE_TYPE=mongodb
85
+ # MONGODB_URI=<your-mongodb-connection-string>
86
+ # MONGODB_DB_NAME=telegram_bot_memory
87
+ # MONGODB_COLLECTION_NAME=chat_histories
71
88
` ` `
89
+ See the Python installation section above for details on environment variables.
72
90
73
91
4. Run the Docker container:
74
92
` ` ` bash
@@ -88,6 +106,7 @@ Simply type any message, and the bot will respond with an intelligent answer bas
88
106
- ` bot.py` : The main script for running the bot.
89
107
- ` requirements.txt` : Python dependencies required by the bot.
90
108
- ` Dockerfile` : Instructions to build the Docker image.
109
+ - ` docker-compose.yml` : Docker Compose configuration for easier deployment.
91
110
- ` .env` : File containing environment variables (not included, must be created).
92
111
93
112
# # License
0 commit comments