From b5b704878473582a4840527ca9a0a7d1755f3754 Mon Sep 17 00:00:00 2001 From: William Lane Date: Mon, 20 Mar 2023 10:56:52 -0700 Subject: [PATCH] return changes --- Dockerfile | 11 +++++------ app/discord_bot/connect_discord.py | 3 ++- app/mabel/connect_openai.py | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 546f863..c84bbda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -# This dockerfile runs the run.py python file +# This dockerfile runs the mabel-chat service as a production application. the run.py +# python file is where the service is started. # which is the main file for the application # Use an official Python runtime as a parent image -FROM python:3.9 +FROM python:3.8 # Set the working directory to /app WORKDIR / @@ -13,8 +14,6 @@ ADD . . # Install any needed packages specified in requirements.txt RUN pip install -r requirements.txt -# Make port 8080 available to the world outside this container -EXPOSE 8080 -# Run run.py when the container launches -CMD ["python", "run.py"] +# Run app.py when the container launches +CMD ["python", "run.py"] \ No newline at end of file diff --git a/app/discord_bot/connect_discord.py b/app/discord_bot/connect_discord.py index a629076..b922e6d 100644 --- a/app/discord_bot/connect_discord.py +++ b/app/discord_bot/connect_discord.py @@ -3,7 +3,7 @@ import os import discord from app.mabel.connect_openai import chatgpt_response -#load_dotenv() +load_dotenv() discord_token=os.getenv('DISCORD_TOKEN') print("DISCORD_TOKEN: ", discord_token) class MyClient(discord.Client): @@ -16,6 +16,7 @@ class MyClient(discord.Client): prompt = message.content[7:] response = await chatgpt_response(prompt) await message.channel.send(response) + return intents=discord.Intents.default() intents.messages=True diff --git a/app/mabel/connect_openai.py b/app/mabel/connect_openai.py index 214d3ae..75882a3 100644 --- a/app/mabel/connect_openai.py +++ b/app/mabel/connect_openai.py @@ -2,7 +2,7 @@ from dotenv import load_dotenv import openai import os import json -#load_dotenv() +load_dotenv() openai.api_key=os.getenv('OPENAI_KEY') SYSTEM_DIRECTIVES = [] @@ -31,4 +31,5 @@ async def chatgpt_response(prompt): DIALOGUE_STACK.append({"role": "assistant", "content": response['choices'][0]['message']['content']}) return response ['choices'][0]['message']['content'] else: - DIALOGUE_STACK.append({"role": "user", "content": prompt}) \ No newline at end of file + DIALOGUE_STACK.append({"role": "user", "content": prompt}) + return \ No newline at end of file