Skip to content

Commit

Permalink
fix src
Browse files Browse the repository at this point in the history
  • Loading branch information
alserious committed Oct 12, 2023
1 parent faf2cf7 commit 9424ab9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
script: |
docker image prune -a --filter "until=2h"
docker load --input /opt/TelegramGPTBot/telegram_gpt_bot_image.tar
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} BOT_TOKEN=${{ secrets.BOT_TOKEN }} \
ADMIN_CHAT_ID=${{ secrets.ADMIN_CHAT_ID }} LOG_LEVEL=${{ secrets.LOG_LEVEL }} \
Expand Down
2 changes: 1 addition & 1 deletion TelegramGPT/telegramgpt/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


# from telegramgpt.gpt import send_message_to_openai
from telegramgpt.config import BOT_TOKEN, ADMIN_CHAT_ID, logger
from .config import BOT_TOKEN, ADMIN_CHAT_ID, logger


bot = Bot(token=BOT_TOKEN)
Expand Down
9 changes: 5 additions & 4 deletions TelegramGPT/telegramgpt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
import sys

from loguru import logger
from dotenv import load_dotenv

load_dotenv()
# from dotenv import load_dotenv


# load_dotenv()

OPENAI_API_KEY = str(os.getenv("OPENAI_API_KEY"))
BOT_TOKEN = str(os.getenv("BOT_TOKEN"))
ADMIN_CHAT_ID = int(os.getenv("ADMIN_CHAT_ID"))


LOG_LEVEL = str(os.getenv("LOG_LEVEL", "INFO"))

logger.remove()
logger.add(sys.stderr, level=LOG_LEVEL)
8 changes: 3 additions & 5 deletions TelegramGPT/telegramgpt/gpt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import openai

from telegramgpt.config import OPENAI_API_KEY
from .config import OPENAI_API_KEY


def send_message_to_openai(message: str) -> str:
Expand All @@ -14,17 +14,15 @@ def send_message_to_openai(message: str) -> str:
return response




# @dp.message_handler()
# async def gpt(message: types.Message):
# response = openai.Completion.create(
# model="text-davinci-003", # text-davinci-003 text-ada-001 -> select model to use
# model="text-davinci-003", # text-davinci-003 text-ada-001 -> select model to use
# prompt=message.text,
# temperature=0.5,
# max_tokens=100,
# top_p=1,
# frequency_penalty=0.0,
# presence_penalty=0.0,
# )
# await message.reply(response.choices[0].text)
# await message.reply(response.choices[0].text)
2 changes: 1 addition & 1 deletion TelegramGPT/telegramgpt/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from telegramgpt import bot
from .bot import bot


def main() -> None:
Expand Down

0 comments on commit 9424ab9

Please sign in to comment.