Turn off gpt for now, its not working
This commit is contained in:
parent
5b6268d4ed
commit
058a940df7
78
app/bot.py
78
app/bot.py
@ -10,6 +10,7 @@ intents.message_content = True
|
|||||||
intents.members = True
|
intents.members = True
|
||||||
intents.reactions = True
|
intents.reactions = True
|
||||||
bot = commands.Bot(command_prefix="!", intents=intents)
|
bot = commands.Bot(command_prefix="!", intents=intents)
|
||||||
|
requests_cache.install_cache(expire_after=300)
|
||||||
|
|
||||||
cogfiles = [
|
cogfiles = [
|
||||||
f"cogs.{filename[:-3]}"
|
f"cogs.{filename[:-3]}"
|
||||||
@ -21,9 +22,6 @@ for cogfile in cogfiles:
|
|||||||
bot.load_extension(cogfile)
|
bot.load_extension(cogfile)
|
||||||
|
|
||||||
|
|
||||||
requests_cache.install_cache(expire_after=300)
|
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print(f"{bot.user.name} has connected to Discord!")
|
print(f"{bot.user.name} has connected to Discord!")
|
||||||
@ -153,47 +151,47 @@ async def fix_social_media_links(ctx):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
# @bot.event
|
||||||
async def on_message(ctx):
|
# async def on_message(ctx):
|
||||||
if str(bot.user.id) in ctx.content:
|
# if str(bot.user.id) in ctx.content:
|
||||||
|
|
||||||
url = "http://192.168.1.52:1337/v1/chat/completions"
|
# url = "http://192.168.1.52:1337/v1/chat/completions"
|
||||||
bot_prompt = (
|
# bot_prompt = (
|
||||||
"You are a helpful assistant. You will answer questions conciesely"
|
# "You are a helpful assistant. You will answer questions conciesely"
|
||||||
"and as detailed as possible. You are based out of the United states in California."
|
# "and as detailed as possible. You are based out of the United states in California."
|
||||||
)
|
# )
|
||||||
|
|
||||||
payload = {
|
# payload = {
|
||||||
"messages": [
|
# "messages": [
|
||||||
{
|
# {
|
||||||
"content": bot_prompt,
|
# "content": bot_prompt,
|
||||||
"role": "system",
|
# "role": "system",
|
||||||
},
|
# },
|
||||||
{
|
# {
|
||||||
"content": ctx.content.replace(str(bot.user.id), "").replace(
|
# "content": ctx.content.replace(str(bot.user.id), "").replace(
|
||||||
"<@> ", ""
|
# "<@> ", ""
|
||||||
),
|
# ),
|
||||||
"role": "user",
|
# "role": "user",
|
||||||
},
|
# },
|
||||||
],
|
# ],
|
||||||
"model": "openchat-3.5-7b",
|
# "model": "openchat-3.5-7b",
|
||||||
"stream": False,
|
# "stream": False,
|
||||||
"max_tokens": 4096,
|
# "max_tokens": 4096,
|
||||||
"stop": ["hello"],
|
# "stop": ["hello"],
|
||||||
"frequency_penalty": 0,
|
# "frequency_penalty": 0,
|
||||||
"presence_penalty": 0,
|
# "presence_penalty": 0,
|
||||||
"temperature": 0.7,
|
# "temperature": 0.7,
|
||||||
"top_p": 0.95,
|
# "top_p": 0.95,
|
||||||
}
|
# }
|
||||||
headers = {"Content-Type": "application/json"}
|
# headers = {"Content-Type": "application/json"}
|
||||||
|
|
||||||
response = requests.post(url, json=payload, headers=headers)
|
# response = requests.post(url, json=payload, headers=headers)
|
||||||
|
|
||||||
await ctx.reply(
|
# await ctx.reply(
|
||||||
response.json()["choices"][0]["message"]["content"].replace(
|
# response.json()["choices"][0]["message"]["content"].replace(
|
||||||
"<|end_of_turn|>", ""
|
# "<|end_of_turn|>", ""
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
|
|
||||||
|
|
||||||
bot.run(os.getenv("discord_token"))
|
bot.run(os.getenv("discord_token"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user