return changes

This commit is contained in:
William Lane
2023-03-20 10:56:52 -07:00
parent be00ef3e50
commit b5b7048784
3 changed files with 10 additions and 9 deletions

View File

@@ -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 # which is the main file for the application
# Use an official Python runtime as a parent image # Use an official Python runtime as a parent image
FROM python:3.9 FROM python:3.8
# Set the working directory to /app # Set the working directory to /app
WORKDIR / WORKDIR /
@@ -13,8 +14,6 @@ ADD . .
# Install any needed packages specified in requirements.txt # Install any needed packages specified in requirements.txt
RUN pip install -r 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 # Run app.py when the container launches
CMD ["python", "run.py"] CMD ["python", "run.py"]

View File

@@ -3,7 +3,7 @@ import os
import discord import discord
from app.mabel.connect_openai import chatgpt_response from app.mabel.connect_openai import chatgpt_response
#load_dotenv() load_dotenv()
discord_token=os.getenv('DISCORD_TOKEN') discord_token=os.getenv('DISCORD_TOKEN')
print("DISCORD_TOKEN: ", discord_token) print("DISCORD_TOKEN: ", discord_token)
class MyClient(discord.Client): class MyClient(discord.Client):
@@ -16,6 +16,7 @@ class MyClient(discord.Client):
prompt = message.content[7:] prompt = message.content[7:]
response = await chatgpt_response(prompt) response = await chatgpt_response(prompt)
await message.channel.send(response) await message.channel.send(response)
return
intents=discord.Intents.default() intents=discord.Intents.default()
intents.messages=True intents.messages=True

View File

@@ -2,7 +2,7 @@ from dotenv import load_dotenv
import openai import openai
import os import os
import json import json
#load_dotenv() load_dotenv()
openai.api_key=os.getenv('OPENAI_KEY') openai.api_key=os.getenv('OPENAI_KEY')
SYSTEM_DIRECTIVES = [] SYSTEM_DIRECTIVES = []
@@ -31,4 +31,5 @@ async def chatgpt_response(prompt):
DIALOGUE_STACK.append({"role": "assistant", "content": response['choices'][0]['message']['content']}) DIALOGUE_STACK.append({"role": "assistant", "content": response['choices'][0]['message']['content']})
return response ['choices'][0]['message']['content'] return response ['choices'][0]['message']['content']
else: else:
DIALOGUE_STACK.append({"role": "user", "content": prompt}) DIALOGUE_STACK.append({"role": "user", "content": prompt})
return