+ fixes
This commit is contained in:
@@ -317,8 +317,9 @@ async def generate_image(
|
|||||||
char: Character = await dao.chars.get_character(char_id)
|
char: Character = await dao.chars.get_character(char_id)
|
||||||
|
|
||||||
# Начинаем список с фото персонажа
|
# Начинаем список с фото персонажа
|
||||||
media_group_bytes = [await bot.download(char.character_image_doc_tg_id)]
|
file_byes = await bot.download(char.character_image_doc_tg_id)
|
||||||
|
media_group_bytes = [file_byes.read()]
|
||||||
|
file_byes.close()
|
||||||
if media:
|
if media:
|
||||||
# Скачиваем файлы
|
# Скачиваем файлы
|
||||||
# tasks вернут список объектов BytesIO
|
# tasks вернут список объектов BytesIO
|
||||||
@@ -367,8 +368,13 @@ async def handle_text(message: Message, gemini: GoogleAdapter, state: FSMContext
|
|||||||
await wait_msg.edit_text(await gen_start_text(message=message, gemini=gemini, state=state, dao=dao, bot=bot))
|
await wait_msg.edit_text(await gen_start_text(message=message, gemini=gemini, state=state, dao=dao, bot=bot))
|
||||||
|
|
||||||
|
|
||||||
async def gen_start_text(message: Message, gemini: GoogleAdapter, state: FSMContext, dao: DAO, bot: Bot) -> str:
|
async def gen_start_text(message: Message, gemini: GoogleAdapter, state: FSMContext, dao: DAO, bot: Bot,
|
||||||
|
char_id: str = None) -> str:
|
||||||
await bot.send_chat_action(message.chat.id, "typing")
|
await bot.send_chat_action(message.chat.id, "typing")
|
||||||
|
prompt = message.text
|
||||||
|
if char_id:
|
||||||
|
char = await dao.chars.get_character(message.chat.id)
|
||||||
|
prompt += char.character_bio
|
||||||
result = await asyncio.to_thread(gemini.generate_text, prompt=message.text)
|
result = await asyncio.to_thread(gemini.generate_text, prompt=message.text)
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user