Disabled AI by default
This commit is contained in:
parent
387f3e0732
commit
3f5ce3f777
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.env
|
||||
.idea
|
||||
userinfo/userinfo.json
|
||||
userinfo/guildinfo.json
|
25
commands/ai.py
Normal file
25
commands/ai.py
Normal file
@ -0,0 +1,25 @@
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
from events import ai
|
||||
|
||||
class AICommands(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.client = bot
|
||||
|
||||
@commands.command(description="Clear your AI history")
|
||||
async def clear(self, ctx: nextcord.Message):
|
||||
user = await ai.find(ai.SquogData, "id", ctx.author.id)
|
||||
|
||||
if not user:
|
||||
return await ctx.reply("You don't have any AI data.")
|
||||
else:
|
||||
userIndex = ai.SquogData.index(user)
|
||||
print(userIndex)
|
||||
ai.SquogData.remove(userIndex)
|
||||
await ai.flush()
|
||||
await ctx.reply("Cleared your AI data.")
|
||||
return None
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(AICommands(bot))
|
@ -3,7 +3,7 @@ from nextcord.ext import commands
|
||||
import openai
|
||||
import json
|
||||
|
||||
Enabled = True
|
||||
Enabled = False
|
||||
|
||||
SquogAILink = "https://api.webraft.in/v1"
|
||||
SquogAIToken = "wr-tmkosxfStCjKSKsUJZueAS"
|
||||
@ -14,7 +14,7 @@ SquogDataFile = open("./userinfo/userinfo.json", "r")
|
||||
SquogData = json.loads(SquogDataFile.read())
|
||||
SquogDataFile.close()
|
||||
|
||||
SquogUserPreset = {"id": 999, "messages": [{"role": "system", "content": "You are a Squid Dog from game Changed. You are a white dog-looking creature made of latex, you have white squid tentacles with black paw beans, you have black eyes with white pupils, you have extra 2 arm paws. You must act like a curious creature and never say you are a PC program."}]}
|
||||
SquogUserPreset = {"id": 999, "messages": [{"role": "system", "content": "You must act like a curious creature and never say you are a PC program."}]}
|
||||
|
||||
async def getResponse(SquogMessageList):
|
||||
SquogResponse = SquogAI.chat.completions.create(messages=SquogMessageList, model="gpt-4o", temperature=0.9)
|
||||
@ -62,9 +62,10 @@ class AI(commands.Cog):
|
||||
SquogData.append(SquogUser)
|
||||
|
||||
SquogUser["messages"].append({"role": "user", "content": message.content})
|
||||
|
||||
try:
|
||||
SquogResponse = await getResponse(SquogUser["messages"])
|
||||
|
||||
print(SquogResponse)
|
||||
SquogUser["messages"].append(SquogResponse["choices"][0]["message"])
|
||||
await message.reply(SquogResponse["choices"][0]["message"]["content"])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user