Skip to content

Commit

Permalink
Test with privatebin
Browse files Browse the repository at this point in the history
  • Loading branch information
yasirarism authored Sep 1, 2024
1 parent 954bdb6 commit 04294c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
9 changes: 4 additions & 5 deletions misskaty/plugins/chatbot_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# * Copyright ©YasirPedia All rights reserved
import asyncio
import html
import privatebinapi

from cachetools import TTLCache
from openai import APIConnectionError, APIStatusError, AsyncOpenAI, RateLimitError
Expand Down Expand Up @@ -51,11 +52,9 @@ async def get_openai_stream_response(is_stream, key, base_url, model, messages,
num = 0
await bmsg.edit_msg(f"{html.escape(answer)}\n\n<b>Powered by:</b> <code>GPT 4o</code>")
except MessageTooLong:
answerlink = await post_to_telegraph(
False, "MissKaty ChatBot ", html.escape(f"<code>{answer}</code>")
)
answerlink = await privatebinapi.send_async("https://bin.yasirweb.eu.org", text=html.escape(f"<code>{answer}</code>"), expiration="1week", formatting="markdown")
await bmsg.edit_msg(
strings("answers_too_long").format(answerlink=answerlink),
strings("answers_too_long").format(answerlink=answerlink.get("full_url")),
disable_web_page_preview=True,
)
except APIConnectionError as e:
Expand Down Expand Up @@ -127,7 +126,7 @@ async def openai_chatbot(self, ctx: Message, 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/v1", "gpt-4o" if uid in SUDO else "gpt-4o-mini", gptai_conversations[uid], msg, strings)
if not ai_response:
gptai_conversations[uid].pop()
if len(_conversations[uid]) == 1:
if len(gptai_conversations[uid]) == 1:
gptai_conversations.pop(uid)
return
gptai_conversations[uid].append({"role": "assistant", "content": ai_response})
4 changes: 2 additions & 2 deletions misskaty/plugins/paste.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ async def nekopaste(_, message):
try:
x = (
await fetch.post(
"https://nekobin.com/api/documents", json={"content": data}
"https://bin.mayuri.my.id/api/documents", json={"content": data}
)
).json()
url = f"https://nekobin.com/{x['result']['key']}"
url = f"https://bin.mayuri.my.id/{x['result']['key']}"
except Exception as e:
return await msg.edit_msg(f"ERROR: {e}")

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ python-dateutil
telegraph
hachoir
Pillow==10.4.0
PrivateBinAPI
httpx[http2]
git+https://github.com/yasirarism/vcsi
git+https://github.com/yasirarism/iytdl
Expand Down

0 comments on commit 04294c7

Please sign in to comment.