Update pycord commit to fix upload_file_size number
This commit is contained in:
parent
b912b1d577
commit
547d6545e1
@ -21,7 +21,7 @@ class Gpt(commands.Cog):
|
||||
|
||||
# try:
|
||||
await ctx.defer()
|
||||
embed = gpt.answer_question(prompt)
|
||||
embed = gpt.answer_question(prompt, user=ctx.author.name)
|
||||
await ctx.send_followup(embed=embed)
|
||||
# except Exception as e:
|
||||
# await ctx.send(e)
|
||||
|
33
app/gpt.py
33
app/gpt.py
@ -1,31 +1,16 @@
|
||||
import discord
|
||||
import json
|
||||
import requests
|
||||
import os
|
||||
|
||||
import openai
|
||||
|
||||
|
||||
def answer_question(prompt):
|
||||
def answer_question(prompt, user):
|
||||
bots_context = "You are located in zipcode 94549. You are a chatbot written in python and you are answering questions for me"
|
||||
|
||||
session = requests.Session()
|
||||
payload = {
|
||||
"model": "text-davinci-003",
|
||||
"messages": [
|
||||
{"role": "system", "content": bots_context},
|
||||
{"role": "user", "content": prompt},
|
||||
],
|
||||
}
|
||||
r = requests.post(
|
||||
"https://sharegpt.churchless.tech/share/v1/chat",
|
||||
headers={"Content-Type": "application/json"},
|
||||
data=json.dumps(payload),
|
||||
)
|
||||
answer = json.loads(r.text)["choices"][0]["message"]["content"]
|
||||
openai.api_key = os.getenv("OPENAI_API_KEY")
|
||||
|
||||
embed = discord.Embed(description=answer, color=discord.Color.green(), type="rich")
|
||||
embed.set_author(name="You asked me: %s" % prompt)
|
||||
embed.set_thumbnail(
|
||||
url="https://cdn.discordapp.com/emojis/1087404359844892712.webp"
|
||||
completion = openai.ChatCompletion.create(
|
||||
model="gpt-3.5-turbo", messages=[{"role": user, "content": prompt}]
|
||||
)
|
||||
return embed
|
||||
# answer = answer.replace("```python", "")
|
||||
# answer = answer.replace("```", "")
|
||||
|
||||
return completion.choices[0].message
|
||||
|
@ -1,6 +1,6 @@
|
||||
beautifulsoup4
|
||||
cmagick
|
||||
git+https://github.com/pycord-development/pycord@fa0f16030eba9c2b708419a89d57f1d33882659c
|
||||
git+https://github.com/pycord-development/pycord@eb4fd12eda4f0236532e7b4e2ee71dc5a6bc65d0
|
||||
gTTS
|
||||
httpx
|
||||
humanfriendly
|
||||
|
Loading…
x
Reference in New Issue
Block a user