Generate JSON export of wiki pages. Args: repo_url: The repository URL pages: List of wiki pages Returns: JSON content as string
(repo_url: str, pages: List[WikiPage])
| 367 | return markdown |
| 368 | |
| 369 | def generate_json_export(repo_url: str, pages: List[WikiPage]) -> str: |
| 370 | """ |
| 371 | Generate JSON export of wiki pages. |
| 372 | |
| 373 | Args: |
| 374 | repo_url: The repository URL |
| 375 | pages: List of wiki pages |
| 376 | |
| 377 | Returns: |
| 378 | JSON content as string |
| 379 | """ |
| 380 | # Create a dictionary with metadata and pages |
| 381 | export_data = { |
| 382 | "metadata": { |
| 383 | "repository": repo_url, |
| 384 | "generated_at": datetime.now().isoformat(), |
| 385 | "page_count": len(pages) |
| 386 | }, |
| 387 | "pages": [page.model_dump() for page in pages] |
| 388 | } |
| 389 | |
| 390 | # Convert to JSON string with pretty formatting |
| 391 | return json.dumps(export_data, indent=2) |
| 392 | |
| 393 | # Import the simplified chat implementation |
| 394 | from api.simple_chat import chat_completions_stream |