3v324v23's picture
Add Table of Contents (TOC) RAG system with new modules, database enhancements, and UI integration.
ce5b66d
:root {
--bg-color: #fafafa;
--sidebar-bg: #f0f0f0;
--text-primary: #1a1a1a;
--text-secondary: #666;
--border-color: #e5e5e5;
--brand-color: #5d3fd3;
/* Purple-ish, similar to Claude */
--hover-color: #f1eeff;
--card-bg: #ffffff;
--sys-msg-bg: #f9f9f9;
--user-msg-bg: #ececf1;
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background-color: var(--bg-color);
color: var(--text-primary);
display: flex;
height: 100vh;
overflow: hidden;
}
/* App Layout */
.app-container {
display: flex;
width: 100%;
height: 100%;
}
/* Sidebar */
.sidebar {
width: 280px;
min-width: 280px;
background-color: var(--sidebar-bg);
border-right: 1px solid var(--border-color);
display: flex;
flex-direction: column;
padding: 24px 16px;
overflow-y: auto;
}
.sidebar-header {
margin-bottom: 32px;
}
.sidebar-header h2 {
font-size: 1.25rem;
font-weight: 600;
}
.sidebar-section {
margin-bottom: 24px;
}
.sidebar-section h3 {
font-size: 0.875rem;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 12px;
}
.file-input,
.num-input {
width: 100%;
margin-bottom: 12px;
padding: 8px;
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
font-family: inherit;
font-size: 0.875rem;
background: var(--card-bg);
}
.btn {
width: 100%;
padding: 10px 16px;
border: none;
border-radius: var(--radius-sm);
font-weight: 500;
font-size: 0.875rem;
cursor: pointer;
transition: all 0.2s ease;
}
.btn.primary {
background-color: var(--brand-color);
color: white;
}
.btn.primary:hover {
background-color: #4b32b0;
}
.btn.secondary {
background-color: white;
border: 1px solid var(--border-color);
color: var(--text-primary);
}
.btn.secondary:hover {
background-color: var(--hover-color);
border-color: var(--brand-color);
}
.status-msg {
font-size: 0.8rem;
color: var(--text-secondary);
margin-top: 8px;
text-align: center;
}
/* Main Content */
.main-content {
flex: 1;
display: flex;
flex-direction: column;
position: relative;
max-width: 1200px;
margin: 0 auto;
width: 100%;
}
.top-nav {
padding: 16px 24px;
border-bottom: 1px solid var(--border-color);
background-color: var(--bg-color);
text-align: center;
position: sticky;
top: 0;
z-index: 10;
}
.top-nav h1 {
font-size: 1.1rem;
font-weight: 600;
}
.top-nav p {
font-size: 0.875rem;
color: var(--text-secondary);
}
/* Chat Area */
.chat-area {
flex: 1;
overflow-y: auto;
padding: 24px;
display: flex;
flex-direction: column;
gap: 32px;
scroll-behavior: smooth;
}
/* Messages */
.message {
display: flex;
flex-direction: column;
max-width: 100%;
margin: 0 auto;
width: 100%;
}
.message.user {
align-items: flex-end;
}
.user-bubble {
background-color: var(--user-msg-bg);
padding: 16px 24px;
border-radius: 20px 20px 4px 20px;
max-width: 70%;
font-size: 1rem;
line-height: 1.5;
}
.system-responses {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 24px;
width: 100%;
}
.response-card {
background-color: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
padding: 24px;
box-shadow: var(--shadow-sm);
display: flex;
flex-direction: column;
}
.response-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid var(--border-color);
}
.response-header span {
font-weight: 600;
font-size: 0.95rem;
color: var(--brand-color);
}
.response-content {
flex: 1;
font-size: 0.95rem;
line-height: 1.6;
color: var(--text-primary);
}
.response-content p {
margin-bottom: 1em;
}
.response-content ul,
.response-content ol {
margin-bottom: 1em;
padding-left: 20px;
}
.response-content code {
background-color: rgba(0, 0, 0, 0.05);
padding: 0.2em 0.4em;
border-radius: 4px;
font-family: monospace;
font-size: 0.9em;
}
/* Metrics UI */
.metrics {
margin-top: 16px;
padding-top: 16px;
border-top: 1px dashed var(--border-color);
display: flex;
flex-direction: column;
gap: 8px;
font-size: 0.8rem;
color: var(--text-secondary);
}
.metrics-row {
display: flex;
justify-content: space-between;
}
.sources-container {
margin-top: 12px;
}
.sources-toggle {
background: none;
border: none;
color: var(--brand-color);
font-size: 0.8rem;
font-weight: 500;
cursor: pointer;
display: flex;
align-items: center;
gap: 4px;
}
.sources-toggle:hover {
text-decoration: underline;
}
.sources-list {
margin-top: 8px;
display: none;
background: var(--bg-color);
padding: 12px;
border-radius: var(--radius-sm);
border: 1px solid var(--border-color);
max-height: 200px;
overflow-y: auto;
}
.sources-list.open {
display: block;
}
.source-item {
margin-bottom: 12px;
padding-bottom: 12px;
border-bottom: 1px dashed var(--border-color);
}
.source-item:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}
.source-meta {
font-weight: 600;
display: block;
margin-bottom: 4px;
color: var(--text-primary);
}
/* Input Area */
.input-area {
padding: 24px;
background: linear-gradient(to top, var(--bg-color) 80%, transparent);
position: sticky;
bottom: 0;
}
.input-wrapper {
max-width: 800px;
margin: 0 auto;
background-color: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
padding: 12px 16px;
display: flex;
align-items: flex-end;
transition: border-color 0.2s;
}
.input-wrapper:focus-within {
border-color: var(--brand-color);
}
#prompt-input {
flex: 1;
border: none;
background: transparent;
font-family: inherit;
font-size: 1rem;
line-height: 1.5;
resize: none;
outline: none;
max-height: 200px;
padding: 4px 0;
}
.send-btn {
background: var(--brand-color);
color: white;
border: none;
border-radius: var(--radius-sm);
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background-color 0.2s;
flex-shrink: 0;
margin-left: 12px;
}
.send-btn:hover {
background-color: #4b32b0;
}
.send-btn:disabled {
background-color: var(--border-color);
cursor: not-allowed;
}
/* Loader */
.typing-indicator {
display: inline-block;
width: 4px;
height: 1em;
background-color: var(--text-primary);
animation: blink 1s step-end infinite;
vertical-align: middle;
}
@keyframes blink {
50% {
opacity: 0;
}
}
/* Documents Grid */
.documents-grid {
margin-top: 16px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
gap: 12px;
}
.document-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 8px;
text-align: center;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
transition: transform 0.2s, box-shadow 0.2s;
}
.document-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-sm);
border-color: var(--brand-color);
}
.doc-icon {
width: 32px;
height: 32px;
margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
font-weight: bold;
font-size: 0.75rem;
color: white;
}
.icon-pdf {
background-color: #e53935;
}
.icon-docx {
background-color: #1e88e5;
}
.icon-txt {
background-color: #757575;
}
.icon-default {
background-color: #9e9e9e;
}
.doc-name {
font-size: 0.75rem;
font-weight: 500;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.doc-size {
font-size: 0.65rem;
color: var(--text-secondary);
margin-top: 4px;
}
.spinner {
display: inline-block;
width: 16px;
height: 16px;
border: 2px solid rgba(0, 0, 0, 0.1);
border-left-color: var(--brand-color);
border-radius: 50%;
animation: spin 1s linear infinite;
vertical-align: middle;
margin-right: 8px;
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
/* Full-Screen Loading Overlay */
.overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(250, 250, 250, 0.85);
/* Frosty var(--bg-color) */
backdrop-filter: blur(4px);
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
}
.overlay-content {
background: var(--card-bg);
padding: 32px 48px;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
border: 1px solid var(--border-color);
text-align: center;
max-width: 400px;
}
.overlay-content h2 {
font-size: 1.25rem;
margin-bottom: 8px;
font-weight: 600;
}
.overlay-content p {
font-size: 0.9rem;
color: var(--text-secondary);
}
.large-spinner {
width: 32px;
height: 32px;
border-width: 3px;
margin: 0 auto 16px;
display: block;
}
.doc-thumbnail {
width: 100%;
height: 80px;
object-fit: cover;
border-radius: 4px;
margin-bottom: 8px;
background-color: var(--sidebar-bg);
border: 1px solid var(--border-color);
}
/* Token Badges */
.token-badges {
display: flex;
gap: 8px;
align-items: center;
}
.badge {
padding: 2px 8px;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 500;
font-family: monospace;
}
.prompt-badge {
background-color: #e0f2fe;
color: #0369a1;
border: 1px solid #bae6fd;
}
.completion-badge {
background-color: #fce7f3;
color: #be185d;
border: 1px solid #fbcfe8;
}
/* Modal Styles */
.modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(4px);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.modal-content {
background: var(--bg-color);
width: 90vw;
height: 90vh;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
display: flex;
flex-direction: column;
overflow: hidden;
}
.modal-header {
padding: 24px;
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
background: var(--card-bg);
}
.modal-header h2 {
font-size: 1.25rem;
font-weight: 600;
}
.close-btn {
background: none;
border: none;
font-size: 2rem;
cursor: pointer;
color: var(--text-secondary);
transition: color 0.2s;
line-height: 1;
}
.close-btn:hover {
color: var(--text-primary);
}
.modal-body {
flex: 1;
overflow: hidden;
padding: 24px;
}
.comparison-container {
display: flex;
gap: 24px;
height: 100%;
}
.chunk-column {
flex: 1;
display: flex;
flex-direction: column;
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
overflow: hidden;
}
.column-header {
padding: 16px;
background: var(--sidebar-bg);
border-bottom: 1px solid var(--border-color);
font-weight: 600;
font-size: 0.95rem;
color: var(--brand-color);
text-align: center;
}
.chunks-list {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}
.chunk-item {
background: var(--user-msg-bg);
border-radius: var(--radius-sm);
padding: 16px;
font-size: 0.9rem;
line-height: 1.5;
border: 1px solid transparent;
transition: border-color 0.2s;
}
.chunk-item:hover {
border-color: var(--brand-color);
}
.chunk-meta {
font-weight: 600;
color: var(--brand-color);
margin-bottom: 8px;
display: block;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.chunk-text {
white-space: pre-wrap;
word-break: break-word;
}
/* Modal Styles */
.modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(4px);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.modal-content {
background: var(--bg-color);
width: 90vw;
height: 90vh;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-md);
display: flex;
flex-direction: column;
overflow: hidden;
}
.modal-header {
padding: 24px;
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
background: var(--card-bg);
}
.modal-header h2 {
font-size: 1.25rem;
font-weight: 600;
}
.close-btn {
background: none;
border: none;
font-size: 2rem;
cursor: pointer;
color: var(--text-secondary);
transition: color 0.2s;
line-height: 1;
}
.close-btn:hover {
color: var(--text-primary);
}
.modal-body {
flex: 1;
overflow: hidden;
padding: 24px;
}
.comparison-container {
display: flex;
gap: 24px;
height: 100%;
}
.chunk-column {
flex: 1;
display: flex;
flex-direction: column;
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
overflow: hidden;
}
.column-header {
padding: 16px;
background: var(--sidebar-bg);
border-bottom: 1px solid var(--border-color);
font-weight: 600;
font-size: 0.95rem;
color: var(--brand-color);
text-align: center;
}
.chunks-list {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}
.chunk-item {
background: var(--user-msg-bg);
border-radius: var(--radius-sm);
padding: 16px;
font-size: 0.9rem;
line-height: 1.5;
border: 1px solid transparent;
transition: border-color 0.2s;
}
.chunk-item:hover {
border-color: var(--brand-color);
}
.chunk-meta {
font-weight: 600;
color: var(--brand-color);
margin-bottom: 8px;
display: block;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.chunk-text {
white-space: pre-wrap;
word-break: break-word;
}
/* Cost Tracking Sidebar */
.cost-stats {
display: flex;
flex-direction: column;
gap: 6px;
font-size: 0.85rem;
padding: 8px 0;
}
.cost-stats div {
display: flex;
justify-content: space-between;
}
.cost-label {
color: var(--secondary-text);
}
.cost-value {
font-family: monospace;
color: var(--text-color);
}
.cost-total-row {
margin-top: 6px;
padding-top: 6px;
border-top: 1px dashed var(--border-color);
}
.cost-total {
font-weight: bold;
color: #10b981;
}