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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user