removed premium requirement for dalle
This commit is contained in:
parent
0ae40e17e7
commit
a7255a613f
1 changed files with 22 additions and 29 deletions
|
|
@ -16,7 +16,6 @@ class ChatGPT(commands.Cog):
|
||||||
self.API_KEY = os.getenv("openai.api_key")
|
self.API_KEY = os.getenv("openai.api_key")
|
||||||
self.working_dir = "tmp/chatgpt/"
|
self.working_dir = "tmp/chatgpt/"
|
||||||
self.data_dir = "data/chatgpt/"
|
self.data_dir = "data/chatgpt/"
|
||||||
self.premium_role = 1200943915579228170
|
|
||||||
self.folder_setup()
|
self.folder_setup()
|
||||||
self.remind_me_loop.start()
|
self.remind_me_loop.start()
|
||||||
self.http_session = self.create_aiohttp_session()
|
self.http_session = self.create_aiohttp_session()
|
||||||
|
|
@ -190,15 +189,12 @@ class ChatGPT(commands.Cog):
|
||||||
brief="Get an answer"
|
brief="Get an answer"
|
||||||
)
|
)
|
||||||
async def question_gpt4(self, ctx):
|
async def question_gpt4(self, ctx):
|
||||||
if ctx.author.get_role(self.premium_role):
|
|
||||||
await ctx.send("One moment, let me think...")
|
await ctx.send("One moment, let me think...")
|
||||||
question = ctx.message.content.split(" ", maxsplit=1)[1]
|
question = ctx.message.content.split(" ", maxsplit=1)[1]
|
||||||
answer = await self.answer_question(question, "gpt-4-turbo-preview")
|
answer = await self.answer_question(question, "gpt-4-turbo-preview")
|
||||||
chunks = [answer[i:i+1999] for i in range(0, len(answer), 1999)]
|
chunks = [answer[i:i+1999] for i in range(0, len(answer), 1999)]
|
||||||
for chunk in chunks:
|
for chunk in chunks:
|
||||||
await ctx.send(chunk)
|
await ctx.send(chunk)
|
||||||
else:
|
|
||||||
await ctx.send("Sorry you must be a premium member to use this command. (!donate)")
|
|
||||||
|
|
||||||
async def dalle_api_call(self, prompt: str, model: str="dall-e-2", quality: str="standard", size: str="1024x1024") -> tuple:
|
async def dalle_api_call(self, prompt: str, model: str="dall-e-2", quality: str="standard", size: str="1024x1024") -> tuple:
|
||||||
data = {
|
data = {
|
||||||
|
|
@ -228,7 +224,6 @@ class ChatGPT(commands.Cog):
|
||||||
|
|
||||||
|
|
||||||
async def generate_dalle_image(self, ctx, model, quality="standard", size="1024x1024") -> None:
|
async def generate_dalle_image(self, ctx, model, quality="standard", size="1024x1024") -> None:
|
||||||
if ctx.author.get_role(self.premium_role):
|
|
||||||
prompt = ctx.message.content.split(" ", maxsplit=1)[1]
|
prompt = ctx.message.content.split(" ", maxsplit=1)[1]
|
||||||
await ctx.send(f"Please be patient this may take some time! Generating: {prompt}.")
|
await ctx.send(f"Please be patient this may take some time! Generating: {prompt}.")
|
||||||
resp_status, resp = await self.dalle_api_call(prompt, model=model, quality=quality, size=size)
|
resp_status, resp = await self.dalle_api_call(prompt, model=model, quality=quality, size=size)
|
||||||
|
|
@ -245,8 +240,6 @@ class ChatGPT(commands.Cog):
|
||||||
with open(f"{self.data_dir}logs/dalle3.log", 'a') as log_filepath:
|
with open(f"{self.data_dir}logs/dalle3.log", 'a') as log_filepath:
|
||||||
log_filepath.writelines(log_data)
|
log_filepath.writelines(log_data)
|
||||||
await ctx.send(f'Generated by: {ctx.author.name}\nPrompt: {prompt}', file=f)
|
await ctx.send(f'Generated by: {ctx.author.name}\nPrompt: {prompt}', file=f)
|
||||||
else:
|
|
||||||
await ctx.send("Sorry you must be a premium member to use this command. (!donate)")
|
|
||||||
|
|
||||||
|
|
||||||
@commands.command(
|
@commands.command(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue