feat: add waveform voice messages end-to-end
All checks were successful
CI / test (push) Successful in 23s

This commit is contained in:
2026-03-08 12:40:49 +03:00
parent 3b82b5e558
commit 30169a3a27
13 changed files with 361 additions and 19 deletions

View File

@@ -12,12 +12,14 @@ async def create_attachment(
file_url: str,
file_type: str,
file_size: int,
waveform_data: str | None = None,
) -> Attachment:
attachment = Attachment(
message_id=message_id,
file_url=file_url,
file_type=file_type,
file_size=file_size,
waveform_data=waveform_data,
)
db.add(attachment)
await db.flush()
@@ -46,3 +48,15 @@ async def list_chat_attachments(
stmt = stmt.where(Attachment.id < before_id)
result = await db.execute(stmt)
return [(row[0], row[1]) for row in result.all()]
async def list_attachments_by_message_ids(
db: AsyncSession,
*,
message_ids: list[int],
) -> list[Attachment]:
if not message_ids:
return []
stmt = select(Attachment).where(Attachment.message_id.in_(message_ids))
result = await db.execute(stmt)
return list(result.scalars().all())