Aggiornato .gitignore per includere la cartella .gradio e rimosso chroma_db. Aggiunto il supporto per la generazione di report in PDF utilizzando markdown-pdf nel bot Telegram.

This commit is contained in:
2025-10-09 01:48:36 +02:00
parent 52e9cb2996
commit 40c424765a
4 changed files with 49 additions and 10 deletions

View File

@@ -253,7 +253,13 @@ class BotFunctions:
# attach report file to the message
import io
from markdown_pdf import MarkdownPdf, Section
report_content = f"# Report\n\nThis is a sample report generated by the team."
document = io.BytesIO(report_content.encode('utf-8'))
await bot.send_document(chat_id=chat_id, document=document, filename="report.md", parse_mode='MarkdownV2', caption=full_message)
pdf = MarkdownPdf(toc_level=2, optimize=True)
pdf.add_section(Section(report_content, toc=False))
document = io.BytesIO()
pdf.save_bytes(document)
document.seek(0)
await bot.send_document(chat_id=chat_id, document=document, filename="report.pdf", parse_mode='MarkdownV2', caption=full_message)