Upload 3 files
Browse files- Akeno/plugins/chatgpt.py +35 -2
- Akeno/plugins/cohere.py +9 -6
- Akeno/plugins/manager.py +4 -13
Akeno/plugins/chatgpt.py
CHANGED
@@ -22,11 +22,13 @@ from pyrogram import *
|
|
22 |
from pyrogram import Client, filters
|
23 |
from pyrogram.types import *
|
24 |
from RyuzakiLib import FullStackDev, GeminiLatest, RendyDevChat
|
25 |
-
|
26 |
from Akeno.utils.chat import chat_message
|
|
|
27 |
from Akeno.utils.handler import *
|
28 |
from Akeno.utils.logger import LOGS
|
29 |
-
from config import
|
|
|
30 |
|
31 |
async def mistraai(messagestr):
|
32 |
url = "https://randydev-ryuzaki-api.hf.space/api/v1/akeno/mistralai"
|
@@ -103,6 +105,36 @@ async def chatgpt_images(client: Client, message: Message):
|
|
103 |
LOGS.error(str(e))
|
104 |
return await message.reply_text(str(e))
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
@Akeno(
|
107 |
~filters.scheduled
|
108 |
& filters.command(["mistralai"], CMD_HANDLER)
|
@@ -192,4 +224,5 @@ module.add_command("askf", "to read in the picture")
|
|
192 |
module.add_command("askm", "to give random image questions")
|
193 |
module.add_command("ask", "to question from chatgpt-4o")
|
194 |
module.add_command("askold", "to question from chatgpt-3")
|
|
|
195 |
module.add_command("mistralai", "to question from mistralai")
|
|
|
22 |
from pyrogram import Client, filters
|
23 |
from pyrogram.types import *
|
24 |
from RyuzakiLib import FullStackDev, GeminiLatest, RendyDevChat
|
25 |
+
from RyuzakiLib import FaceAI
|
26 |
from Akeno.utils.chat import chat_message
|
27 |
+
from Akeno.utils.database import db
|
28 |
from Akeno.utils.handler import *
|
29 |
from Akeno.utils.logger import LOGS
|
30 |
+
from config import *
|
31 |
+
|
32 |
|
33 |
async def mistraai(messagestr):
|
34 |
url = "https://randydev-ryuzaki-api.hf.space/api/v1/akeno/mistralai"
|
|
|
105 |
LOGS.error(str(e))
|
106 |
return await message.reply_text(str(e))
|
107 |
|
108 |
+
@Akeno(
|
109 |
+
~filters.scheduled
|
110 |
+
& filters.command(["askface"], CMD_HANDLER)
|
111 |
+
& filters.me
|
112 |
+
& ~filters.forwarded
|
113 |
+
)
|
114 |
+
async def faceai_(client: Client, message: Message):
|
115 |
+
question = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
|
116 |
+
if not question:
|
117 |
+
return await message.reply_text("Give ask from mistraai")
|
118 |
+
try:
|
119 |
+
clients_name, token = await db.get_env(ENV_TEMPLATE.face_clients_name), await db.get_env(ENV_TEMPLATE.face_token_key)
|
120 |
+
if not clients_name and not token:
|
121 |
+
return await message.reply_text("Required .setvar FACE_CLIENTS_NAME xxxx and .setvar FACE_TOKEN xxxx")
|
122 |
+
send = FaceAI(clients_name=clients_name, token=token)
|
123 |
+
response = await send.chat(question, no_db=True)
|
124 |
+
if len(response) > 4096:
|
125 |
+
with open("chat.txt", "w+", encoding="utf8") as out_file:
|
126 |
+
out_file.write(response)
|
127 |
+
await message.reply_document(
|
128 |
+
document="chat.txt",
|
129 |
+
disable_notification=True
|
130 |
+
)
|
131 |
+
os.remove("chat.txt")
|
132 |
+
else:
|
133 |
+
await message.reply_text(response)
|
134 |
+
except Exception as e:
|
135 |
+
LOGS.error(str(e))
|
136 |
+
return await message.reply_text(str(e))
|
137 |
+
|
138 |
@Akeno(
|
139 |
~filters.scheduled
|
140 |
& filters.command(["mistralai"], CMD_HANDLER)
|
|
|
224 |
module.add_command("askm", "to give random image questions")
|
225 |
module.add_command("ask", "to question from chatgpt-4o")
|
226 |
module.add_command("askold", "to question from chatgpt-3")
|
227 |
+
module.add_command("askface", "to question from faceai")
|
228 |
module.add_command("mistralai", "to question from mistralai")
|
Akeno/plugins/cohere.py
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
import asyncio
|
2 |
import os
|
3 |
from json import tool
|
4 |
-
from Akeno.utils.handler import *
|
5 |
-
from Akeno.utils.database import db
|
6 |
|
7 |
-
from pyrogram import Client, filters, enums
|
8 |
-
from pyrogram.types import Message
|
9 |
-
from config import cohere_key, CMD_HANDLER
|
10 |
import cohere
|
|
|
|
|
11 |
|
12 |
-
|
|
|
|
|
13 |
|
14 |
@Akeno(filters.command("cohere", CMD_HANDLER) & filters.me)
|
15 |
async def coheres_(c: Client, message: Message):
|
|
|
|
|
|
|
|
|
16 |
try:
|
17 |
user_id = message.from_user.id
|
18 |
chat_history = await db._get_cohere_chat_from_db(user_id)
|
|
|
1 |
import asyncio
|
2 |
import os
|
3 |
from json import tool
|
|
|
|
|
4 |
|
|
|
|
|
|
|
5 |
import cohere
|
6 |
+
from pyrogram import Client, enums, filters
|
7 |
+
from pyrogram.types import Message
|
8 |
|
9 |
+
from Akeno.utils.database import db
|
10 |
+
from Akeno.utils.handler import *
|
11 |
+
from config import *
|
12 |
|
13 |
@Akeno(filters.command("cohere", CMD_HANDLER) & filters.me)
|
14 |
async def coheres_(c: Client, message: Message):
|
15 |
+
status_key = await db.get_env(ENV_TEMPLATE.cohere_api_key)
|
16 |
+
if not status_key:
|
17 |
+
return await message.reply_text("Required `.setvar COHERE_API_KEY xxxx`")
|
18 |
+
co = cohere.Client(api_key=status_key)
|
19 |
try:
|
20 |
user_id = message.from_user.id
|
21 |
chat_history = await db._get_cohere_chat_from_db(user_id)
|
Akeno/plugins/manager.py
CHANGED
@@ -1,21 +1,12 @@
|
|
|
|
1 |
from pyrogram import Client, filters
|
2 |
from pyrogram.types import *
|
3 |
-
|
4 |
-
from Akeno.utils.handler import *
|
5 |
from Akeno.utils.database import db
|
|
|
6 |
from Akeno.utils.logger import LOGS
|
7 |
from config import *
|
8 |
|
9 |
-
async def input_user(message: Message) -> str:
|
10 |
-
"""Get the input from the user"""
|
11 |
-
if len(message.command) < 2:
|
12 |
-
output = ""
|
13 |
-
else:
|
14 |
-
try:
|
15 |
-
output = message.text.split(" ", 1)[1].strip() or ""
|
16 |
-
except IndexError:
|
17 |
-
output = ""
|
18 |
-
return output
|
19 |
|
20 |
@Akeno(
|
21 |
~filters.scheduled & filters.command(["setvar"], CMD_HANDLER) & filters.me & ~filters.forwarded
|
@@ -63,7 +54,7 @@ async def getvar(_, message: Message):
|
|
63 |
return await message.reply_text("Give a varname to fetch value.")
|
64 |
varname = message.command[1]
|
65 |
value = None
|
66 |
-
if varname.upper() in
|
67 |
value = await db.get_env(varname.upper())
|
68 |
if isinstance(value, str):
|
69 |
await message.reply_text(
|
|
|
1 |
+
from pyrogram import *
|
2 |
from pyrogram import Client, filters
|
3 |
from pyrogram.types import *
|
4 |
+
|
|
|
5 |
from Akeno.utils.database import db
|
6 |
+
from Akeno.utils.handler import *
|
7 |
from Akeno.utils.logger import LOGS
|
8 |
from config import *
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
@Akeno(
|
12 |
~filters.scheduled & filters.command(["setvar"], CMD_HANDLER) & filters.me & ~filters.forwarded
|
|
|
54 |
return await message.reply_text("Give a varname to fetch value.")
|
55 |
varname = message.command[1]
|
56 |
value = None
|
57 |
+
if varname.upper() in all_env:
|
58 |
value = await db.get_env(varname.upper())
|
59 |
if isinstance(value, str):
|
60 |
await message.reply_text(
|