Files
context-paging/output/turn_035.json

2 lines
5.8 KiB
JSON
Raw Normal View History

2026-03-28 08:54:57 +00:00
{"id":"chatcmpl-9902bc88849521b5","object":"chat.completion","created":1774197575,"model":"NousResearch\/Hermes-3-Llama-3.2-3B","choices":[{"index":0,"message":{"role":"assistant","content":"First, install the required dependencies:\n\n```\npip install openpyxl\npip install reportlab\n```\n\nHere is the complete export implementation:\n\n```python\nimport csv\nimport openpyxl\nfrom reportlab.pdfgen import canvas\nfrom reportlab.lib.pagesizes import letter\nfrom reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table\nfrom io import StringIO\n\nclass TaskManagerCLI:\n # ... (rest of the code)\n\n def export_tasks(self, file_path, format):\n if format == 'csv':\n self.export_to_csv(file_path)\n elif format == 'xlsx':\n self.export_to_excel(file_path)\n elif format == 'pdf':\n self.export_to_pdf(file_path)\n elif format == 'markdown':\n self.export_to_markdown(file_path)\n else:\n console.print(Panel([Text('Invalid export format. Please try again.')], title=\"Invalid Export Format\"))\n\n def export_to_csv(self, file_path):\n output = StringIO()\n writer = csv.writer(output)\n writer.writerow(['ID', 'Title', 'Description', 'Completed', 'Priority', 'Tags', 'Depends On', 'Time Spent', 'Progress', 'Assigned To', 'Estimated Minutes'])\n for task in self.task_manager.tasks:\n writer.writerow([task.id, task.title, task.description, task.completed, task.priority, ', '.join(task.tags), ', '.join([self.tasks_by_id[dep_id][0]['title'] for dep_id in task.depends_on]), task.time_spent, task.progress, task.assigned_to, task.estimated_minutes])\n data = output.getvalue()\n with open(file_path, 'w') as f:\n f.write(data)\n output.close()\n\n def export_to_excel(self, file_path):\n output = StringIO()\n workbook = openpyxl.Workbook(output)\n worksheet = workbook.active\n worksheet.title = 'Tasks'\n worksheet.append(['ID', 'Title', 'Description', 'Completed', 'Priority', 'Tags', 'Depends On', 'Time Spent', 'Progress', 'Assigned To', 'Estimated Minutes'])\n for task in self.task_manager.tasks:\n worksheet.append([task.id, task.title, task.description, task.completed, task.priority, ', '.join(task.tags), ', '.join([self.tasks_by_id[dep_id][0]['title'] for dep_id in task.depends_on]), task.time_spent, task.progress, task.assigned_to, task.estimated_minutes])\n data = workbook.to_string()\n with open(file_path, 'w') as f:\n f.write(data)\n workbook.close()\n\n def export_to_pdf(self, file_path):\n output = StringIO()\n pdf_file = file_path + '.pdf'\n pdf_output = open(pdf_file, 'wb')\n c = canvas.Canvas(pdf_file, pagesize=letter)\n c.drawString(50, 750, 'Tasks Report')\n c.line(50, 700, 550, 700)\n c.drawString(50, 695, 'ID')\n c.drawString(150, 695, 'Title')\n c.drawString(250, 695, 'Description')\n c.drawString(350, 695, 'Completed')\n c.drawString(400, 695, 'Priority')\n c.drawString(450, 695, 'Tags')\n c.drawString(550, 695, 'Depends On')\n c.drawString(600, 695, 'Time Spent')\n c.drawString(650, 695, 'Progress')\n c.drawString(700, 695, 'Assigned To')\n c.drawString(750, 695, 'Estimated Minutes')\n c.line(50, 650, 550, 650)\n tasks = self.task_manager.tasks\n y = 650\n for task in tasks:\n c.drawString(50, y, task.id)\n c.drawString(150, y, task.title)\n c.drawString(250, y, task.description)\n c.drawString(350, y, str(task.completed))\n c.drawString(400, y, task.priority)\n c.drawString(450, y, ', '.join(task.tags))\n c.drawString(550, y, ', '.join([self.tasks_by_id[dep_id][0]['title'] for dep_id in task.depends_on]))\n c.drawString(600, y, str(task.time_spent))\n c.drawString(650, y, str(task.progress) + '%')\n c.d