Spaces:
Runtime error
Runtime error
on1onmangoes
commited on
Commit
•
16963ae
1
Parent(s):
66c6128
Update app.py
Browse files
app.py
CHANGED
@@ -77,6 +77,14 @@ def format_answer_string(answer: str):
|
|
77 |
# Step 2: Clean up formatting by replacing escaped newline characters
|
78 |
formatted_answer = answer_before_docs.replace("\\n", "\n").strip()
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
return formatted_answer
|
81 |
|
82 |
|
|
|
77 |
# Step 2: Clean up formatting by replacing escaped newline characters
|
78 |
formatted_answer = answer_before_docs.replace("\\n", "\n").strip()
|
79 |
|
80 |
+
# Step 3: Ensure there are no unnecessary starting or ending characters like `(' or ,)`
|
81 |
+
# Instead of stripping them directly, check for artifacts of formatting
|
82 |
+
if formatted_answer.startswith("('") and formatted_answer.endswith("',"):
|
83 |
+
formatted_answer = formatted_answer[2:-2].strip()
|
84 |
+
|
85 |
+
# Optional: Add a prefix if needed
|
86 |
+
formatted_answer = "Co-Pilot: " + formatted_answer
|
87 |
+
|
88 |
return formatted_answer
|
89 |
|
90 |
|