From 5c5136be7cae621600bafb05ca18f6384efe688e Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 19 Dec 2023 21:37:07 +0000 Subject: [PATCH] added chromium and new bot tokens --- .vscode/launch.json | 2 +- Dockerfile | 8 +++++--- agent-py-bot/agent.py | 13 +++++++++---- agent-py-bot/cmd.sh | 2 ++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index eda1824..cc04cbc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -29,11 +29,11 @@ "request": "launch", "program": "${workspaceFolder}/agent-py-bot/agent.py", "console": "integratedTerminal", - "preLaunchTask": "activate-venv", // Custom task to activate venv and run Docker "python": "/venv/bin/python", // Path to the Python interpreter in your venv "env": { "PYTHONUNBUFFERED": "1" } } + ] } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0258670..a9ff892 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,11 +76,13 @@ EXPOSE 8080 8081 RUN apk add --no-cache python3 py3-pip # If you need Python to be the default version, make a symbolic link to python3 RUN if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python; fi -# Ensure pip is up to date -#RUN python -m ensurepip --upgrade +# Install Chromium and Chromium WebDriver # comment to reduce the deployment image size +RUN apk add --no-cache chromium chromium-chromedriver + +# Create a virtual environment and activate it RUN python3 -m venv /venv -RUN . /venv/bin/activate && pip install -r agent-py-bot/requirements.txt +RUN . /venv/bin/activate && pip install --upgrade pip && pip install -r agent-py-bot/requirements.txt #RUN chown -R node /app #USER node diff --git a/agent-py-bot/agent.py b/agent-py-bot/agent.py index bf68f8e..c2c8528 100644 --- a/agent-py-bot/agent.py +++ b/agent-py-bot/agent.py @@ -1,5 +1,7 @@ import logging -from telegram.ext import Updater, CommandHandler, MessageHandler, Filters +from telegram.ext import Updater, CommandHandler, MessageHandler, filters, CallbackContext + + import requests import json import base64 @@ -13,10 +15,13 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s logger = logging.getLogger(__name__) # Telegram Bot Token -TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN_HERE' +# t.me/kevin_ai_robot +TOKEN = '6805059978:AAHNJKuOeazMSJHc3-BXRCsFfEVyFHeFnjw' +# t.me/artitherobot 6749075936:AAHUHiPTDEIu6JH7S2fQdibwsu6JVG3FNG0 + # LLM API Endpoint -LLM_ENDPOINT = "http://localhost:11434/api/chat" +LLM_ENDPOINT = "http://192.168.0.11:11434/api/chat" # Selenium WebDriver setup for screenshots chrome_options = Options() @@ -25,7 +30,7 @@ driver = webdriver.Chrome(options=chrome_options) def start(update, context): """Send a message when the command /start is issued.""" - update.message.reply_text('Hi! Send me a message, and I will interact with LLM.') + update.message.reply_text('Hi I am ! Send me a message, and I will interact with LLM.') def echo(update, context): """Echo the user message.""" diff --git a/agent-py-bot/cmd.sh b/agent-py-bot/cmd.sh index 877d73b..877bbc8 100644 --- a/agent-py-bot/cmd.sh +++ b/agent-py-bot/cmd.sh @@ -6,6 +6,8 @@ pip install python-telegram-bot requests selenium Pillow +pip freeze > requirements.txt + pip install ....