Spaces:
Sleeping
Sleeping
Update templates/create_db.html
Browse files- templates/create_db.html +166 -110
templates/create_db.html
CHANGED
|
@@ -1,110 +1,166 @@
|
|
| 1 |
-
{% extends 'base.html' %}
|
| 2 |
-
|
| 3 |
-
{% block content %}
|
| 4 |
-
<style>
|
| 5 |
-
/* Ensure the body takes full height for proper layout */
|
| 6 |
-
html, body {
|
| 7 |
-
height: 100%;
|
| 8 |
-
margin: 0;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
.container {
|
| 12 |
-
display: flex;
|
| 13 |
-
flex-direction: column;
|
| 14 |
-
height: 50vh; /* Full height of the viewport */
|
| 15 |
-
overflow: hidden; /* Prevent extra scrollbars */
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
.card {
|
| 19 |
-
margin: auto;
|
| 20 |
-
background-color: #2c2c3e;
|
| 21 |
-
color: #f5f5f5;
|
| 22 |
-
border: none;
|
| 23 |
-
width: 50%; /* Centered and appropriately sized */
|
| 24 |
-
max-height: calc(50vh - 50px); /* Adjust to fit within view */
|
| 25 |
-
overflow-y: auto; /* Add scrolling if content overflows */
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
.card-header {
|
| 29 |
-
background-color: #181831;
|
| 30 |
-
border-bottom: 2px solid #444;
|
| 31 |
-
padding: 1rem;
|
| 32 |
-
text-align: center;
|
| 33 |
-
position: sticky; /* Keeps header fixed */
|
| 34 |
-
top: 0;
|
| 35 |
-
z-index: 1000; /* Ensures it stays above scrollable content */
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
.text-muted {
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
.form-label {
|
| 44 |
-
font-weight: bold;
|
| 45 |
-
color: #cfcfcf;
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
.form-control {
|
| 49 |
-
background-color: #1e1e2f;
|
| 50 |
-
color: #f5f5f5;
|
| 51 |
-
border: 1px solid #444;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
.form-control:focus {
|
| 55 |
-
background-color: #1e1e2f;
|
| 56 |
-
color: #f5f5f5;
|
| 57 |
-
border-color: #4c4cff;
|
| 58 |
-
box-shadow: 0 0 4px #4c4cff;
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
.btn-primary {
|
| 62 |
-
background-color: #4c4cff;
|
| 63 |
-
border-color: #4c4cff;
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
.btn-primary:hover {
|
| 67 |
-
background-color: #3838e8;
|
| 68 |
-
border-color: #3838e8;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
/* Custom scrollbar */
|
| 72 |
-
.card::-webkit-scrollbar {
|
| 73 |
-
width: 8px;
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
.card::-webkit-scrollbar-thumb {
|
| 77 |
-
background-color: #444;
|
| 78 |
-
border-radius: 4px;
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'base.html' %}
|
| 2 |
+
|
| 3 |
+
{% block content %}
|
| 4 |
+
<style>
|
| 5 |
+
/* Ensure the body takes full height for proper layout */
|
| 6 |
+
html, body {
|
| 7 |
+
height: 100%;
|
| 8 |
+
margin: 0;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.container {
|
| 12 |
+
display: flex;
|
| 13 |
+
flex-direction: column;
|
| 14 |
+
height: 50vh; /* Full height of the viewport */
|
| 15 |
+
overflow: hidden; /* Prevent extra scrollbars */
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.card {
|
| 19 |
+
margin: auto;
|
| 20 |
+
background-color: #2c2c3e;
|
| 21 |
+
color: #f5f5f5;
|
| 22 |
+
border: none;
|
| 23 |
+
width: 50%; /* Centered and appropriately sized */
|
| 24 |
+
max-height: calc(50vh - 50px); /* Adjust to fit within view */
|
| 25 |
+
overflow-y: auto; /* Add scrolling if content overflows */
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.card-header {
|
| 29 |
+
background-color: #181831;
|
| 30 |
+
border-bottom: 2px solid #444;
|
| 31 |
+
padding: 1rem;
|
| 32 |
+
text-align: center;
|
| 33 |
+
position: sticky; /* Keeps header fixed */
|
| 34 |
+
top: 0;
|
| 35 |
+
z-index: 1000; /* Ensures it stays above scrollable content */
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.text-muted {
|
| 39 |
+
--bs-text-opacity: 1;
|
| 40 |
+
color: rgb(121 136 151 / 75%) !important;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.form-label {
|
| 44 |
+
font-weight: bold;
|
| 45 |
+
color: #cfcfcf;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.form-control {
|
| 49 |
+
background-color: #1e1e2f;
|
| 50 |
+
color: #f5f5f5;
|
| 51 |
+
border: 1px solid #444;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.form-control:focus {
|
| 55 |
+
background-color: #1e1e2f;
|
| 56 |
+
color: #f5f5f5;
|
| 57 |
+
border-color: #4c4cff;
|
| 58 |
+
box-shadow: 0 0 4px #4c4cff;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.btn-primary {
|
| 62 |
+
background-color: #4c4cff;
|
| 63 |
+
border-color: #4c4cff;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.btn-primary:hover {
|
| 67 |
+
background-color: #3838e8;
|
| 68 |
+
border-color: #3838e8;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/* Custom scrollbar */
|
| 72 |
+
.card::-webkit-scrollbar {
|
| 73 |
+
width: 8px;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.card::-webkit-scrollbar-thumb {
|
| 77 |
+
background-color: #444;
|
| 78 |
+
border-radius: 4px;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/* Loader styling */
|
| 82 |
+
#loader {
|
| 83 |
+
display: none; /* Hidden by default */
|
| 84 |
+
position: fixed;
|
| 85 |
+
top: 50%;
|
| 86 |
+
left: 50%;
|
| 87 |
+
transform: translate(-50%, -50%);
|
| 88 |
+
z-index: 9999;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
.spinner {
|
| 92 |
+
width: 50px;
|
| 93 |
+
height: 50px;
|
| 94 |
+
border: 5px solid #f3f3f3;
|
| 95 |
+
border-top: 5px solid #3498db;
|
| 96 |
+
border-radius: 50%;
|
| 97 |
+
animation: spin 1s linear infinite;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
@keyframes spin {
|
| 101 |
+
0% {
|
| 102 |
+
transform: rotate(0deg);
|
| 103 |
+
}
|
| 104 |
+
100% {
|
| 105 |
+
transform: rotate(360deg);
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.loading-overlay {
|
| 110 |
+
position: fixed;
|
| 111 |
+
top: 0;
|
| 112 |
+
left: 0;
|
| 113 |
+
width: 100%;
|
| 114 |
+
height: 100%;
|
| 115 |
+
background: rgba(255, 255, 255, 0.8);
|
| 116 |
+
z-index: 9998;
|
| 117 |
+
display: none; /* Hidden by default */
|
| 118 |
+
}
|
| 119 |
+
</style>
|
| 120 |
+
|
| 121 |
+
<!-- Loader HTML -->
|
| 122 |
+
<div id="loader" class="loading-overlay">
|
| 123 |
+
<div class="spinner"></div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<!-- Main Content -->
|
| 127 |
+
<div class="container mt-5">
|
| 128 |
+
<div class="card shadow">
|
| 129 |
+
<div class="card-header">
|
| 130 |
+
<h3>Create a New Vector Database</h3>
|
| 131 |
+
</div>
|
| 132 |
+
<div class="card-body">
|
| 133 |
+
<form id="db-form" method="post" enctype="multipart/form-data">
|
| 134 |
+
<!-- Database Name Input -->
|
| 135 |
+
<div class="form-group">
|
| 136 |
+
<label for="db_name" class="form-label">Database Name</label>
|
| 137 |
+
<input type="text" id="db_name" name="db_name" class="form-control" placeholder="Enter database name" required>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<!-- Folder Upload Input -->
|
| 141 |
+
<div class="form-group mt-3">
|
| 142 |
+
<label for="folder" class="form-label">Upload Folder</label>
|
| 143 |
+
<input type="file" id="folder" name="folder" class="form-control" webkitdirectory directory multiple required>
|
| 144 |
+
<small class="text-muted">Note: You can upload folder having your documents.</small>
|
| 145 |
+
</div>
|
| 146 |
+
|
| 147 |
+
<!-- Submit Button -->
|
| 148 |
+
<div class="mt-4 text-center">
|
| 149 |
+
<button type="submit" class="btn btn-primary px-5">Create</button>
|
| 150 |
+
</div>
|
| 151 |
+
</form>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
|
| 156 |
+
<script>
|
| 157 |
+
// Show loader on form submission
|
| 158 |
+
const form = document.getElementById('db-form');
|
| 159 |
+
const loader = document.getElementById('loader');
|
| 160 |
+
|
| 161 |
+
form.addEventListener('submit', function (event) {
|
| 162 |
+
loader.style.display = 'flex'; // Show loader
|
| 163 |
+
});
|
| 164 |
+
</script>
|
| 165 |
+
|
| 166 |
+
{% endblock %}
|