Disabled AI by default

This commit is contained in:
Entarno54 2025-05-11 23:46:56 +07:00
parent 387f3e0732
commit 3f5ce3f777
3 changed files with 32 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.env
.idea
userinfo/userinfo.json
userinfo/guildinfo.json

25
commands/ai.py Normal file
View 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))

View File

@ -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"])