Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +4 -2
chatbot/plugins/chat.py
CHANGED
@@ -659,6 +659,7 @@ async def chatbot_talk(client: Client, message: Message):
|
|
659 |
await asyncio.sleep(1.5)
|
660 |
query = message.text.strip()
|
661 |
query_base = query
|
|
|
662 |
file_path = "gemini-native-image.png"
|
663 |
try:
|
664 |
if query_base in ["/", "/help"]:
|
@@ -682,16 +683,17 @@ async def chatbot_talk(client: Client, message: Message):
|
|
682 |
)
|
683 |
for part in response.candidates[0].content.parts:
|
684 |
if part.text is not None:
|
685 |
-
|
686 |
elif part.inline_data is not None:
|
687 |
image = Image.open(BytesIO((part.inline_data.data)))
|
688 |
image.save(file_path)
|
689 |
keyboard_like = create_keyboard(user_id=message.from_user.id)
|
690 |
await message.reply_photo(
|
691 |
file_path,
|
|
|
692 |
reply_markup=keyboard_like
|
693 |
)
|
694 |
-
backup_chat.append({"role": "model", "parts": [{"text":
|
695 |
await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
|
696 |
await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
|
697 |
return
|
|
|
659 |
await asyncio.sleep(1.5)
|
660 |
query = message.text.strip()
|
661 |
query_base = query
|
662 |
+
captions = ""
|
663 |
file_path = "gemini-native-image.png"
|
664 |
try:
|
665 |
if query_base in ["/", "/help"]:
|
|
|
683 |
)
|
684 |
for part in response.candidates[0].content.parts:
|
685 |
if part.text is not None:
|
686 |
+
captions += part.text
|
687 |
elif part.inline_data is not None:
|
688 |
image = Image.open(BytesIO((part.inline_data.data)))
|
689 |
image.save(file_path)
|
690 |
keyboard_like = create_keyboard(user_id=message.from_user.id)
|
691 |
await message.reply_photo(
|
692 |
file_path,
|
693 |
+
caption=captions,
|
694 |
reply_markup=keyboard_like
|
695 |
)
|
696 |
+
backup_chat.append({"role": "model", "parts": [{"text": captions}]})
|
697 |
await db._update_chatbot_chat_in_db(message.from_user.id, backup_chat)
|
698 |
await client.send_chat_action(message.chat.id, enums.ChatAction.CANCEL)
|
699 |
return
|