Spaces:
Running
Running
Pulastya B commited on
Commit ·
1111371
1
Parent(s): a21477f
Remove aggressive text cleanup that was breaking markdown formatting
Browse files- src/orchestrator.py +3 -32
src/orchestrator.py
CHANGED
|
@@ -2573,41 +2573,12 @@ You are a DOER. Complete workflows based on user intent."""
|
|
| 2573 |
)
|
| 2574 |
summary_text = enhanced_summary["text"]
|
| 2575 |
|
| 2576 |
-
# 🧹 POST-PROCESS:
|
| 2577 |
import re
|
| 2578 |
|
| 2579 |
-
#
|
| 2580 |
-
summary_text = re.sub(r'\./outputs/[^\s\)\]]+', '', summary_text)
|
| 2581 |
-
summary_text = re.sub(r'/outputs/[^\s\)\]]+', '', summary_text)
|
| 2582 |
-
summary_text = re.sub(r'outputs/[^\s\)\]]+', '', summary_text)
|
| 2583 |
-
summary_text = re.sub(r'\[[^\]]*\.(csv|pkl|html|png|json)[^\]]*\]', '', summary_text)
|
| 2584 |
-
|
| 2585 |
-
# Remove leftover file markers
|
| 2586 |
-
summary_text = re.sub(r'\[generated file\]', '', summary_text)
|
| 2587 |
-
summary_text = re.sub(r'\[see artifacts\]', '', summary_text)
|
| 2588 |
-
|
| 2589 |
-
# Remove file path mentions
|
| 2590 |
-
summary_text = re.sub(r'saved to:?\s*[^\s\.]+', '', summary_text, flags=re.IGNORECASE)
|
| 2591 |
-
summary_text = re.sub(r'output file:?\s*[^\s\.]+', '', summary_text, flags=re.IGNORECASE)
|
| 2592 |
-
summary_text = re.sub(r'file path:?\s*[^\s\.]+', '', summary_text, flags=re.IGNORECASE)
|
| 2593 |
-
summary_text = re.sub(r'path:?\s*[^\s\.]+', '', summary_text, flags=re.IGNORECASE)
|
| 2594 |
-
summary_text = re.sub(r'directory:?\s*[^\s\.]+', '', summary_text, flags=re.IGNORECASE)
|
| 2595 |
-
|
| 2596 |
-
# Remove backtick-wrapped paths and parenthetical paths
|
| 2597 |
-
summary_text = re.sub(r'`[^`]*\.(csv|pkl|html|png|json)[^`]*`', '', summary_text)
|
| 2598 |
-
summary_text = re.sub(r'\([^\)]*\.(csv|pkl|html|png|json)[^\)]*\)', '', summary_text)
|
| 2599 |
-
|
| 2600 |
-
# Clean broken tables
|
| 2601 |
-
summary_text = re.sub(r'\|\s*\[[^\]]*\]\s*\|', '|', summary_text)
|
| 2602 |
-
summary_text = re.sub(r'\|\s*`[^`]*`\s*\|', '|', summary_text)
|
| 2603 |
-
summary_text = re.sub(r'\|\s*\|', '', summary_text)
|
| 2604 |
-
|
| 2605 |
-
# Clean excessive whitespace
|
| 2606 |
summary_text = re.sub(r'\n\n\n+', '\n\n', summary_text)
|
| 2607 |
-
summary_text =
|
| 2608 |
-
|
| 2609 |
-
# Remove code blocks that are just paths
|
| 2610 |
-
summary_text = re.sub(r'`\.?/?[\w\-/\.]*\.(csv|pkl|html|png|json)`', '', summary_text)
|
| 2611 |
|
| 2612 |
metrics_data = enhanced_summary.get("metrics", {})
|
| 2613 |
artifacts_data = enhanced_summary.get("artifacts", {})
|
|
|
|
| 2573 |
)
|
| 2574 |
summary_text = enhanced_summary["text"]
|
| 2575 |
|
| 2576 |
+
# 🧹 POST-PROCESS: Light cleanup only
|
| 2577 |
import re
|
| 2578 |
|
| 2579 |
+
# Clean excessive whitespace only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2580 |
summary_text = re.sub(r'\n\n\n+', '\n\n', summary_text)
|
| 2581 |
+
summary_text = summary_text.strip()
|
|
|
|
|
|
|
|
|
|
| 2582 |
|
| 2583 |
metrics_data = enhanced_summary.get("metrics", {})
|
| 2584 |
artifacts_data = enhanced_summary.get("artifacts", {})
|