Update ui/ui_core.py
Browse files- ui/ui_core.py +10 -1
ui/ui_core.py
CHANGED
@@ -14,7 +14,16 @@ def sanitize_utf8(text: str) -> str:
|
|
14 |
return text.encode("utf-8", "ignore").decode("utf-8")
|
15 |
|
16 |
def clean_final_response(text: str) -> str:
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
def extract_all_text_from_csv_or_excel(file_path: str, progress=None, index=0, total=1) -> str:
|
20 |
try:
|
|
|
14 |
return text.encode("utf-8", "ignore").decode("utf-8")
|
15 |
|
16 |
def clean_final_response(text: str) -> str:
|
17 |
+
cleaned = text.replace("[TOOL_CALLS]", "").strip()
|
18 |
+
sections = cleaned.split("[Final Analysis]")
|
19 |
+
if len(sections) > 1:
|
20 |
+
return (
|
21 |
+
f"<div style='padding:1em;border:1px solid #ccc;border-radius:12px;margin-bottom:1em;'>"
|
22 |
+
f"<h3 style='margin-top:0;'>Summary</h3><p>{sections[0].strip()}</p></div>"
|
23 |
+
f"<div style='padding:1em;border:2px solid #4B4CED;background:#f9f9ff;border-radius:12px;'>"
|
24 |
+
f"<h3 style='margin-top:0;'>🧠 Final Analysis</h3><p>{sections[1].strip()}</p></div>"
|
25 |
+
)
|
26 |
+
return f"<div style='padding:1em;border:1px solid #ccc;border-radius:12px;'><p>{cleaned}</p></div>"
|
27 |
|
28 |
def extract_all_text_from_csv_or_excel(file_path: str, progress=None, index=0, total=1) -> str:
|
29 |
try:
|