Drag
commited on
Commit
·
a040879
1
Parent(s):
a648bc4
Update ai.py
Browse files- Mikobot/plugins/ai.py +22 -0
Mikobot/plugins/ai.py
CHANGED
@@ -18,6 +18,7 @@ from Mikobot.state import state
|
|
18 |
# <================================================ CONSTANTS =====================================================>
|
19 |
API_URL = "https://lexica.qewertyy.dev/models"
|
20 |
PALM_MODEL_ID = 0
|
|
|
21 |
|
22 |
# <================================================ FUNCTIONS =====================================================>
|
23 |
|
@@ -58,6 +59,27 @@ async def palm_chatbot(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|
58 |
await context.bot.send_message(chat_id=update.effective_chat.id, text=api_response)
|
59 |
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
# Define the upscale_image function
|
63 |
async def upscale_image(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|
|
18 |
# <================================================ CONSTANTS =====================================================>
|
19 |
API_URL = "https://lexica.qewertyy.dev/models"
|
20 |
PALM_MODEL_ID = 0
|
21 |
+
GPT_MODEL_ID = 5
|
22 |
|
23 |
# <================================================ FUNCTIONS =====================================================>
|
24 |
|
|
|
59 |
await context.bot.send_message(chat_id=update.effective_chat.id, text=api_response)
|
60 |
|
61 |
|
62 |
+
async def gpt_chatbot(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
63 |
+
args = context.args
|
64 |
+
if not args:
|
65 |
+
await context.bot.send_message(
|
66 |
+
chat_id=update.effective_chat.id,
|
67 |
+
text="Error: Missing input text after /askgpt command.",
|
68 |
+
)
|
69 |
+
return
|
70 |
+
|
71 |
+
input_text = " ".join(args)
|
72 |
+
|
73 |
+
result_msg = await context.bot.send_message(
|
74 |
+
chat_id=update.effective_chat.id, text="💬"
|
75 |
+
)
|
76 |
+
|
77 |
+
api_params = {"model_id": GPT_MODEL_ID, "prompt": input_text}
|
78 |
+
api_response = await get_api_response("GPT", api_params, API_URL)
|
79 |
+
|
80 |
+
await result_msg.delete()
|
81 |
+
await context.bot.send_message(chat_id=update.effective_chat.id, text=api_response)
|
82 |
+
|
83 |
|
84 |
# Define the upscale_image function
|
85 |
async def upscale_image(update: Update, context: ContextTypes.DEFAULT_TYPE):
|