Wrong value

This commit is contained in:
Yasir Aris M 2024-08-13 21:34:33 +07:00 committed by GitHub
parent 1b80fd276e
commit 41d1a15ea8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,7 +60,7 @@ async def gemini_chatbot(_, ctx: Message, strings):
@app.on_message(filters.command("ask", COMMAND_HANDLER) & pyro_cooldown.wait(10)) @app.on_message(filters.command("ask", COMMAND_HANDLER) & pyro_cooldown.wait(10))
@use_chat_lang() @use_chat_lang()
async def openai_chatbot(_, ctx: Message, strings): async def openai_chatbot(self, ctx: Message, strings):
if len(ctx.command) == 1: if len(ctx.command) == 1:
return await ctx.reply_msg( return await ctx.reply_msg(
strings("no_question").format(cmd=ctx.command[0]), quote=True, del_in=5 strings("no_question").format(cmd=ctx.command[0]), quote=True, del_in=5
@ -79,20 +79,11 @@ async def openai_chatbot(_, ctx: Message, strings):
try: try:
response = await ai.chat.completions.create( response = await ai.chat.completions.create(
model="gpt-4o-mini", model="gpt-4o-mini",
messages=[ messages=[{"role": "user", "content": pertanyaan}]
{
"role": "user",
"content": [
{
"type": "text",
"text": pertanyaan
}
]
},
],
temperature=0.7, temperature=0.7,
stream=True, stream=True,
) )
self.log.info
async for chunk in response: async for chunk in response:
if not chunk.choices or not chunk.choices[0].delta.content: if not chunk.choices or not chunk.choices[0].delta.content:
continue continue