Spaces:
Runtime error
Runtime error
File size: 21,131 Bytes
644f326 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | {% extends "base.html" %}
{% block content %}
<div class="app-container" id="app">
<!-- Left Sidebar (ChatGPT-style) -->
<aside class="sidebar" id="sidebar">
<!-- Sidebar Header & Brand -->
<div class="sidebar-header">
<div class="brand">
<div class="brand-icon">
<!-- DevOps Cup SVG Icon -->
<svg width="220" height="110" viewBox="0 0 220 110" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- Left Loop (Dark Navy - Dev Side) -->
<path
d="M65 15C34.6243 15 10 39.6243 10 70C10 100.376 34.6243 125 65 125C84.3854 125 101.405 115.008 111 100L93 85C86.7214 94.626 76.2974 101 65 101C47.8792 101 34 87.1208 34 70C34 52.8792 47.8792 39 65 39C75.3168 39 84.819 44.4079 91 53L111 30C101.218 16.0381 84.2384 15 65 15Z"
fill="#132F4C" />
<!-- Left Loop Arrows -->
<path d="M65 15V32L77 23.5L65 15Z" fill="#132F4C" />
<path d="M35 83H18L26.5 95L35 83Z" fill="#132F4C" />
<!-- Right Loop (Vibrant Green - Ops Side) -->
<path
d="M155 15C185.376 15 210 39.6243 210 70C210 100.376 185.376 125 155 125C135.615 125 118.595 115.008 109 100L129 85C135.279 94.626 145.703 101 157 101C174.121 101 188 87.1208 188 70C188 52.8792 174.121 39 157 39C163.683 39 171.181 44.4079 129 53L109 30C118.782 16.0381 135.762 15 155 15Z"
fill="#00E676" />
<!-- Right Loop Crossing & Arrows -->
<path d="M155 109V92L143 100.5L155 109Z" fill="#00E676" />
<path d="M185 41H202L193.5 29L185 41Z" fill="#00E676" />
<!-- Center Crossing Overlap Bridge -->
<path d="M91 53L129 87V73L105 51L91 53Z" fill="#00E676" />
<path d="M129 57L91 87V73L115 51L129 57Z" fill="#132F4C" />
<!-- Text: Dev & Ops -->
<text x="50" y="77" font-family="Arial, sans-serif" font-weight="bold" font-size="22"
fill="#00E676" text-anchor="middle">Dev</text>
<text x="170" y="77" font-family="Arial, sans-serif" font-weight="bold" font-size="22"
fill="#132F4C" text-anchor="middle">Ops</text>
</svg>
</div>
<div class="brand-text">
<span class="brand-title">DevOps Prep</span>
<span class="brand-badge">Multi-RAG</span>
</div>
</div>
<!-- Mobile Close Button -->
<button class="icon-btn mobile-close-btn" id="mobileCloseBtn" title="Close sidebar"
aria-label="Close sidebar">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 6 6 18M6 6l12 12" />
</svg>
</button>
</div>
<!-- New Chat Button -->
<div class="sidebar-action">
<button class="btn btn-new-chat" id="newChatBtn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 5v14M5 12h14" />
</svg>
<span>New Thread</span>
</button>
</div>
<!-- Thread List -->
<div class="threads-section">
<div class="threads-header">
<span>Conversations</span>
<span class="threads-count" id="threadsCount">0</span>
</div>
<div class="thread-list" id="threadList">
<!-- Dynamically populated threads -->
</div>
</div>
<!-- Sidebar Footer -->
<div class="sidebar-footer">
<!-- Ingest Trigger -->
<button class="sidebar-footer-btn" id="openIngestModalBtn">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
<span>Ingest Documents</span>
</button>
<!-- Theme Toggle -->
<button class="sidebar-footer-btn theme-toggle-btn" id="themeToggleBtn">
<span class="theme-icon-dark">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="4" />
<path
d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" />
</svg>
</span>
<span class="theme-icon-light" style="display:none;">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" />
</svg>
</span>
<span class="theme-text" id="themeText">Day Mode</span>
</button>
<!-- Active Thread Tag -->
<div class="thread-info-badge" id="activeThreadBadge" title="Current session UUID">
<span class="thread-dot"></span>
<span class="thread-uuid" id="activeThreadShortId">No Thread</span>
</div>
</div>
</aside>
<!-- Main Workspace -->
<main class="main-workspace">
<!-- Top App Bar -->
<header class="top-bar">
<div class="top-bar-left">
<button class="icon-btn mobile-menu-btn" id="mobileMenuBtn" title="Toggle navigation"
aria-label="Toggle navigation">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="4" y1="12" x2="20" y2="12" />
<line x1="4" y1="6" x2="20" y2="6" />
<line x1="4" y1="18" x2="20" y2="18" />
</svg>
</button>
<div class="chat-header-info">
<h1 class="chat-title" id="chatTitle">New Conversation</h1>
<span class="pipeline-pill">
<span class="pulsing-dot"></span>
LangGraph Agentic RAG
</span>
</div>
</div>
<div class="top-bar-actions">
<label class="model-picker" for="modelSelector">
<span>Model</span>
<select id="modelSelector" aria-label="Choose chat model">
<optgroup label="Alibaba Cloud">
<option value="qwen/qwen3.8-27b">qwen/qwen3.8-27b</option>
</optgroup>
<optgroup label="Canopy Labs">
<option value="canopylabs/orpheus-arabic-saudi">canopylabs/orpheus-arabic-saudi</option>
<option value="canopylabs/orpheus-v1-english">canopylabs/orpheus-v1-english</option>
</optgroup>
<optgroup label="Meta">
<option value="meta-llama/llama-prompt-guard-2-22m">meta-llama/llama-prompt-guard-2-22m
</option>
<option value="meta-llama/llama-prompt-guard-2-86m">meta-llama/llama-prompt-guard-2-86m
</option>
</optgroup>
<optgroup label="OpenAI">
<option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option>
<option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option>
<option value="openai/gpt-oss-safeguard-20b">openai/gpt-oss-safeguard-20b</option>
<option value="whisper-large-v3">whisper-large-v3</option>
<option value="whisper-large-v3-turbo">whisper-large-v3-turbo</option>
</optgroup>
</select>
</label>
<button class="btn btn-outline btn-sm" id="topIngestBtn">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
<span>Ingest Docs</span>
</button>
<button class="icon-btn" id="clearChatBtn" title="Clear current messages">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 6h18" />
<path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
<path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
</svg>
</button>
</div>
</header>
<!-- Chat Timeline Container -->
<div class="chat-scroll-container" id="chatScrollContainer">
<!-- Empty State Screen -->
<div class="empty-state" id="emptyState">
<div class="empty-logo">
<div class="empty-cup-icon">
<svg width="220" height="110" viewBox="0 0 220 110" fill="none"
xmlns="http://www.w3.org/2000/svg">
<!-- Left Loop (Dark Navy - Dev Side) -->
<path
d="M65 15C34.6243 15 10 39.6243 10 70C10 100.376 34.6243 125 65 125C84.3854 125 101.405 115.008 111 100L93 85C86.7214 94.626 76.2974 101 65 101C47.8792 101 34 87.1208 34 70C34 52.8792 47.8792 39 65 39C75.3168 39 84.819 44.4079 91 53L111 30C101.218 16.0381 84.2384 15 65 15Z"
fill="#132F4C" />
<!-- Left Loop Arrows -->
<path d="M65 15V32L77 23.5L65 15Z" fill="#132F4C" />
<path d="M35 83H18L26.5 95L35 83Z" fill="#132F4C" />
<!-- Right Loop (Vibrant Green - Ops Side) -->
<path
d="M155 15C185.376 15 210 39.6243 210 70C210 100.376 185.376 125 155 125C135.615 125 118.595 115.008 109 100L129 85C135.279 94.626 145.703 101 157 101C174.121 101 188 87.1208 188 70C188 52.8792 174.121 39 157 39C163.683 39 171.181 44.4079 129 53L109 30C118.782 16.0381 135.762 15 155 15Z"
fill="#00E676" />
<!-- Right Loop Crossing & Arrows -->
<path d="M155 109V92L143 100.5L155 109Z" fill="#00E676" />
<path d="M185 41H202L193.5 29L185 41Z" fill="#00E676" />
<!-- Center Crossing Overlap Bridge -->
<path d="M91 53L129 87V73L105 51L91 53Z" fill="#00E676" />
<path d="M129 57L91 87V73L115 51L129 57Z" fill="#132F4C" />
<!-- Text: Dev & Ops -->
<text x="50" y="77" font-family="Arial, sans-serif" font-weight="bold" font-size="22"
fill="#00E676" text-anchor="middle">Dev</text>
<text x="170" y="77" font-family="Arial, sans-serif" font-weight="bold" font-size="22"
fill="#132F4C" text-anchor="middle">Ops</text>
</svg>
</div>
</div>
<h2 class="empty-title">DevOps Prep Multi-RAG</h2>
<p class="empty-subtitle">Agentic retrieval pipeline with live reasoning, tool execution tracking, and
document synthesis.</p>
<div class="quick-prompts-grid">
<div class="quick-prompt-card"
data-prompt="What documents are currently ingested in the knowledge base?">
<span class="prompt-icon">📚</span>
<div class="prompt-content">
<div class="prompt-title">Knowledge Base Query</div>
<div class="prompt-desc">Ask what documents or knowledge are currently stored.</div>
</div>
</div>
<div class="quick-prompt-card"
data-prompt="Summarize the key concepts and architecture of this Multi-RAG system.">
<span class="prompt-icon">⚡</span>
<div class="prompt-content">
<div class="prompt-title">Architecture Summary</div>
<div class="prompt-desc">Explain how the LangGraph pipeline and retriever operate.</div>
</div>
</div>
<div class="quick-prompt-card"
data-prompt="Can you extract the main actionable takeaways from the knowledge base?">
<span class="prompt-icon">💡</span>
<div class="prompt-content">
<div class="prompt-title">Actionable Takeaways</div>
<div class="prompt-desc">Synthesize actionable findings with clear bullet points.</div>
</div>
</div>
</div>
</div>
<!-- Messages Timeline -->
<div class="messages-container" id="messagesContainer">
<!-- Dynamically injected message rows -->
</div>
</div>
<!-- Chat Input Area -->
<footer class="input-section">
<div class="input-card">
<!-- Live Pipeline Banner -->
<div class="pipeline-status-banner" id="pipelineStatusBanner" style="display:none;">
<div class="pipeline-status-badge">
<span class="pulsing-amber-dot"></span>
<span id="pipelineStatusText">Generating response...</span>
</div>
<button class="stop-btn" id="stopStreamBtn" title="Stop generating">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<rect x="6" y="6" width="12" height="12" rx="2" />
</svg>
<span>Stop</span>
</button>
</div>
<div class="input-box-wrapper">
<textarea class="chat-input" id="chatInput" rows="1"
placeholder="Ask anything about your documents... (Shift+Enter for new line)"
autocomplete="off"></textarea>
<div class="input-actions">
<button class="send-btn" id="sendBtn" title="Send message" aria-label="Send message">
<svg class="send-icon" width="18" height="18" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<line x1="22" y1="2" x2="11" y2="13"></line>
<polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
</svg>
</button>
</div>
</div>
<div class="input-meta">
<span class="meta-tag">DevOps Prep AI Engine</span>
<span class="meta-separator">•</span>
<span>SSE Streaming with LangGraph Checkpointer</span>
</div>
</div>
</footer>
</main>
<!-- Document Ingestion Modal -->
<div class="modal-backdrop" id="ingestModalBackdrop" style="display:none;">
<div class="modal-dialog">
<div class="modal-header">
<div class="modal-title-group">
<div class="modal-icon">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
</div>
<div>
<h3 class="modal-title">Document Ingestion</h3>
<p class="modal-subtitle">Upload documents into the Multi-RAG vector store.</p>
</div>
</div>
<button class="icon-btn modal-close-btn" id="closeIngestModalBtn" aria-label="Close modal">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M18 6 6 18M6 6l12 12" />
</svg>
</button>
</div>
<div class="modal-body">
<!-- Dropzone -->
<div class="upload-dropzone" id="dropzone">
<input type="file" id="fileInput" multiple accept=".pdf,.docx,.pptx,.txt,.html"
style="display: none;">
<div class="dropzone-content">
<div class="dropzone-icon">
<svg width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.8">
<path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" />
<path d="M12 12v9" />
<path d="m16 16-4-4-4 4" />
</svg>
</div>
<div class="dropzone-text">
<span class="primary-text">Drag & drop files here</span>
<span class="secondary-text">or <button type="button" class="browse-link"
id="browseFilesBtn">browse your computer</button></span>
</div>
<div class="dropzone-formats">
Supported: PDF, DOCX, PPTX, TXT, HTML
</div>
</div>
</div>
<!-- Selected Files List -->
<div class="selected-files-list" id="selectedFilesList" style="display: none;">
<div class="files-list-header">
<span>Selected Files</span>
<button type="button" class="btn-text-danger" id="clearFilesBtn">Clear all</button>
</div>
<div class="files-items" id="filesItems"></div>
</div>
<!-- Ingestion Progress Bar -->
<div class="ingest-progress" id="ingestProgress" style="display: none;">
<div class="progress-info">
<span id="ingestProgressStatus">Chunking and embedding documents...</span>
<span id="ingestProgressPercent">Processing...</span>
</div>
<div class="progress-bar-bg">
<div class="progress-bar-fill indeterminate" id="progressBarFill"></div>
</div>
</div>
<!-- Ingestion Result Banner -->
<div class="ingest-alert" id="ingestAlert" style="display: none;">
<div class="alert-icon" id="alertIcon"></div>
<div class="alert-message" id="alertMessage"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" id="cancelIngestBtn">Cancel</button>
<button type="button" class="btn btn-primary" id="startIngestBtn" disabled>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
</svg>
<span>Index Documents</span>
</button>
</div>
</div>
</div>
</div>
{% endblock %} |