Update ui/ui_core.py
Browse files- ui/ui_core.py +15 -10
ui/ui_core.py
CHANGED
@@ -15,17 +15,22 @@ def sanitize_utf8(text: str) -> str:
|
|
15 |
|
16 |
def clean_final_response(text: str) -> str:
|
17 |
cleaned = text.replace("[TOOL_CALLS]", "").strip()
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
)
|
28 |
-
return
|
29 |
|
30 |
def extract_all_text_from_csv_or_excel(file_path: str, progress=None, index=0, total=1) -> str:
|
31 |
try:
|
|
|
15 |
|
16 |
def clean_final_response(text: str) -> str:
|
17 |
cleaned = text.replace("[TOOL_CALLS]", "").strip()
|
18 |
+
responses = cleaned.split("[Final Analysis]")
|
19 |
+
|
20 |
+
if len(responses) <= 1:
|
21 |
+
return f"<div style='padding:1em;border:1px solid #ccc;border-radius:12px;color:#fff;background:#353F54;'><p>{cleaned}</p></div>"
|
22 |
+
|
23 |
+
# Support multiple [Final Analysis] sections
|
24 |
+
panels = []
|
25 |
+
for i, section in enumerate(responses[1:], 1):
|
26 |
+
final = section.strip()
|
27 |
+
panels.append(
|
28 |
+
f"<details style='background:#242C3B;color:#fff;border-radius:12px;margin-bottom:1em;border:1px solid #4B4CED;'>"
|
29 |
+
f"<summary style='font-size:1.1em;font-weight:bold;padding:0.75em;background:#4B4CED;color:#fff;border-radius:12px 12px 0 0;'>🧠 Final Analysis #{i}</summary>"
|
30 |
+
f"<div style='padding:1em;line-height:1.6;'>{final.replace(chr(10), '<br>')}</div>"
|
31 |
+
f"</details>"
|
32 |
)
|
33 |
+
return "".join(panels)
|
34 |
|
35 |
def extract_all_text_from_csv_or_excel(file_path: str, progress=None, index=0, total=1) -> str:
|
36 |
try:
|