Spaces:
Running
Running
XQ commited on
Commit ·
e0939b3
1
Parent(s): 09c5914
Update UI
Browse files- src/ui/app.py +13 -2
src/ui/app.py
CHANGED
|
@@ -243,6 +243,13 @@ st.markdown(
|
|
| 243 |
color: #901A1E;
|
| 244 |
margin: 0 0 0.4rem 0;
|
| 245 |
letter-spacing: -0.02em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
}
|
| 247 |
.app-subtitle {
|
| 248 |
font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
@@ -681,6 +688,10 @@ if search_clicked and question.strip():
|
|
| 681 |
)
|
| 682 |
st.markdown("---")
|
| 683 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
def _render_result_table(results: list[dict], label: str) -> None:
|
| 685 |
"""Render a ranked results table."""
|
| 686 |
st.markdown(f"**{label}**")
|
|
@@ -689,7 +700,7 @@ if search_clicked and question.strip():
|
|
| 689 |
return
|
| 690 |
header = f'| {t["pipeline_rank"]} | {t["pipeline_doc"]} | {t["pipeline_score"]} |\n|---|---|---|'
|
| 691 |
rows = "\n".join(
|
| 692 |
-
f'| {i + 1} | {r.get("document_id", "")} | {r.get("score", 0):.4f} |'
|
| 693 |
for i, r in enumerate(results)
|
| 694 |
)
|
| 695 |
st.markdown(f"{header}\n{rows}")
|
|
@@ -733,7 +744,7 @@ if search_clicked and question.strip():
|
|
| 733 |
else:
|
| 734 |
change = "-"
|
| 735 |
rows_list.append(
|
| 736 |
-
f'| {i + 1} | {r.get("document_id", "")} | {new_score:.4f} | {change} |'
|
| 737 |
)
|
| 738 |
st.markdown(f"{header}\n" + "\n".join(rows_list))
|
| 739 |
else:
|
|
|
|
| 243 |
color: #901A1E;
|
| 244 |
margin: 0 0 0.4rem 0;
|
| 245 |
letter-spacing: -0.02em;
|
| 246 |
+
white-space: nowrap;
|
| 247 |
+
}
|
| 248 |
+
@media (max-width: 640px) {
|
| 249 |
+
.app-title {
|
| 250 |
+
font-size: clamp(1.3rem, 6vw, 2.2rem);
|
| 251 |
+
white-space: nowrap;
|
| 252 |
+
}
|
| 253 |
}
|
| 254 |
.app-subtitle {
|
| 255 |
font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
|
|
| 688 |
)
|
| 689 |
st.markdown("---")
|
| 690 |
|
| 691 |
+
def _truncate_doc(name: str, max_len: int = 30) -> str:
|
| 692 |
+
"""Truncate long document names for table display."""
|
| 693 |
+
return name if len(name) <= max_len else name[:max_len - 1] + "…"
|
| 694 |
+
|
| 695 |
def _render_result_table(results: list[dict], label: str) -> None:
|
| 696 |
"""Render a ranked results table."""
|
| 697 |
st.markdown(f"**{label}**")
|
|
|
|
| 700 |
return
|
| 701 |
header = f'| {t["pipeline_rank"]} | {t["pipeline_doc"]} | {t["pipeline_score"]} |\n|---|---|---|'
|
| 702 |
rows = "\n".join(
|
| 703 |
+
f'| {i + 1} | {_truncate_doc(r.get("document_id", ""))} | {r.get("score", 0):.4f} |'
|
| 704 |
for i, r in enumerate(results)
|
| 705 |
)
|
| 706 |
st.markdown(f"{header}\n{rows}")
|
|
|
|
| 744 |
else:
|
| 745 |
change = "-"
|
| 746 |
rows_list.append(
|
| 747 |
+
f'| {i + 1} | {_truncate_doc(r.get("document_id", ""))} | {new_score:.4f} | {change} |'
|
| 748 |
)
|
| 749 |
st.markdown(f"{header}\n" + "\n".join(rows_list))
|
| 750 |
else:
|