Adam Cseresznye commited on
Commit ·
f887d42
1
Parent(s): 4969aa7
Revamp UI
Browse files- logo/favicon-1.png +0 -3
- logo/favicon-2.png +0 -3
- logo/logo-1.png +0 -3
- logo/logo-2.png +0 -3
- logo/logo-3.png +0 -3
- ui/pages.py +204 -7
logo/favicon-1.png
DELETED
Git LFS Details
|
logo/favicon-2.png
DELETED
Git LFS Details
|
logo/logo-1.png
DELETED
Git LFS Details
|
logo/logo-2.png
DELETED
Git LFS Details
|
logo/logo-3.png
DELETED
Git LFS Details
|
ui/pages.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""Page definitions for the
|
| 2 |
|
| 3 |
from pathlib import Path
|
| 4 |
from nicegui import ui, context, app
|
|
@@ -30,10 +30,108 @@ def init_ui(fastapi_app):
|
|
| 30 |
async def index_page():
|
| 31 |
# Inject custom CSS
|
| 32 |
ui.add_head_html(f"<style>{CUSTOM_CSS}</style>")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# Get client reference for connection checking
|
| 35 |
client = context.client
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
# State containers
|
| 38 |
results_container = None
|
| 39 |
|
|
@@ -59,8 +157,48 @@ def init_ui(fastapi_app):
|
|
| 59 |
# Show loading
|
| 60 |
if not is_connected():
|
| 61 |
return
|
|
|
|
|
|
|
|
|
|
| 62 |
with results_container:
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
try:
|
| 66 |
# Call the query service
|
|
@@ -101,23 +239,50 @@ def init_ui(fastapi_app):
|
|
| 101 |
except RuntimeError:
|
| 102 |
# Client was deleted, silently ignore
|
| 103 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
# =====================================================================
|
| 106 |
# HEADER
|
| 107 |
# =====================================================================
|
| 108 |
-
with ui.row().classes(
|
|
|
|
|
|
|
| 109 |
# Logo and brand
|
| 110 |
-
with ui.row().classes("items-center gap-
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
ui.
|
| 113 |
-
"
|
| 114 |
)
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
# =====================================================================
|
| 118 |
# MAIN CONTENT
|
| 119 |
# =====================================================================
|
| 120 |
with ui.column().classes("w-full items-center px-4 py-8"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
# Search container
|
| 122 |
with ui.column().classes("search-container"):
|
| 123 |
# Search wrapper
|
|
@@ -157,3 +322,35 @@ def init_ui(fastapi_app):
|
|
| 157 |
|
| 158 |
# Results container
|
| 159 |
results_container = ui.column().classes("w-full mt-6")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Page definitions for the Nechtrall UI."""
|
| 2 |
|
| 3 |
from pathlib import Path
|
| 4 |
from nicegui import ui, context, app
|
|
|
|
| 30 |
async def index_page():
|
| 31 |
# Inject custom CSS
|
| 32 |
ui.add_head_html(f"<style>{CUSTOM_CSS}</style>")
|
| 33 |
+
ui.add_body_html(
|
| 34 |
+
"""
|
| 35 |
+
<script data-name="BMC-Widget" data-cfasync="false"
|
| 36 |
+
src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js"
|
| 37 |
+
data-id="acseresznye"
|
| 38 |
+
data-description="Support Nechtrall development"
|
| 39 |
+
data-message=""
|
| 40 |
+
data-color="#FFDD00"
|
| 41 |
+
data-position="Right"
|
| 42 |
+
data-x_margin="18"
|
| 43 |
+
data-y_margin="18">
|
| 44 |
+
</script>
|
| 45 |
+
"""
|
| 46 |
+
)
|
| 47 |
|
| 48 |
# Get client reference for connection checking
|
| 49 |
client = context.client
|
| 50 |
|
| 51 |
+
# =====================================================================
|
| 52 |
+
# DIALOG: HOW IT WORKS
|
| 53 |
+
# =====================================================================
|
| 54 |
+
with ui.dialog() as about_dialog, ui.card().classes("q-pa-md"):
|
| 55 |
+
with ui.row().classes("w-full items-center justify-between"):
|
| 56 |
+
ui.label("How Nechtrall Works").classes("text-xl font-bold")
|
| 57 |
+
ui.button(icon="close", on_click=about_dialog.close).props(
|
| 58 |
+
"flat round dense"
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
with ui.column().classes("gap-4 mt-4"):
|
| 62 |
+
# Step 1
|
| 63 |
+
with ui.row().classes("items-center gap-4"):
|
| 64 |
+
ui.icon("travel_explore", size="md").classes("text-blue-500")
|
| 65 |
+
ui.label(
|
| 66 |
+
"1. Search: We scan millions of papers on Semantic Scholar."
|
| 67 |
+
).classes("text-base")
|
| 68 |
+
|
| 69 |
+
# Step 2
|
| 70 |
+
with ui.row().classes("items-center gap-4"):
|
| 71 |
+
ui.icon("filter_alt", size="md").classes("text-green-500")
|
| 72 |
+
ui.label(
|
| 73 |
+
"2. Filter: We rank papers by citation count and impact."
|
| 74 |
+
).classes("text-base")
|
| 75 |
+
|
| 76 |
+
# Step 3
|
| 77 |
+
with ui.row().classes("items-center gap-4"):
|
| 78 |
+
ui.icon("auto_awesome", size="md").classes("text-purple-500")
|
| 79 |
+
ui.label(
|
| 80 |
+
"3. Synthesize: AI reads the papers and writes a cited answer."
|
| 81 |
+
).classes("text-base")
|
| 82 |
+
|
| 83 |
+
# =====================================================================
|
| 84 |
+
# DIALOG: PRIVACY POLICY
|
| 85 |
+
# =====================================================================
|
| 86 |
+
with (
|
| 87 |
+
ui.dialog() as privacy_dialog,
|
| 88 |
+
ui.card().classes("w-full max-w-lg q-pa-lg"),
|
| 89 |
+
):
|
| 90 |
+
with ui.row().classes("w-full items-center justify-between mb-2"):
|
| 91 |
+
ui.label("Privacy Policy").classes("text-xl font-bold")
|
| 92 |
+
ui.button(icon="close", on_click=privacy_dialog.close).props(
|
| 93 |
+
"flat round dense"
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
with ui.scroll_area().classes("h-64 pr-4"):
|
| 97 |
+
ui.markdown(
|
| 98 |
+
"""
|
| 99 |
+
**Last Updated: December 2025**
|
| 100 |
+
|
| 101 |
+
1. **No Personal Data Retention:** Nechtrall is a stateless application. We do not create user accounts, nor do we store your search history or personal details in our databases.
|
| 102 |
+
|
| 103 |
+
2. **Third-Party Processing:** To answer your questions, your anonymized queries are processed by:
|
| 104 |
+
- **Semantic Scholar:** To retrieve relevant scientific papers.
|
| 105 |
+
- **LLM Providers (Google/Groq):** To analyze text and generate answers.
|
| 106 |
+
These providers may retain data transiently for abuse monitoring, but we do not store it.
|
| 107 |
+
|
| 108 |
+
3. **Local Storage:** We use your browser's local storage solely to save session preferences (like dark mode), which never leave your device.
|
| 109 |
+
"""
|
| 110 |
+
).classes("text-slate-700")
|
| 111 |
+
|
| 112 |
+
# =====================================================================
|
| 113 |
+
# DIALOG: TERMS OF SERVICE
|
| 114 |
+
# =====================================================================
|
| 115 |
+
with ui.dialog() as terms_dialog, ui.card().classes("w-full max-w-lg q-pa-lg"):
|
| 116 |
+
with ui.row().classes("w-full items-center justify-between mb-2"):
|
| 117 |
+
ui.label("Terms of Service").classes("text-xl font-bold")
|
| 118 |
+
ui.button(icon="close", on_click=terms_dialog.close).props(
|
| 119 |
+
"flat round dense"
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
with ui.scroll_area().classes("h-64 pr-4"):
|
| 123 |
+
ui.markdown(
|
| 124 |
+
"""
|
| 125 |
+
**Last Updated: December 2025**
|
| 126 |
+
|
| 127 |
+
1. **Research Purpose Only:** Nechtrall is an experimental AI tool designed for academic research assistance. It is **not** a substitute for professional medical, legal, or financial advice.
|
| 128 |
+
|
| 129 |
+
2. **Accuracy Disclaimer:** AI models can make mistakes ("hallucinations"). While we strive to verify citations against real papers, **you must verify important claims** by reading the original source documents linked in the results.
|
| 130 |
+
|
| 131 |
+
3. **No Liability:** The creators of Nechtrall accept no liability for any damages or losses resulting from reliance on the information provided by this tool. By using this service, you agree to cross-check all information.
|
| 132 |
+
"""
|
| 133 |
+
).classes("text-slate-700")
|
| 134 |
+
|
| 135 |
# State containers
|
| 136 |
results_container = None
|
| 137 |
|
|
|
|
| 157 |
# Show loading
|
| 158 |
if not is_connected():
|
| 159 |
return
|
| 160 |
+
|
| 161 |
+
# --- START: Enhanced Loading UI ---
|
| 162 |
+
loading_timer = None
|
| 163 |
with results_container:
|
| 164 |
+
with ui.column().classes(
|
| 165 |
+
"w-full items-center justify-center py-12 gap-6"
|
| 166 |
+
):
|
| 167 |
+
# 1. Modern Ring Spinner
|
| 168 |
+
ui.spinner("rings", size="4rem", color="primary").props(
|
| 169 |
+
"thickness=4"
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
# 2. Cycling Status Message
|
| 173 |
+
status_label = ui.label("Initiating research scan...").classes(
|
| 174 |
+
"text-xl text-slate-600 font-medium animate-pulse text-center"
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
# 3. Tip
|
| 178 |
+
ui.label(
|
| 179 |
+
"This may take 15-30 seconds. We are reading real papers."
|
| 180 |
+
).classes("text-sm text-slate-400 italic")
|
| 181 |
+
|
| 182 |
+
# Simulated progress steps
|
| 183 |
+
messages = [
|
| 184 |
+
"Querying Semantic Scholar API...",
|
| 185 |
+
"Filtering top candidate papers...",
|
| 186 |
+
"Downloading open-access PDFs...",
|
| 187 |
+
"Analyzing citation networks...",
|
| 188 |
+
"Extracting relevant passages...",
|
| 189 |
+
"Synthesizing final answer...",
|
| 190 |
+
]
|
| 191 |
+
msg_idx = 0
|
| 192 |
+
|
| 193 |
+
def update_progress():
|
| 194 |
+
nonlocal msg_idx
|
| 195 |
+
if msg_idx < len(messages):
|
| 196 |
+
status_label.set_text(messages[msg_idx])
|
| 197 |
+
msg_idx = (msg_idx + 1) % len(messages)
|
| 198 |
+
|
| 199 |
+
# Update text every 2.5 seconds
|
| 200 |
+
loading_timer = ui.timer(2.5, update_progress)
|
| 201 |
+
# --- END: Enhanced Loading UI ---
|
| 202 |
|
| 203 |
try:
|
| 204 |
# Call the query service
|
|
|
|
| 239 |
except RuntimeError:
|
| 240 |
# Client was deleted, silently ignore
|
| 241 |
pass
|
| 242 |
+
finally:
|
| 243 |
+
# Clean up the timer to prevent errors
|
| 244 |
+
if loading_timer:
|
| 245 |
+
loading_timer.cancel()
|
| 246 |
|
| 247 |
# =====================================================================
|
| 248 |
# HEADER
|
| 249 |
# =====================================================================
|
| 250 |
+
with ui.row().classes(
|
| 251 |
+
"header-container items-center justify-between lg:justify-center w-full px-4 bg-white shadow-sm relative"
|
| 252 |
+
):
|
| 253 |
# Logo and brand
|
| 254 |
+
with ui.row().classes("items-center gap-2"):
|
| 255 |
+
ui.image(LOGO_DIR).classes(
|
| 256 |
+
"w-12 h-12 md:w-20 md:h-20 object-contain"
|
| 257 |
+
).props("no-spinner")
|
| 258 |
|
| 259 |
+
ui.label("Nechtrall").classes(
|
| 260 |
+
"text-2xl md:text-4xl font-bold text-slate-800 leading-none pb-1 md:pb-2"
|
| 261 |
)
|
| 262 |
+
|
| 263 |
+
# About button
|
| 264 |
+
ui.button("About", on_click=about_dialog.open).props("flat").classes(
|
| 265 |
+
"text-slate-600 font-semibold "
|
| 266 |
+
"lg:absolute lg:right-8 lg:top-1/2 lg:-translate-y-1/2"
|
| 267 |
+
)
|
| 268 |
|
| 269 |
# =====================================================================
|
| 270 |
# MAIN CONTENT
|
| 271 |
# =====================================================================
|
| 272 |
with ui.column().classes("w-full items-center px-4 py-8"):
|
| 273 |
+
with ui.column().classes("w-full items-center px-4 py-8"):
|
| 274 |
+
|
| 275 |
+
# --- HERO SECTION START ---
|
| 276 |
+
with ui.column().classes("items-center w-full text-center mb-8"):
|
| 277 |
+
# The Slogan / Main Title
|
| 278 |
+
ui.label("Science, Distilled.").classes(
|
| 279 |
+
"text-4xl md:text-5xl font-extrabold text-slate-800 drop-shadow-lg shadow-primary/50 mb-3 tracking-tight"
|
| 280 |
+
)
|
| 281 |
+
# The Subtitle (Value Prop)
|
| 282 |
+
ui.label(
|
| 283 |
+
"Ask complex questions. Get cited, verifiable answers."
|
| 284 |
+
).classes("text-lg text-slate-500 max-w-2xl")
|
| 285 |
+
# --- HERO SECTION END ---
|
| 286 |
# Search container
|
| 287 |
with ui.column().classes("search-container"):
|
| 288 |
# Search wrapper
|
|
|
|
| 322 |
|
| 323 |
# Results container
|
| 324 |
results_container = ui.column().classes("w-full mt-6")
|
| 325 |
+
|
| 326 |
+
# =====================================================================
|
| 327 |
+
# FOOTER
|
| 328 |
+
# =====================================================================
|
| 329 |
+
with ui.footer(fixed=False).classes(
|
| 330 |
+
"bg-white text-slate-500 border-t border-slate-200 q-py-xl"
|
| 331 |
+
):
|
| 332 |
+
with ui.column().classes("w-full items-center gap-2"):
|
| 333 |
+
ui.label("© 2025 Nechtrall AI. Research responsibly.").classes(
|
| 334 |
+
"font-bold"
|
| 335 |
+
)
|
| 336 |
+
ui.label(
|
| 337 |
+
"AI can make mistakes. Always verify important citations."
|
| 338 |
+
).classes("italic text-sm")
|
| 339 |
+
|
| 340 |
+
with ui.row().classes("gap-4 items-center"):
|
| 341 |
+
ui.label("Privacy Policy").classes(
|
| 342 |
+
"cursor-pointer hover:text-slate-800 text-sm"
|
| 343 |
+
).on("click", privacy_dialog.open)
|
| 344 |
+
|
| 345 |
+
ui.label("|").classes("text-slate-300")
|
| 346 |
+
|
| 347 |
+
ui.label("Terms of Service").classes(
|
| 348 |
+
"cursor-pointer hover:text-slate-800 text-sm"
|
| 349 |
+
).on("click", terms_dialog.open)
|
| 350 |
+
|
| 351 |
+
ui.label("|").classes("text-slate-300")
|
| 352 |
+
|
| 353 |
+
ui.link(
|
| 354 |
+
"huggingface",
|
| 355 |
+
"https://huggingface.co/spaces/Necthrall/AI/tree/main",
|
| 356 |
+
).classes("text-slate-500 hover:text-slate-800 text-sm")
|