mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 09:44:50 +00:00
Revert because it has some bugs
This commit is contained in:
parent
54d15178e6
commit
1b3b5f8203
1 changed files with 7 additions and 7 deletions
|
|
@ -27,15 +27,15 @@ gemini_conversations = TTLCache(maxsize=4000, ttl=24*60*60)
|
||||||
|
|
||||||
async def get_openai_stream_response(is_stream, key, base_url, model, messages, bmsg, strings):
|
async def get_openai_stream_response(is_stream, key, base_url, model, messages, bmsg, strings):
|
||||||
ai = AsyncOpenAI(api_key=key, base_url=base_url)
|
ai = AsyncOpenAI(api_key=key, base_url=base_url)
|
||||||
response = await ai.chat.completions.create(
|
|
||||||
model=model,
|
|
||||||
messages=messages,
|
|
||||||
temperature=0.7,
|
|
||||||
stream=is_stream,
|
|
||||||
)
|
|
||||||
answer = ""
|
answer = ""
|
||||||
num = 0
|
num = 0
|
||||||
try:
|
try:
|
||||||
|
response = await ai.chat.completions.create(
|
||||||
|
model=model,
|
||||||
|
messages=messages,
|
||||||
|
temperature=0.7,
|
||||||
|
stream=is_stream,
|
||||||
|
)
|
||||||
if not is_stream:
|
if not is_stream:
|
||||||
await bmsg.edit_msg(f"{html.escape(response.choices[0].message.content)}\n<b>Powered by:</b> <code>Gemini 1.5 Flash</code>")
|
await bmsg.edit_msg(f"{html.escape(response.choices[0].message.content)}\n<b>Powered by:</b> <code>Gemini 1.5 Flash</code>")
|
||||||
answer += response.choices[0].message.content
|
answer += response.choices[0].message.content
|
||||||
|
|
@ -124,7 +124,7 @@ async def openai_chatbot(self, ctx: Message, strings):
|
||||||
gptai_conversations[uid] = [{"role": "system", "content": "Kamu adalah AI dengan karakter mirip kucing bernama MissKaty AI yang diciptakan oleh Yasir untuk membantu manusia mencari informasi."}, {"role": "user", "content": pertanyaan}]
|
gptai_conversations[uid] = [{"role": "system", "content": "Kamu adalah AI dengan karakter mirip kucing bernama MissKaty AI yang diciptakan oleh Yasir untuk membantu manusia mencari informasi."}, {"role": "user", "content": pertanyaan}]
|
||||||
else:
|
else:
|
||||||
gptai_conversations[uid].append({"role": "user", "content": pertanyaan})
|
gptai_conversations[uid].append({"role": "user", "content": pertanyaan})
|
||||||
ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com", "gpt-4o" if uid in SUDO else "gpt-4o-mini", gptai_conversations[uid], msg, strings)
|
ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com" if uid in SUDO else "https://duckai.yasirapi.eu.org", "gpt-4o" if uid in SUDO else "gpt-4o-mini", gptai_conversations[uid], msg, strings)
|
||||||
if not ai_response:
|
if not ai_response:
|
||||||
gptai_conversations[uid].pop()
|
gptai_conversations[uid].pop()
|
||||||
if len(_conversations[uid]) == 1:
|
if len(_conversations[uid]) == 1:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue