Skip to content

tungedng2710/TonAI-Telegram-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TonAI Telegram Bot

Telegram bot with Ollama and ComfyUI

Setup

Clone this repository and move to it

git clone https://github.com/tungedng2710/TonAI-Telegram.git
cd TonAI-Telegram

Install requirements

pip install -r requirements.txt

Install Ollama backend

If you are using Linux, run the command

curl -fsSL https://ollama.com/install.sh | sh

After installing Ollama, start the Ollama service

ollama serve

Ollama will run on default port 11434. If you want more advanced configs, please checkout the Official Ollama website

Create a configs.py file, then write the configs file like the example below

MODEL_ID = 'llama3.2-vision'
BOT_USERNAME = "tonai_chat_bot"
with open("bot_token.txt") as txtfile:
   BOT_TOKEN = txtfile.read()
   
LIMITATION = 20
GREETING = """
I'm TonAI Chatbot
"""

You have to pull Ollama model (or create it before). For example, from terminal, run this command below to pull Llama 3.2 11B Vision from Ollama. If you want your bot can handle photos sent by users, you need to find multi-modal models.

ollama run llama3.2-vision

NOTE: You must also have the bot_token.txt file, which contains your Telegram bot token. I cannot upload the BOT_TOKEN, so you have to replace the BOT_TOKEN infomation in this code with your own Telegram bot token. If you don't know how to create a Telegram bot, visit this Tutorial website.

Run

Just run the Python code

python run main.py

Releases

No releases published

Packages

No packages published

Languages