Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- frontend/app.js +28 -28
- frontend/index.html +18 -19
frontend/app.js
CHANGED
|
@@ -226,12 +226,12 @@ function appendUserBubble(text, scroll = true) {
|
|
| 226 |
const div = document.createElement("div");
|
| 227 |
div.className = "flex items-start gap-4 ml-12 flex-row-reverse";
|
| 228 |
div.innerHTML = `
|
| 229 |
-
<div class="w-
|
| 230 |
-
<span class="material-symbols-outlined">person</span>
|
| 231 |
</div>
|
| 232 |
-
<div class="clay-card p-
|
| 233 |
-
<p class="text-
|
| 234 |
-
<p class="
|
| 235 |
</div>
|
| 236 |
`;
|
| 237 |
messagesList.appendChild(div);
|
|
@@ -248,25 +248,25 @@ function appendAIBubble(data, scroll = true) {
|
|
| 248 |
const sourceCount = (data.sources || data.source_judgments || []).length;
|
| 249 |
|
| 250 |
const sourcesBtn = sourceCount > 0 ? `
|
| 251 |
-
<button class="text-[
|
| 252 |
-
<span class="material-symbols-outlined text-
|
| 253 |
</button>` : "";
|
| 254 |
|
| 255 |
const div = document.createElement("div");
|
| 256 |
div.className = "flex items-start gap-4 mr-12";
|
| 257 |
div.innerHTML = `
|
| 258 |
-
<div class="w-
|
| 259 |
-
<span class="material-symbols-outlined text-
|
| 260 |
</div>
|
| 261 |
-
<div class="clay-card p-
|
| 262 |
-
<p class="text-
|
| 263 |
-
<div class="
|
| 264 |
${formatAnswer(answer)}
|
| 265 |
</div>
|
| 266 |
-
<div class="mt-
|
| 267 |
${sourcesBtn}
|
| 268 |
-
<button class="text-[
|
| 269 |
-
<span class="material-symbols-outlined text-
|
| 270 |
</button>
|
| 271 |
</div>
|
| 272 |
</div>
|
|
@@ -281,12 +281,12 @@ function appendErrorBubble(text, scroll = true) {
|
|
| 281 |
const div = document.createElement("div");
|
| 282 |
div.className = "flex items-start gap-4 mr-12";
|
| 283 |
div.innerHTML = `
|
| 284 |
-
<div class="w-
|
| 285 |
-
<span class="material-symbols-outlined">error</span>
|
| 286 |
</div>
|
| 287 |
-
<div class="clay-card p-
|
| 288 |
-
<p class="text-
|
| 289 |
-
<p>${escHtml(text)}</p>
|
| 290 |
</div>
|
| 291 |
`;
|
| 292 |
messagesList.appendChild(div);
|
|
@@ -300,15 +300,15 @@ function appendLoader() {
|
|
| 300 |
div.id = id;
|
| 301 |
div.className = "flex items-start gap-4 mr-12";
|
| 302 |
div.innerHTML = `
|
| 303 |
-
<div class="w-
|
| 304 |
-
<span class="material-symbols-outlined">smart_toy</span>
|
| 305 |
</div>
|
| 306 |
-
<div class="clay-card p-
|
| 307 |
-
<p class="text-
|
| 308 |
-
<div class="flex gap-
|
| 309 |
-
<div class="w-
|
| 310 |
-
<div class="w-
|
| 311 |
-
<div class="w-
|
| 312 |
</div>
|
| 313 |
</div>
|
| 314 |
`;
|
|
|
|
| 226 |
const div = document.createElement("div");
|
| 227 |
div.className = "flex items-start gap-4 ml-12 flex-row-reverse";
|
| 228 |
div.innerHTML = `
|
| 229 |
+
<div class="w-8 h-8 clay-card flex-shrink-0 bg-primary text-white flex items-center justify-center">
|
| 230 |
+
<span class="material-symbols-outlined text-sm">person</span>
|
| 231 |
</div>
|
| 232 |
+
<div class="clay-card p-4 bg-primary-container text-white shadow-lg max-w-xl">
|
| 233 |
+
<p class="text-xs opacity-60 mb-1.5">You</p>
|
| 234 |
+
<p class="text-sm leading-relaxed">${escHtml(text)}</p>
|
| 235 |
</div>
|
| 236 |
`;
|
| 237 |
messagesList.appendChild(div);
|
|
|
|
| 248 |
const sourceCount = (data.sources || data.source_judgments || []).length;
|
| 249 |
|
| 250 |
const sourcesBtn = sourceCount > 0 ? `
|
| 251 |
+
<button class="text-[10px] font-bold text-secondary uppercase tracking-wider flex items-center gap-1 hover:underline">
|
| 252 |
+
<span class="material-symbols-outlined text-xs">description</span> ${sourceCount} Citation${sourceCount > 1 ? "s" : ""}
|
| 253 |
</button>` : "";
|
| 254 |
|
| 255 |
const div = document.createElement("div");
|
| 256 |
div.className = "flex items-start gap-4 mr-12";
|
| 257 |
div.innerHTML = `
|
| 258 |
+
<div class="w-8 h-8 clay-card flex-shrink-0 bg-secondary-container flex items-center justify-center text-primary">
|
| 259 |
+
<span class="material-symbols-outlined text-lg" style="font-variation-settings: 'FILL' 1;">smart_toy</span>
|
| 260 |
</div>
|
| 261 |
+
<div class="clay-card p-4 bg-white text-primary leading-relaxed shadow-sm max-w-2xl">
|
| 262 |
+
<p class="text-xs font-medium mb-2.5 text-primary/70">Registry Assistant</p>
|
| 263 |
+
<div class="text-sm leading-relaxed text-primary/90">
|
| 264 |
${formatAnswer(answer)}
|
| 265 |
</div>
|
| 266 |
+
<div class="mt-4 pt-3 border-t border-primary/5 flex gap-3 flex-wrap">
|
| 267 |
${sourcesBtn}
|
| 268 |
+
<button class="text-[10px] font-bold text-secondary uppercase tracking-wider flex items-center gap-1 hover:underline">
|
| 269 |
+
<span class="material-symbols-outlined text-xs">picture_as_pdf</span> Export
|
| 270 |
</button>
|
| 271 |
</div>
|
| 272 |
</div>
|
|
|
|
| 281 |
const div = document.createElement("div");
|
| 282 |
div.className = "flex items-start gap-4 mr-12";
|
| 283 |
div.innerHTML = `
|
| 284 |
+
<div class="w-8 h-8 clay-card flex-shrink-0 bg-error-container flex items-center justify-center text-error">
|
| 285 |
+
<span class="material-symbols-outlined text-lg">error</span>
|
| 286 |
</div>
|
| 287 |
+
<div class="clay-card p-4 bg-error-container text-error-container/90 shadow-sm">
|
| 288 |
+
<p class="text-xs font-medium mb-1.5">Error</p>
|
| 289 |
+
<p class="text-sm">${escHtml(text)}</p>
|
| 290 |
</div>
|
| 291 |
`;
|
| 292 |
messagesList.appendChild(div);
|
|
|
|
| 300 |
div.id = id;
|
| 301 |
div.className = "flex items-start gap-4 mr-12";
|
| 302 |
div.innerHTML = `
|
| 303 |
+
<div class="w-8 h-8 clay-card flex-shrink-0 bg-secondary-container flex items-center justify-center text-primary animate-pulse">
|
| 304 |
+
<span class="material-symbols-outlined text-lg">smart_toy</span>
|
| 305 |
</div>
|
| 306 |
+
<div class="clay-card p-4 bg-white text-primary">
|
| 307 |
+
<p class="text-xs font-medium">Searching legal archives...</p>
|
| 308 |
+
<div class="flex gap-1.5 mt-3">
|
| 309 |
+
<div class="w-1.5 h-1.5 bg-primary rounded-full animate-bounce" style="animation-delay: 0s"></div>
|
| 310 |
+
<div class="w-1.5 h-1.5 bg-primary rounded-full animate-bounce" style="animation-delay: 0.2s"></div>
|
| 311 |
+
<div class="w-1.5 h-1.5 bg-primary rounded-full animate-bounce" style="animation-delay: 0.4s"></div>
|
| 312 |
</div>
|
| 313 |
</div>
|
| 314 |
`;
|
frontend/index.html
CHANGED
|
@@ -124,39 +124,39 @@
|
|
| 124 |
<body class="bg-[#F5F0E8] text-on-surface font-body h-screen flex overflow-hidden">
|
| 125 |
|
| 126 |
<!-- Left Side: Sidebar -->
|
| 127 |
-
<aside class="w-
|
| 128 |
<!-- Brand Header -->
|
| 129 |
-
<div class="flex items-center gap-
|
| 130 |
<div class="w-12 h-12 clay-card flex items-center justify-center bg-primary text-secondary-container flex-shrink-0">
|
| 131 |
<span class="material-symbols-outlined text-2xl" style="font-variation-settings: 'FILL' 1;">gavel</span>
|
| 132 |
</div>
|
| 133 |
<div class="flex-1 min-w-0">
|
| 134 |
-
<h1 class="font-headline font-bold text-primary text-
|
| 135 |
-
<p class="text-[
|
| 136 |
</div>
|
| 137 |
</div>
|
| 138 |
|
| 139 |
<!-- Primary Action -->
|
| 140 |
-
<button onclick="newChat()" class="clay-button-primary w-full py-
|
| 141 |
<span class="material-symbols-outlined transition-transform group-hover:rotate-90">add_circle</span>
|
| 142 |
<span>New Petition</span>
|
| 143 |
</button>
|
| 144 |
|
| 145 |
<!-- Navigation Links -->
|
| 146 |
-
<nav class="space-y-2 mb-
|
| 147 |
-
<button onclick="showAnalytics()" class="w-full flex items-center gap-
|
| 148 |
-
<span class="material-symbols-outlined" style="font-variation-settings: 'FILL' 1;">analytics</span>
|
| 149 |
-
<span>
|
| 150 |
</button>
|
| 151 |
-
<a href="/court/ui" class="flex items-center gap-
|
| 152 |
-
<span class="material-symbols-outlined">balance</span>
|
| 153 |
<span>Moot Court</span>
|
| 154 |
</a>
|
| 155 |
</nav>
|
| 156 |
|
| 157 |
<!-- Session List Container -->
|
| 158 |
<div class="flex-1 overflow-hidden flex flex-col min-h-0">
|
| 159 |
-
<h3 class="text-[
|
| 160 |
<div class="flex-1 overflow-y-auto space-y-3 px-1 custom-scrollbar" id="sessions-list">
|
| 161 |
<div class="sessions-empty text-xs text-primary/50 px-4 py-8 text-center">No active cases</div>
|
| 162 |
</div>
|
|
@@ -186,7 +186,7 @@
|
|
| 186 |
</header>
|
| 187 |
|
| 188 |
<!-- Content Canvas -->
|
| 189 |
-
<div class="flex-1 overflow-y-auto px-8 pb-
|
| 190 |
<!-- Welcome Screen -->
|
| 191 |
<section class="max-w-4xl mx-auto pt-8 flex flex-col items-center text-center screen active" id="screen-welcome">
|
| 192 |
<div class="relative mb-8">
|
|
@@ -257,13 +257,12 @@
|
|
| 257 |
</div>
|
| 258 |
|
| 259 |
<!-- Sticky Input Area -->
|
| 260 |
-
<div class="absolute bottom-0 left-0 right-0 bg-[#F5F0E8]/
|
| 261 |
-
<div class="max-w-4xl mx-auto clay-inset p-
|
| 262 |
-
<div class="flex-1 min-h-[
|
| 263 |
-
<textarea id="query-input" class="w-full bg-transparent border-none focus:ring-0 text-primary placeholder-primary/30 font-
|
| 264 |
</div>
|
| 265 |
-
<button onclick="submitQuery()" class="clay-button-primary px-
|
| 266 |
-
<span class="text-sm">Submit</span>
|
| 267 |
<span class="material-symbols-outlined text-base">send</span>
|
| 268 |
</button>
|
| 269 |
</div>
|
|
|
|
| 124 |
<body class="bg-[#F5F0E8] text-on-surface font-body h-screen flex overflow-hidden">
|
| 125 |
|
| 126 |
<!-- Left Side: Sidebar -->
|
| 127 |
+
<aside class="w-64 h-full flex flex-col bg-primary/5 border-r border-primary/10 p-5 z-30 transition-all duration-300 overflow-y-auto custom-scrollbar" id="sidebar">
|
| 128 |
<!-- Brand Header -->
|
| 129 |
+
<div class="flex items-center gap-2 mb-8 px-2">
|
| 130 |
<div class="w-12 h-12 clay-card flex items-center justify-center bg-primary text-secondary-container flex-shrink-0">
|
| 131 |
<span class="material-symbols-outlined text-2xl" style="font-variation-settings: 'FILL' 1;">gavel</span>
|
| 132 |
</div>
|
| 133 |
<div class="flex-1 min-w-0">
|
| 134 |
+
<h1 class="font-headline font-bold text-primary text-lg leading-tight tracking-tight truncate">NYAYA</h1>
|
| 135 |
+
<p class="text-[9px] uppercase tracking-widest text-secondary font-bold opacity-70 truncate">Registry</p>
|
| 136 |
</div>
|
| 137 |
</div>
|
| 138 |
|
| 139 |
<!-- Primary Action -->
|
| 140 |
+
<button onclick="newChat()" class="clay-button-primary w-full py-2.5 px-4 flex items-center justify-center gap-2 text-white font-semibold text-sm rounded-lg mb-6 group">
|
| 141 |
<span class="material-symbols-outlined transition-transform group-hover:rotate-90">add_circle</span>
|
| 142 |
<span>New Petition</span>
|
| 143 |
</button>
|
| 144 |
|
| 145 |
<!-- Navigation Links -->
|
| 146 |
+
<nav class="space-y-2 mb-8">
|
| 147 |
+
<button onclick="showAnalytics()" class="w-full flex items-center gap-2 px-3 py-2.5 clay-card text-secondary font-semibold text-sm hover:bg-white/80 transition-colors">
|
| 148 |
+
<span class="material-symbols-outlined text-lg" style="font-variation-settings: 'FILL' 1;">analytics</span>
|
| 149 |
+
<span>Analytics</span>
|
| 150 |
</button>
|
| 151 |
+
<a href="/court/ui" class="flex items-center gap-2 px-3 py-2.5 text-primary/60 hover:text-primary transition-colors font-medium text-sm">
|
| 152 |
+
<span class="material-symbols-outlined text-lg">balance</span>
|
| 153 |
<span>Moot Court</span>
|
| 154 |
</a>
|
| 155 |
</nav>
|
| 156 |
|
| 157 |
<!-- Session List Container -->
|
| 158 |
<div class="flex-1 overflow-hidden flex flex-col min-h-0">
|
| 159 |
+
<h3 class="text-[10px] uppercase tracking-[0.15em] text-primary/40 font-bold px-3 mb-3">Sessions</h3>
|
| 160 |
<div class="flex-1 overflow-y-auto space-y-3 px-1 custom-scrollbar" id="sessions-list">
|
| 161 |
<div class="sessions-empty text-xs text-primary/50 px-4 py-8 text-center">No active cases</div>
|
| 162 |
</div>
|
|
|
|
| 186 |
</header>
|
| 187 |
|
| 188 |
<!-- Content Canvas -->
|
| 189 |
+
<div class="flex-1 overflow-y-auto px-8 pb-20 custom-scrollbar relative">
|
| 190 |
<!-- Welcome Screen -->
|
| 191 |
<section class="max-w-4xl mx-auto pt-8 flex flex-col items-center text-center screen active" id="screen-welcome">
|
| 192 |
<div class="relative mb-8">
|
|
|
|
| 257 |
</div>
|
| 258 |
|
| 259 |
<!-- Sticky Input Area -->
|
| 260 |
+
<div class="absolute bottom-0 left-0 right-0 bg-[#F5F0E8]/90 backdrop-blur-md px-8 py-4 z-40 border-t border-primary/5">
|
| 261 |
+
<div class="max-w-4xl mx-auto clay-inset p-1.5 flex items-end gap-2" id="petition-input">
|
| 262 |
+
<div class="flex-1 min-h-[40px] px-3 py-2">
|
| 263 |
+
<textarea id="query-input" class="w-full bg-transparent border-none focus:ring-0 text-primary placeholder-primary/30 font-normal custom-scrollbar text-xs" placeholder="Ask anything..." rows="1"></textarea>
|
| 264 |
</div>
|
| 265 |
+
<button onclick="submitQuery()" class="clay-button-primary px-4 py-1.5 rounded-md text-white font-semibold flex items-center gap-1.5 shadow-lg flex-shrink-0" id="send-btn">
|
|
|
|
| 266 |
<span class="material-symbols-outlined text-base">send</span>
|
| 267 |
</button>
|
| 268 |
</div>
|