Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- templates/base.html +130 -51
- templates/chat.html +99 -212
- templates/create_db.html +51 -237
- templates/home.html +56 -14
- templates/list_dbs.html +58 -164
templates/base.html
CHANGED
|
@@ -4,106 +4,184 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Document AI</title>
|
|
|
|
|
|
|
| 7 |
<!-- Bootstrap CSS -->
|
| 8 |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
|
|
|
| 9 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
body {
|
| 11 |
-
background-color:
|
| 12 |
-
color:
|
| 13 |
-
font-family: '
|
|
|
|
|
|
|
|
|
|
| 14 |
}
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
.navbar {
|
| 17 |
-
background-color:
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
.navbar-brand {
|
| 22 |
-
font-weight:
|
| 23 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
.navbar-nav .nav-link {
|
| 27 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
| 29 |
|
| 30 |
.navbar-nav .nav-link:hover {
|
| 31 |
-
color:
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
|
|
|
|
| 38 |
.card {
|
| 39 |
-
background-color:
|
| 40 |
-
border:
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
|
| 45 |
-
.card
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
}
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 52 |
|
| 53 |
-
.
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
}
|
| 56 |
|
|
|
|
| 57 |
.btn-primary {
|
| 58 |
-
background
|
| 59 |
-
border
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
.btn-primary:hover {
|
| 63 |
-
background
|
| 64 |
-
|
|
|
|
| 65 |
}
|
| 66 |
|
|
|
|
| 67 |
footer {
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
bottom: 0;
|
| 75 |
-
border-top: 2px solid #444;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
footer p {
|
| 79 |
-
margin: 0;
|
| 80 |
-
font-size: 14px;
|
| 81 |
}
|
| 82 |
</style>
|
| 83 |
</head>
|
| 84 |
|
| 85 |
<body>
|
| 86 |
<!-- Navigation Bar -->
|
| 87 |
-
<nav class="navbar navbar-expand-lg">
|
| 88 |
-
<div class="container-fluid">
|
| 89 |
-
<a class="navbar-brand" href="/">
|
|
|
|
|
|
|
| 90 |
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
| 91 |
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
| 92 |
-
<
|
| 93 |
</button>
|
| 94 |
<div class="collapse navbar-collapse" id="navbarNav">
|
| 95 |
<ul class="navbar-nav ms-auto">
|
| 96 |
<li class="nav-item">
|
| 97 |
-
<a class="nav-link" href="/">Home</a>
|
| 98 |
</li>
|
| 99 |
<li class="nav-item">
|
| 100 |
-
<a class="nav-link" href="/create-db">Create DB</a>
|
| 101 |
</li>
|
| 102 |
<li class="nav-item">
|
| 103 |
-
<a class="nav-link" href="/list-dbs">List DBs</a>
|
| 104 |
</li>
|
| 105 |
<li class="nav-item">
|
| 106 |
-
<a class="nav-link" href="/chat">Chat</a>
|
| 107 |
</li>
|
| 108 |
</ul>
|
| 109 |
</div>
|
|
@@ -111,19 +189,20 @@
|
|
| 111 |
</nav>
|
| 112 |
|
| 113 |
<!-- Main Content -->
|
| 114 |
-
<div class="container">
|
| 115 |
{% block content %}
|
| 116 |
<!-- Page-specific content will go here -->
|
| 117 |
{% endblock %}
|
| 118 |
</div>
|
| 119 |
|
| 120 |
<!-- Footer -->
|
| 121 |
-
<footer
|
| 122 |
-
<
|
|
|
|
|
|
|
| 123 |
</footer>
|
| 124 |
|
| 125 |
<!-- Bootstrap JS -->
|
| 126 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
| 127 |
-
|
| 128 |
</body>
|
| 129 |
-
</html>
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Document AI</title>
|
| 7 |
+
<!-- Google Fonts -->
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
| 9 |
<!-- Bootstrap CSS -->
|
| 10 |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 11 |
+
<!-- Bootstrap Icons -->
|
| 12 |
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" rel="stylesheet">
|
| 13 |
<style>
|
| 14 |
+
:root {
|
| 15 |
+
--bg-main: #0f172a;
|
| 16 |
+
--bg-card: #1e293b;
|
| 17 |
+
--text-main: #f8fafc;
|
| 18 |
+
--text-muted: #94a3b8;
|
| 19 |
+
--accent-primary: #3b82f6;
|
| 20 |
+
--accent-hover: #2563eb;
|
| 21 |
+
--accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
|
| 22 |
+
--border-color: #334155;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
body {
|
| 26 |
+
background-color: var(--bg-main);
|
| 27 |
+
color: var(--text-main);
|
| 28 |
+
font-family: 'Inter', sans-serif;
|
| 29 |
+
min-height: 100vh;
|
| 30 |
+
display: flex;
|
| 31 |
+
flex-direction: column;
|
| 32 |
}
|
| 33 |
|
| 34 |
+
/* Custom Scrollbar */
|
| 35 |
+
::-webkit-scrollbar {
|
| 36 |
+
width: 8px;
|
| 37 |
+
}
|
| 38 |
+
::-webkit-scrollbar-track {
|
| 39 |
+
background: var(--bg-main);
|
| 40 |
+
}
|
| 41 |
+
::-webkit-scrollbar-thumb {
|
| 42 |
+
background: var(--border-color);
|
| 43 |
+
border-radius: 4px;
|
| 44 |
+
}
|
| 45 |
+
::-webkit-scrollbar-thumb:hover {
|
| 46 |
+
background: var(--text-muted);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/* Navbar */
|
| 50 |
.navbar {
|
| 51 |
+
background-color: rgba(30, 41, 59, 0.8) !important;
|
| 52 |
+
backdrop-filter: blur(10px);
|
| 53 |
+
border-bottom: 1px solid var(--border-color);
|
| 54 |
+
padding: 1rem 0;
|
| 55 |
}
|
| 56 |
|
| 57 |
.navbar-brand {
|
| 58 |
+
font-weight: 700;
|
| 59 |
+
color: var(--text-main) !important;
|
| 60 |
+
display: flex;
|
| 61 |
+
align-items: center;
|
| 62 |
+
gap: 8px;
|
| 63 |
+
font-size: 1.4rem;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.navbar-brand i {
|
| 67 |
+
background: var(--accent-gradient);
|
| 68 |
+
-webkit-background-clip: text;
|
| 69 |
+
-webkit-text-fill-color: transparent;
|
| 70 |
}
|
| 71 |
|
| 72 |
.navbar-nav .nav-link {
|
| 73 |
+
color: var(--text-muted) !important;
|
| 74 |
+
font-weight: 500;
|
| 75 |
+
padding: 0.5rem 1rem;
|
| 76 |
+
border-radius: 6px;
|
| 77 |
+
transition: all 0.2s ease;
|
| 78 |
}
|
| 79 |
|
| 80 |
.navbar-nav .nav-link:hover {
|
| 81 |
+
color: var(--text-main) !important;
|
| 82 |
+
background-color: rgba(255, 255, 255, 0.05);
|
| 83 |
}
|
| 84 |
|
| 85 |
+
/* Main Container */
|
| 86 |
+
.container.main-content {
|
| 87 |
+
margin-top: 40px;
|
| 88 |
+
flex: 1;
|
| 89 |
}
|
| 90 |
|
| 91 |
+
/* Cards */
|
| 92 |
.card {
|
| 93 |
+
background-color: var(--bg-card);
|
| 94 |
+
border: 1px solid var(--border-color);
|
| 95 |
+
border-radius: 12px;
|
| 96 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 97 |
+
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.card-title {
|
| 101 |
+
color: var(--text-main);
|
| 102 |
+
font-weight: 600;
|
| 103 |
}
|
| 104 |
|
| 105 |
+
.card-header {
|
| 106 |
+
background-color: rgba(0,0,0,0.1);
|
| 107 |
+
border-bottom: 1px solid var(--border-color);
|
| 108 |
+
border-top-left-radius: 12px !important;
|
| 109 |
+
border-top-right-radius: 12px !important;
|
| 110 |
+
padding: 1.25rem;
|
| 111 |
}
|
| 112 |
|
| 113 |
+
/* Inputs & Forms */
|
| 114 |
+
.form-control {
|
| 115 |
+
background-color: rgba(15, 23, 42, 0.5);
|
| 116 |
+
border: 1px solid var(--border-color);
|
| 117 |
+
color: var(--text-main);
|
| 118 |
+
border-radius: 8px;
|
| 119 |
+
padding: 0.75rem 1rem;
|
| 120 |
}
|
| 121 |
|
| 122 |
+
.form-control:focus {
|
| 123 |
+
background-color: rgba(15, 23, 42, 0.8);
|
| 124 |
+
border-color: var(--accent-primary);
|
| 125 |
+
color: var(--text-main);
|
| 126 |
+
box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.form-control::placeholder {
|
| 130 |
+
color: var(--text-muted);
|
| 131 |
}
|
| 132 |
|
| 133 |
+
/* Buttons */
|
| 134 |
.btn-primary {
|
| 135 |
+
background: var(--accent-gradient);
|
| 136 |
+
border: none;
|
| 137 |
+
font-weight: 500;
|
| 138 |
+
padding: 0.6rem 1.5rem;
|
| 139 |
+
border-radius: 8px;
|
| 140 |
+
transition: opacity 0.2s ease, transform 0.2s ease;
|
| 141 |
}
|
| 142 |
|
| 143 |
.btn-primary:hover {
|
| 144 |
+
background: var(--accent-gradient);
|
| 145 |
+
opacity: 0.9;
|
| 146 |
+
transform: translateY(-1px);
|
| 147 |
}
|
| 148 |
|
| 149 |
+
/* Footer */
|
| 150 |
footer {
|
| 151 |
+
margin-top: auto;
|
| 152 |
+
padding: 2rem 0;
|
| 153 |
+
text-align: center;
|
| 154 |
+
color: var(--text-muted);
|
| 155 |
+
border-top: 1px solid var(--border-color);
|
| 156 |
+
background-color: var(--bg-card);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
}
|
| 158 |
</style>
|
| 159 |
</head>
|
| 160 |
|
| 161 |
<body>
|
| 162 |
<!-- Navigation Bar -->
|
| 163 |
+
<nav class="navbar navbar-expand-lg sticky-top">
|
| 164 |
+
<div class="container-fluid px-4">
|
| 165 |
+
<a class="navbar-brand" href="/">
|
| 166 |
+
<i class="bi bi-robot"></i> Document AI
|
| 167 |
+
</a>
|
| 168 |
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
| 169 |
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
| 170 |
+
<i class="bi bi-list text-white fs-2"></i>
|
| 171 |
</button>
|
| 172 |
<div class="collapse navbar-collapse" id="navbarNav">
|
| 173 |
<ul class="navbar-nav ms-auto">
|
| 174 |
<li class="nav-item">
|
| 175 |
+
<a class="nav-link" href="/"><i class="bi bi-house-door me-1"></i> Home</a>
|
| 176 |
</li>
|
| 177 |
<li class="nav-item">
|
| 178 |
+
<a class="nav-link" href="/create-db"><i class="bi bi-database-add me-1"></i> Create DB</a>
|
| 179 |
</li>
|
| 180 |
<li class="nav-item">
|
| 181 |
+
<a class="nav-link" href="/list-dbs"><i class="bi bi-server me-1"></i> List DBs</a>
|
| 182 |
</li>
|
| 183 |
<li class="nav-item">
|
| 184 |
+
<a class="nav-link" href="/chat"><i class="bi bi-chat-left-dots me-1"></i> Chat</a>
|
| 185 |
</li>
|
| 186 |
</ul>
|
| 187 |
</div>
|
|
|
|
| 189 |
</nav>
|
| 190 |
|
| 191 |
<!-- Main Content -->
|
| 192 |
+
<div class="container main-content mb-5">
|
| 193 |
{% block content %}
|
| 194 |
<!-- Page-specific content will go here -->
|
| 195 |
{% endblock %}
|
| 196 |
</div>
|
| 197 |
|
| 198 |
<!-- Footer -->
|
| 199 |
+
<footer>
|
| 200 |
+
<div class="container">
|
| 201 |
+
<p class="mb-0">© 2024 Document AI. All rights reserved.</p>
|
| 202 |
+
</div>
|
| 203 |
</footer>
|
| 204 |
|
| 205 |
<!-- Bootstrap JS -->
|
| 206 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
| 207 |
</body>
|
| 208 |
+
</html>
|
templates/chat.html
CHANGED
|
@@ -1,230 +1,117 @@
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
.container {
|
| 17 |
-
display: flex;
|
| 18 |
-
height: 80vh;
|
| 19 |
-
margin-top: 40px;
|
| 20 |
-
align-items: center;
|
| 21 |
-
justify-content: center;
|
| 22 |
-
gap: 30px;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
.container-flash {
|
| 26 |
-
display: flex;
|
| 27 |
-
height: 10vh;
|
| 28 |
-
margin-top: 10px;
|
| 29 |
-
align-items: center;
|
| 30 |
-
justify-content: center;
|
| 31 |
-
gap: 30px;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
.card {
|
| 35 |
-
background: #2c2c3e;
|
| 36 |
-
border-radius: 10px;
|
| 37 |
-
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
|
| 38 |
-
padding: 20px;
|
| 39 |
-
width: 45%;
|
| 40 |
-
height: 100%;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
.card-title {
|
| 44 |
-
font-size: 20px;
|
| 45 |
-
font-weight: bold;
|
| 46 |
-
text-align: center;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
.form-group input {
|
| 50 |
-
border-radius: 6px;
|
| 51 |
-
padding: 10px;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
.btn-primary {
|
| 55 |
-
background-color: #007bff;
|
| 56 |
-
border-color: #007bff;
|
| 57 |
-
width: 100%;
|
| 58 |
-
padding: 10px;
|
| 59 |
-
border-radius: 6px;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
.btn-primary:hover {
|
| 63 |
-
background-color: #0056b3;
|
| 64 |
-
border-color: #0056b3;
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
/* Loader */
|
| 68 |
-
.loader {
|
| 69 |
-
display: none;
|
| 70 |
-
border: 4px solid rgba(255, 255, 255, 0.3);
|
| 71 |
-
border-top: 4px solid #007bff;
|
| 72 |
-
border-radius: 50%;
|
| 73 |
-
width: 30px;
|
| 74 |
-
height: 30px;
|
| 75 |
-
animation: spin 1s linear infinite;
|
| 76 |
-
margin: auto;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
@keyframes spin {
|
| 80 |
-
0% { transform: rotate(0deg); }
|
| 81 |
-
100% { transform: rotate(360deg); }
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
/* Answer Section */
|
| 85 |
-
.answer-section{
|
| 86 |
-
overflow-y: auto;
|
| 87 |
-
max-height: 70vh;
|
| 88 |
-
padding: 10px;
|
| 89 |
-
border-radius: 6px;
|
| 90 |
-
background: #2c2c3e;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
.answer-section h6 {
|
| 94 |
-
color: #ffffff;
|
| 95 |
-
font-weight: bold;
|
| 96 |
-
text-align: center;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
.answer-item {
|
| 100 |
-
background: #1a1a2e;
|
| 101 |
-
padding: 10px;
|
| 102 |
-
border-radius: 6px;
|
| 103 |
-
margin-bottom: 10px;
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
.token-count {
|
| 107 |
-
font-size: 12px;
|
| 108 |
-
color: #b0b0b0;
|
| 109 |
-
text-align: right;
|
| 110 |
-
margin-top: 10px;
|
| 111 |
-
font-style: italic;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
/* History Section */
|
| 115 |
-
.history-section {
|
| 116 |
-
overflow-y: auto;
|
| 117 |
-
max-height: 70vh;
|
| 118 |
-
padding: 10px;
|
| 119 |
-
border-radius: 6px;
|
| 120 |
-
background: #2c2c3e;
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
.history-item {
|
| 124 |
-
background: #1a1a2e;
|
| 125 |
-
padding: 10px;
|
| 126 |
-
border-radius: 6px;
|
| 127 |
-
margin-bottom: 10px;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
.alert {
|
| 131 |
-
padding: 10px;
|
| 132 |
-
margin-bottom: 10px;
|
| 133 |
-
border-radius: 5px;
|
| 134 |
-
text-align: center;
|
| 135 |
-
position: absolute;
|
| 136 |
-
position-area: top center;
|
| 137 |
-
top: 30px;
|
| 138 |
-
align-items: center;
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
.alert-error {
|
| 142 |
-
background-color: #D84040;
|
| 143 |
-
color: #ffffff;
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
.alert-success {
|
| 147 |
-
background-color: #D2DE32;
|
| 148 |
-
color: #ffffff;
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
.alert-warning {
|
| 152 |
-
background-color: #FFC700;
|
| 153 |
-
color: #ffffff;
|
| 154 |
-
}
|
| 155 |
-
</style>
|
| 156 |
-
<div class="container-flash">
|
| 157 |
-
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 158 |
-
{% if messages %}
|
| 159 |
-
<div id="flash-message" class="alert alert-{{ messages[0][0] }}">
|
| 160 |
-
<strong>{{ messages[0][1] }}</strong>
|
| 161 |
-
</div>
|
| 162 |
-
{% endif %}
|
| 163 |
-
{% endwith %}
|
| 164 |
-
</div>
|
| 165 |
-
|
| 166 |
-
<div class="container">
|
| 167 |
-
<!-- Left Pane -->
|
| 168 |
-
<div class="card">
|
| 169 |
-
<h5 class="card-title">Document AI</h5>
|
| 170 |
-
<p>Enter a query and get an answer based on stored context.</p>
|
| 171 |
-
|
| 172 |
-
<form method="POST" action="{{ url_for('chat') }}" onsubmit="showLoader()">
|
| 173 |
-
<div class="form-group">
|
| 174 |
-
<input type="text" name="query_text" placeholder="Enter your query" value="{{ query_text }}" required class="form-control">
|
| 175 |
-
</div>
|
| 176 |
-
<div class="form-group mt-2">
|
| 177 |
-
<button type="submit" class="btn btn-primary">Submit</button>
|
| 178 |
</div>
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
<div class="loader" id="loader"></div>
|
| 182 |
-
|
| 183 |
-
{% if answer %}
|
| 184 |
-
<div class="answer-section">
|
| 185 |
-
<div class="answer-item">
|
| 186 |
-
<h6><strong>Answer:</strong></h6>
|
| 187 |
-
<hr>
|
| 188 |
-
{{ answer }}
|
| 189 |
</div>
|
| 190 |
-
<div class="token-count">Tokens Used: {{ token_count }}</div>
|
| 191 |
</div>
|
| 192 |
-
{% endif %}
|
| 193 |
</div>
|
| 194 |
|
| 195 |
-
<!-- Right Pane -->
|
| 196 |
-
<div class="
|
| 197 |
-
<
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
<
|
| 202 |
-
|
| 203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
</div>
|
| 205 |
-
{% endfor %}
|
| 206 |
</div>
|
| 207 |
</div>
|
| 208 |
</div>
|
| 209 |
|
| 210 |
-
<
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
|
|
|
| 220 |
}
|
| 221 |
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
}
|
| 227 |
-
};
|
| 228 |
-
</script>
|
| 229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
{% endblock %}
|
|
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 4 |
+
<div class="row h-100 g-4">
|
| 5 |
+
|
| 6 |
+
<!-- Left Pane: Active Chat Interaction -->
|
| 7 |
+
<div class="col-lg-5">
|
| 8 |
+
<div class="card h-100 shadow">
|
| 9 |
+
<div class="card-header bg-transparent border-0 pt-4 pb-2">
|
| 10 |
+
<h4 class="card-title d-flex align-items-center gap-2">
|
| 11 |
+
<i class="bi bi-robot text-primary"></i> Ask Document AI
|
| 12 |
+
</h4>
|
| 13 |
+
<p class="text-muted small mb-0">Query your selected vector database.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
</div>
|
| 15 |
+
|
| 16 |
+
<div class="card-body d-flex flex-column p-4">
|
| 17 |
+
|
| 18 |
+
<!-- Input Form -->
|
| 19 |
+
<form method="POST" action="{{ url_for('chat') }}" class="mb-4">
|
| 20 |
+
<div class="form-group mb-3">
|
| 21 |
+
<textarea name="query_text" rows="3" class="form-control"
|
| 22 |
+
placeholder="Type your question here..." required>{{ query_text }}</textarea>
|
| 23 |
+
</div>
|
| 24 |
+
<button type="submit" class="btn btn-primary w-100 d-flex align-items-center justify-content-center gap-2">
|
| 25 |
+
<i class="bi bi-send"></i> Submit Query
|
| 26 |
+
</button>
|
| 27 |
+
</form>
|
| 28 |
+
|
| 29 |
+
<!-- Current Answer Display -->
|
| 30 |
+
{% if answer %}
|
| 31 |
+
<div class="current-answer-wrapper flex-grow-1">
|
| 32 |
+
<div class="d-flex align-items-center gap-2 mb-2 text-primary">
|
| 33 |
+
<i class="bi bi-stars"></i> <h6 class="mb-0 fw-bold">AI Response</h6>
|
| 34 |
+
</div>
|
| 35 |
+
<div class="answer-box p-4 rounded bg-dark border border-primary">
|
| 36 |
+
{{ answer }}
|
| 37 |
+
</div>
|
| 38 |
+
</div>
|
| 39 |
+
{% endif %}
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
</div>
|
|
|
|
| 42 |
</div>
|
|
|
|
| 43 |
</div>
|
| 44 |
|
| 45 |
+
<!-- Right Pane: Chat History -->
|
| 46 |
+
<div class="col-lg-7">
|
| 47 |
+
<div class="card h-100 shadow d-flex flex-column">
|
| 48 |
+
<div class="card-header bg-transparent border-bottom pt-4 pb-3">
|
| 49 |
+
<h5 class="card-title mb-0 d-flex align-items-center gap-2">
|
| 50 |
+
<i class="bi bi-clock-history text-muted"></i> Conversation History
|
| 51 |
+
</h5>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div class="card-body p-4 history-scroll-area flex-grow-1" style="max-height: 70vh; overflow-y: auto;">
|
| 55 |
+
{% if history %}
|
| 56 |
+
<div class="d-flex flex-column gap-4">
|
| 57 |
+
{% for question, ans in history %}
|
| 58 |
+
<div class="history-pair">
|
| 59 |
+
<!-- User Question Bubble -->
|
| 60 |
+
<div class="d-flex justify-content-end mb-2">
|
| 61 |
+
<div class="query-bubble p-3 rounded-4 bg-primary text-white" style="max-width: 85%; border-bottom-right-radius: 4px !important;">
|
| 62 |
+
<strong><i class="bi bi-person me-1"></i> You:</strong><br>
|
| 63 |
+
{{ question }}
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
<!-- AI Answer Bubble -->
|
| 67 |
+
<div class="d-flex justify-content-start">
|
| 68 |
+
<div class="answer-bubble p-3 rounded-4 bg-dark text-light border border-secondary" style="max-width: 85%; border-top-left-radius: 4px !important;">
|
| 69 |
+
<strong><i class="bi bi-robot me-1 text-primary"></i> AI:</strong><br>
|
| 70 |
+
{{ ans }}
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
{% endfor %}
|
| 75 |
+
</div>
|
| 76 |
+
{% else %}
|
| 77 |
+
<div class="h-100 d-flex flex-column align-items-center justify-content-center text-muted opacity-50">
|
| 78 |
+
<i class="bi bi-chat-left text-muted mb-3" style="font-size: 3rem;"></i>
|
| 79 |
+
<p>Your conversation history will appear here.</p>
|
| 80 |
+
</div>
|
| 81 |
+
{% endif %}
|
| 82 |
</div>
|
|
|
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
</div>
|
| 86 |
|
| 87 |
+
<style>
|
| 88 |
+
.answer-box {
|
| 89 |
+
background: linear-gradient(180deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.8) 100%);
|
| 90 |
+
border-color: rgba(59, 130, 246, 0.3) !important;
|
| 91 |
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
|
| 92 |
+
line-height: 1.6;
|
| 93 |
+
font-size: 1.05rem;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.query-bubble {
|
| 97 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 98 |
}
|
| 99 |
|
| 100 |
+
.answer-bubble {
|
| 101 |
+
background-color: #1e293b !important;
|
| 102 |
+
border-color: #334155 !important;
|
| 103 |
+
}
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
+
/* History Scrollbar Tweaks */
|
| 106 |
+
.history-scroll-area::-webkit-scrollbar {
|
| 107 |
+
width: 6px;
|
| 108 |
+
}
|
| 109 |
+
.history-scroll-area::-webkit-scrollbar-track {
|
| 110 |
+
background: transparent;
|
| 111 |
+
}
|
| 112 |
+
.history-scroll-area::-webkit-scrollbar-thumb {
|
| 113 |
+
background: var(--border-color);
|
| 114 |
+
border-radius: 10px;
|
| 115 |
+
}
|
| 116 |
+
</style>
|
| 117 |
{% endblock %}
|
templates/create_db.html
CHANGED
|
@@ -1,244 +1,58 @@
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 4 |
-
<
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
.container {
|
| 11 |
-
display: flex;
|
| 12 |
-
flex-direction: column;
|
| 13 |
-
height: 80vh; /* Fill the viewport height */
|
| 14 |
-
}
|
| 15 |
-
|
| 16 |
-
.card {
|
| 17 |
-
margin: auto;
|
| 18 |
-
background-color: #2c2c3e;
|
| 19 |
-
color: #f5f5f5;
|
| 20 |
-
border: none;
|
| 21 |
-
width: 50%;
|
| 22 |
-
height: 70%; /* Fixed height for the card */
|
| 23 |
-
display: flex;
|
| 24 |
-
flex-direction: column;
|
| 25 |
-
justify-content: space-between;
|
| 26 |
-
padding: 1rem;
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
.card-header {
|
| 30 |
-
background-color: #181831;
|
| 31 |
-
border-bottom: 2px solid #444;
|
| 32 |
-
padding: 1rem;
|
| 33 |
-
text-align: center;
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
.form-label {
|
| 37 |
-
font-weight: bold;
|
| 38 |
-
color: #cfcfcf;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
.form-control {
|
| 42 |
-
background-color: #1e1e2f;
|
| 43 |
-
color: #f5f5f5;
|
| 44 |
-
border: 1px solid #444;
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
.form-control:focus {
|
| 48 |
-
background-color: #1e1e2f;
|
| 49 |
-
color: #f5f5f5;
|
| 50 |
-
border-color: #4c4cff;
|
| 51 |
-
box-shadow: 0 0 4px #4c4cff;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
.btn-primary {
|
| 55 |
-
background-color: #4c4cff;
|
| 56 |
-
border-color: #4c4cff;
|
| 57 |
-
display: flex;
|
| 58 |
-
justify-content: center;
|
| 59 |
-
align-items: center;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
.btn-primary:hover {
|
| 63 |
-
background-color: #3838e8;
|
| 64 |
-
border-color: #3838e8;
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
.toggle-switch {
|
| 68 |
-
margin: 1rem 0;
|
| 69 |
-
display: flex;
|
| 70 |
-
justify-content: center;
|
| 71 |
-
align-items: center;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
.toggle-switch input {
|
| 75 |
-
display: none;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
.toggle-label {
|
| 79 |
-
background-color: #444;
|
| 80 |
-
color: #cfcfcf;
|
| 81 |
-
padding: 0.5rem 1.5rem;
|
| 82 |
-
border: 1px solid #555;
|
| 83 |
-
cursor: pointer;
|
| 84 |
-
margin-right: 1rem;
|
| 85 |
-
text-align: center;
|
| 86 |
-
border-radius: 4px;
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
.toggle-label.active {
|
| 90 |
-
background-color: #4c4cff;
|
| 91 |
-
color: #fff;
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
.toggle-label:hover {
|
| 95 |
-
background-color: #3838e8;
|
| 96 |
-
color: #fff;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
.hidden {
|
| 100 |
-
display: none;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
.text-center.d-flex {
|
| 104 |
-
display: flex;
|
| 105 |
-
justify-content: center;
|
| 106 |
-
align-items: center;
|
| 107 |
-
height: 100px;
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
.spinner {
|
| 111 |
-
border: 4px solid #f3f3f3; /* Light grey */
|
| 112 |
-
border-top: 4px solid #4c4cff; /* Blue */
|
| 113 |
-
border-radius: 50%;
|
| 114 |
-
width: 24px;
|
| 115 |
-
height: 24px;
|
| 116 |
-
animation: spin 1s linear infinite;
|
| 117 |
-
margin-left: 10px;
|
| 118 |
-
display: none; /* Initially hidden */
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
@keyframes spin {
|
| 122 |
-
0% { transform: rotate(0deg); }
|
| 123 |
-
100% { transform: rotate(360deg); }
|
| 124 |
-
}
|
| 125 |
-
|
| 126 |
-
.alert {
|
| 127 |
-
padding: 10px;
|
| 128 |
-
margin-bottom: 10px;
|
| 129 |
-
border-radius: 5px;
|
| 130 |
-
text-align: center;
|
| 131 |
-
position: absolute;
|
| 132 |
-
position-area: top center;
|
| 133 |
-
top: 30px;
|
| 134 |
-
align-items: center;
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
.alert-error {
|
| 138 |
-
background-color: #D84040;
|
| 139 |
-
color: #ffffff;
|
| 140 |
-
}
|
| 141 |
-
|
| 142 |
-
.alert-success {
|
| 143 |
-
background-color: #D2DE32;
|
| 144 |
-
color: #ffffff;
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
.alert-warning {
|
| 148 |
-
background-color: #FFC700;
|
| 149 |
-
color: #ffffff;
|
| 150 |
-
}
|
| 151 |
-
</style>
|
| 152 |
-
<div class="container-flash">
|
| 153 |
-
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 154 |
-
{% if messages %}
|
| 155 |
-
<div id="flash-message" class="alert alert-{{ messages[0][0] }}">
|
| 156 |
-
<strong>{{ messages[0][1] }}</strong>
|
| 157 |
-
</div>
|
| 158 |
-
{% endif %}
|
| 159 |
-
{% endwith %}
|
| 160 |
-
</div>
|
| 161 |
-
|
| 162 |
-
<div class="container mt-5">
|
| 163 |
-
<div class="card shadow">
|
| 164 |
-
<div class="card-header">
|
| 165 |
-
<h3>Create a New Vector Database</h3>
|
| 166 |
-
</div>
|
| 167 |
-
<div class="card-body">
|
| 168 |
-
<form id="db-form" method="post" enctype="multipart/form-data">
|
| 169 |
-
<!-- Database Name Input -->
|
| 170 |
-
<div class="form-group">
|
| 171 |
-
<label for="db_name" class="form-label">Database Name</label>
|
| 172 |
-
<input type="text" id="db_name" name="db_name" class="form-control" placeholder="Enter database name" required>
|
| 173 |
-
</div>
|
| 174 |
-
|
| 175 |
-
<!-- Toggle Upload Mode -->
|
| 176 |
-
<div class="toggle-switch">
|
| 177 |
-
<label class="toggle-label active" id="folder-label" for="folder">Upload Folder</label>
|
| 178 |
-
<label class="toggle-label" id="file-label" for="file">Upload Files</label>
|
| 179 |
-
</div>
|
| 180 |
-
|
| 181 |
-
<!-- Folder Upload Input -->
|
| 182 |
-
<div id="folder-upload" class="form-group mt-3">
|
| 183 |
-
<label for="folder" class="form-label">Upload Folder</label>
|
| 184 |
-
<input type="file" id="folder" name="folder" class="form-control" webkitdirectory directory multiple>
|
| 185 |
-
<small class="text-muted">Note: You can upload a folder containing multiple files.</small>
|
| 186 |
-
</div>
|
| 187 |
-
|
| 188 |
-
<!-- Single File Upload Input -->
|
| 189 |
-
<div id="file-upload" class="form-group mt-3 hidden">
|
| 190 |
-
<label for="file" class="form-label">Upload Files</label>
|
| 191 |
-
<input type="file" id="file" name="file" class="form-control" multiple>
|
| 192 |
-
<small class="text-muted">Note: You can upload one or more files.</small>
|
| 193 |
-
</div>
|
| 194 |
-
|
| 195 |
-
<!-- Submit Button -->
|
| 196 |
-
<div class="mt-4 text-center d-flex justify-content-center align-items-center">
|
| 197 |
-
<button type="submit" class="btn btn-primary px-5" id="submit-btn">
|
| 198 |
-
<span class="btn-text">Create</span>
|
| 199 |
-
<div class="spinner" id="spinner"></div>
|
| 200 |
-
</button>
|
| 201 |
</div>
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
</div>
|
| 204 |
</div>
|
| 205 |
</div>
|
| 206 |
-
|
| 207 |
-
<script>
|
| 208 |
-
const folderLabel = document.getElementById('folder-label');
|
| 209 |
-
const fileLabel = document.getElementById('file-label');
|
| 210 |
-
const folderUpload = document.getElementById('folder-upload');
|
| 211 |
-
const fileUpload = document.getElementById('file-upload');
|
| 212 |
-
const submitBtn = document.getElementById('submit-btn');
|
| 213 |
-
const spinner = document.getElementById('spinner');
|
| 214 |
-
const flashMessage = document.getElementById('flash-message');
|
| 215 |
-
//for flash message
|
| 216 |
-
if (flashMessage) {
|
| 217 |
-
setTimeout(function() {
|
| 218 |
-
flashMessage.style.display = 'none';
|
| 219 |
-
}, 2000); // Hide after 2 seconds
|
| 220 |
-
}
|
| 221 |
-
// Toggle upload mode
|
| 222 |
-
folderLabel.addEventListener('click', () => {
|
| 223 |
-
folderLabel.classList.add('active');
|
| 224 |
-
fileLabel.classList.remove('active');
|
| 225 |
-
folderUpload.classList.remove('hidden');
|
| 226 |
-
fileUpload.classList.add('hidden');
|
| 227 |
-
});
|
| 228 |
-
|
| 229 |
-
fileLabel.addEventListener('click', () => {
|
| 230 |
-
fileLabel.classList.add('active');
|
| 231 |
-
folderLabel.classList.remove('active');
|
| 232 |
-
fileUpload.classList.remove('hidden');
|
| 233 |
-
folderUpload.classList.add('hidden');
|
| 234 |
-
});
|
| 235 |
-
|
| 236 |
-
// Show loader when form is submitted
|
| 237 |
-
document.getElementById('db-form').addEventListener('submit', function(event) {
|
| 238 |
-
// Show the spinner and hide the text
|
| 239 |
-
submitBtn.querySelector('.btn-text').style.display = 'none';
|
| 240 |
-
spinner.style.display = 'inline-block';
|
| 241 |
-
});
|
| 242 |
-
</script>
|
| 243 |
-
|
| 244 |
-
{% endblock %}
|
|
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 4 |
+
<div class="row justify-content-center">
|
| 5 |
+
<div class="col-md-8 col-lg-6">
|
| 6 |
+
<div class="card shadow-lg mt-4">
|
| 7 |
+
<div class="card-header border-0 pb-0 pt-4 text-center bg-transparent">
|
| 8 |
+
<div class="mb-3">
|
| 9 |
+
<i class="bi bi-database-add" style="font-size: 2.5rem; color: var(--accent-primary);"></i>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
</div>
|
| 11 |
+
<h3 class="fw-bold">Create Vector Database</h3>
|
| 12 |
+
<p class="text-muted small">Upload your files to initialize a new AI knowledge base.</p>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
<div class="card-body p-4 p-md-5 pt-3">
|
| 16 |
+
<form method="post" enctype="multipart/form-data">
|
| 17 |
+
|
| 18 |
+
<!-- Database Name Input -->
|
| 19 |
+
<div class="form-group mb-4">
|
| 20 |
+
<label for="db_name" class="form-label fw-semibold text-light mb-2">
|
| 21 |
+
Database Name
|
| 22 |
+
</label>
|
| 23 |
+
<div class="input-group">
|
| 24 |
+
<span class="input-group-text bg-transparent border-end-0 border-secondary text-muted">
|
| 25 |
+
<i class="bi bi-hdd-network"></i>
|
| 26 |
+
</span>
|
| 27 |
+
<input type="text" id="db_name" name="db_name" class="form-control border-start-0 ps-0"
|
| 28 |
+
placeholder="e.g., HR_Policies_2024" required>
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
<!-- Folder Upload Input -->
|
| 33 |
+
<div class="form-group mb-4">
|
| 34 |
+
<label for="folder" class="form-label fw-semibold text-light mb-2">
|
| 35 |
+
Select Folder to Upload
|
| 36 |
+
</label>
|
| 37 |
+
<div class="upload-area p-4 text-center rounded border border-secondary border-dashed" style="border-style: dashed !important; background: rgba(0,0,0,0.2);">
|
| 38 |
+
<i class="bi bi-folder2-open display-6 text-muted mb-2"></i>
|
| 39 |
+
<input type="file" id="folder" name="folder" class="form-control mb-2"
|
| 40 |
+
webkitdirectory directory multiple required style="background: transparent; color: inherit;">
|
| 41 |
+
<small class="text-muted d-block mt-2">
|
| 42 |
+
<i class="bi bi-info-circle me-1"></i> Folder upload requires Chrome or Edge.
|
| 43 |
+
</small>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<!-- Submit Button -->
|
| 48 |
+
<div class="mt-5 text-center">
|
| 49 |
+
<button type="submit" class="btn btn-primary w-100 py-2 fs-5">
|
| 50 |
+
<i class="bi bi-cpu me-2"></i> Initialize Database
|
| 51 |
+
</button>
|
| 52 |
+
</div>
|
| 53 |
+
</form>
|
| 54 |
+
</div>
|
| 55 |
</div>
|
| 56 |
</div>
|
| 57 |
</div>
|
| 58 |
+
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/home.html
CHANGED
|
@@ -1,24 +1,66 @@
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
</div>
|
| 12 |
</div>
|
| 13 |
</div>
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
</div>
|
| 21 |
</div>
|
| 22 |
</div>
|
| 23 |
</div>
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 4 |
+
<div class="container">
|
| 5 |
+
<!-- Hero Section -->
|
| 6 |
+
<div class="row text-center mb-5 mt-3">
|
| 7 |
+
<div class="col-12">
|
| 8 |
+
<h1 class="display-5 fw-bold mb-3">Welcome to Document AI</h1>
|
| 9 |
+
<p class="lead text-muted mx-auto" style="max-width: 600px;">
|
| 10 |
+
Empower your documents with intelligent search. Create custom vector databases and chat with your data seamlessly.
|
| 11 |
+
</p>
|
| 12 |
+
</div>
|
| 13 |
+
</div>
|
| 14 |
+
|
| 15 |
+
<!-- Action Cards -->
|
| 16 |
+
<div class="row justify-content-center g-4">
|
| 17 |
+
<!-- Create DB Card -->
|
| 18 |
+
<div class="col-md-5">
|
| 19 |
+
<div class="card h-100 text-center text-decoration-none action-card">
|
| 20 |
+
<div class="card-body p-5">
|
| 21 |
+
<div class="icon-wrapper mb-4">
|
| 22 |
+
<i class="bi bi-folder-plus text-primary" style="font-size: 3rem;"></i>
|
| 23 |
+
</div>
|
| 24 |
+
<h4 class="card-title mb-3">Create a New Database</h4>
|
| 25 |
+
<p class="card-text text-muted mb-4">Upload your document folders and instantly create a high-performance vector database for semantic retrieval.</p>
|
| 26 |
+
<a href="/create-db" class="btn btn-primary w-100">
|
| 27 |
+
Get Started <i class="bi bi-arrow-right ms-2"></i>
|
| 28 |
+
</a>
|
| 29 |
</div>
|
| 30 |
</div>
|
| 31 |
</div>
|
| 32 |
+
|
| 33 |
+
<!-- Chat Card -->
|
| 34 |
+
<div class="col-md-5">
|
| 35 |
+
<div class="card h-100 text-center text-decoration-none action-card">
|
| 36 |
+
<div class="card-body p-5">
|
| 37 |
+
<div class="icon-wrapper mb-4">
|
| 38 |
+
<i class="bi bi-chat-square-text text-info" style="font-size: 3rem;"></i>
|
| 39 |
+
</div>
|
| 40 |
+
<h4 class="card-title mb-3">Chat with AI</h4>
|
| 41 |
+
<p class="card-text text-muted mb-4">Select an existing database and ask context-aware questions to get intelligent, accurate answers immediately.</p>
|
| 42 |
+
<a href="/list-dbs" class="btn btn-primary w-100">
|
| 43 |
+
Start Chatting <i class="bi bi-arrow-right ms-2"></i>
|
| 44 |
+
</a>
|
| 45 |
</div>
|
| 46 |
</div>
|
| 47 |
</div>
|
| 48 |
</div>
|
| 49 |
+
</div>
|
| 50 |
+
|
| 51 |
+
<style>
|
| 52 |
+
.action-card {
|
| 53 |
+
border: 2px solid transparent;
|
| 54 |
+
}
|
| 55 |
+
.action-card:hover {
|
| 56 |
+
transform: translateY(-5px);
|
| 57 |
+
border-color: rgba(59, 130, 246, 0.5);
|
| 58 |
+
background: linear-gradient(180deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.9) 100%);
|
| 59 |
+
}
|
| 60 |
+
.icon-wrapper i {
|
| 61 |
+
background: var(--accent-gradient);
|
| 62 |
+
-webkit-background-clip: text;
|
| 63 |
+
-webkit-text-fill-color: transparent;
|
| 64 |
+
}
|
| 65 |
+
</style>
|
| 66 |
+
{% endblock %}
|
templates/list_dbs.html
CHANGED
|
@@ -1,173 +1,67 @@
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 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 |
-
/* Scrollbar customization */
|
| 48 |
-
.card-body::-webkit-scrollbar {
|
| 49 |
-
width: 8px;
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
.card-body::-webkit-scrollbar-thumb {
|
| 53 |
-
background-color: #444; /* Thumb color */
|
| 54 |
-
border-radius: 4px; /* Rounded scrollbar edges */
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
.card-body::-webkit-scrollbar-thumb:hover {
|
| 58 |
-
background-color: #555; /* Thumb hover color */
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
.card-body::-webkit-scrollbar-track {
|
| 62 |
-
background-color: #2c2c3e; /* Track background */
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
/* List group items */
|
| 66 |
-
.list-group-item {
|
| 67 |
-
background-color: #2c2c3e;
|
| 68 |
-
color: #f5f5f5;
|
| 69 |
-
border: 1px solid #444;
|
| 70 |
-
transition: background-color 0.3s ease;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
.list-group-item:hover {
|
| 74 |
-
background-color: #383850;
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
/* Button styling */
|
| 78 |
-
.btn-primary {
|
| 79 |
-
background-color: #4c4cff;
|
| 80 |
-
border-color: #4c4cff;
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
.btn-primary:hover {
|
| 84 |
-
background-color: #3838e8;
|
| 85 |
-
border-color: #3838e8;
|
| 86 |
-
}
|
| 87 |
-
/* Align buttons side-by-side */
|
| 88 |
-
.button-container {
|
| 89 |
-
display: flex;
|
| 90 |
-
gap: 0.5rem; /* Adds space between buttons */
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
.btn-primary {
|
| 94 |
-
flex: 1; /* Ensures buttons have the same width */
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
/* Optional: Adjust margin and padding for better spacing */
|
| 98 |
-
.list-group-item {
|
| 99 |
-
display: flex;
|
| 100 |
-
justify-content: space-between;
|
| 101 |
-
align-items: center;
|
| 102 |
-
}
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
border-
|
| 108 |
-
|
| 109 |
-
position: absolute;
|
| 110 |
-
position-area: top center;
|
| 111 |
-
top: 30px;
|
| 112 |
-
align-items: center;
|
| 113 |
}
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
}
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
color: #ffffff;
|
| 123 |
}
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
color: #
|
| 128 |
}
|
| 129 |
-
|
| 130 |
</style>
|
| 131 |
-
|
| 132 |
-
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 133 |
-
{% if messages %}
|
| 134 |
-
<div id="flash-message" class="alert alert-{{ messages[0][0] }}">
|
| 135 |
-
<strong>{{ messages[0][1] }}</strong>
|
| 136 |
-
</div>
|
| 137 |
-
{% endif %}
|
| 138 |
-
{% endwith %}
|
| 139 |
-
|
| 140 |
-
<div class="container">
|
| 141 |
-
<div class="card shadow">
|
| 142 |
-
<div class="card-header">
|
| 143 |
-
<h3><strong>Available Vector Databases</strong></h3>
|
| 144 |
-
</div>
|
| 145 |
-
<div class="card-body">
|
| 146 |
-
<h3 class="text-center mb-4"><strong>Select a Vector Database</strong></h3>
|
| 147 |
-
<ul class="list-group">
|
| 148 |
-
{% for db in vector_dbs %}
|
| 149 |
-
<li class="list-group-item">
|
| 150 |
-
<span>{{ db }}</span>
|
| 151 |
-
<div class="button-container">
|
| 152 |
-
<form method="post" action="{{ url_for('modify_db', db_name=db) }}" class="mb-0">
|
| 153 |
-
<button type="submit" class="btn btn-primary btn-sm">Modify</button>
|
| 154 |
-
</form>
|
| 155 |
-
<form method="post" action="{{ url_for('select_db', db_name=db) }}" class="mb-0">
|
| 156 |
-
<button type="submit" class="btn btn-primary btn-sm">Select</button>
|
| 157 |
-
</form>
|
| 158 |
-
</div>
|
| 159 |
-
</li>
|
| 160 |
-
{% endfor %}
|
| 161 |
-
</ul>
|
| 162 |
-
</div>
|
| 163 |
-
</div>
|
| 164 |
-
</div>
|
| 165 |
-
<script>
|
| 166 |
-
const flashMessage = document.getElementById('flash-message');
|
| 167 |
-
if (flashMessage) {
|
| 168 |
-
setTimeout(function() {
|
| 169 |
-
flashMessage.style.display = 'none';
|
| 170 |
-
}, 2000); // Hide after 2 seconds
|
| 171 |
-
}
|
| 172 |
-
</script>
|
| 173 |
-
{% endblock %}
|
|
|
|
| 1 |
{% extends 'base.html' %}
|
| 2 |
|
| 3 |
{% block content %}
|
| 4 |
+
<div class="row justify-content-center">
|
| 5 |
+
<div class="col-md-8">
|
| 6 |
+
<div class="card shadow-lg mt-4">
|
| 7 |
+
<div class="card-header text-center bg-transparent border-0 pt-4 pb-2">
|
| 8 |
+
<i class="bi bi-server text-primary mb-2" style="font-size: 2.5rem;"></i>
|
| 9 |
+
<h3 class="fw-bold mt-2">Available Databases</h3>
|
| 10 |
+
<p class="text-muted mb-0">Select a vector database below to start a chat session.</p>
|
| 11 |
+
</div>
|
| 12 |
+
|
| 13 |
+
<div class="card-body p-4">
|
| 14 |
+
{% if vector_dbs %}
|
| 15 |
+
<div class="list-group custom-list-group">
|
| 16 |
+
{% for db in vector_dbs %}
|
| 17 |
+
<div class="list-group-item d-flex justify-content-between align-items-center rounded mb-3 py-3 px-4 border">
|
| 18 |
+
<div class="d-flex align-items-center">
|
| 19 |
+
<div class="bg-dark rounded-circle p-2 me-3 text-primary d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
|
| 20 |
+
<i class="bi bi-database"></i>
|
| 21 |
+
</div>
|
| 22 |
+
<span class="fs-5 fw-medium text-light">{{ db }}</span>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<form method="post" action="{{ url_for('select_db', db_name=db) }}" class="mb-0">
|
| 26 |
+
<button type="submit" class="btn btn-outline-primary rounded-pill px-4">
|
| 27 |
+
Select <i class="bi bi-arrow-right-short"></i>
|
| 28 |
+
</button>
|
| 29 |
+
</form>
|
| 30 |
+
</div>
|
| 31 |
+
{% endfor %}
|
| 32 |
+
</div>
|
| 33 |
+
{% else %}
|
| 34 |
+
<div class="text-center py-5">
|
| 35 |
+
<i class="bi bi-inbox text-muted" style="font-size: 3rem;"></i>
|
| 36 |
+
<h5 class="mt-3 text-muted">No Databases Found</h5>
|
| 37 |
+
<p class="text-muted">You haven't created any vector databases yet.</p>
|
| 38 |
+
<a href="/create-db" class="btn btn-primary mt-2">Create One Now</a>
|
| 39 |
+
</div>
|
| 40 |
+
{% endif %}
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
<style>
|
| 47 |
+
.custom-list-group .list-group-item {
|
| 48 |
+
background-color: rgba(15, 23, 42, 0.4);
|
| 49 |
+
border-color: var(--border-color);
|
| 50 |
+
transition: all 0.2s ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
}
|
| 52 |
+
.custom-list-group .list-group-item:hover {
|
| 53 |
+
background-color: rgba(15, 23, 42, 0.8);
|
| 54 |
+
border-color: var(--accent-primary);
|
| 55 |
+
transform: scale(1.01);
|
| 56 |
}
|
| 57 |
+
.btn-outline-primary {
|
| 58 |
+
color: var(--accent-primary);
|
| 59 |
+
border-color: var(--accent-primary);
|
|
|
|
| 60 |
}
|
| 61 |
+
.btn-outline-primary:hover {
|
| 62 |
+
background: var(--accent-gradient);
|
| 63 |
+
border-color: transparent;
|
| 64 |
+
color: #fff;
|
| 65 |
}
|
|
|
|
| 66 |
</style>
|
| 67 |
+
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|