Spaces:
Running
Running
File size: 4,488 Bytes
a6b6b45 1f2ba2d |
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 |
{% extends 'base.html' %}
{% block content %}
<style>
/* Ensure full-page setup */
html, body {
height: 100%;
margin: 0;
padding: 0;
background-color: #1e1e2e;
color: white;
font-family: Arial, sans-serif;
}
.container {
display: flex;
height: 80vh;
margin-top: 40px;
align-items: center;
justify-content: center;
gap: 30px;
}
.card {
background: #2c2c3e;
border-radius: 10px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
padding: 20px;
width: 45%;
height: 100%;
}
.card-title {
font-size: 20px;
font-weight: bold;
text-align: center;
}
.form-group input {
border-radius: 6px;
padding: 10px;
}
.btn-primary {
background-color: #007bff;
border-color: #007bff;
width: 100%;
padding: 10px;
border-radius: 6px;
}
.btn-primary:hover {
background-color: #0056b3;
border-color: #0056b3;
}
/* Loader */
.loader {
display: none;
border: 4px solid rgba(255, 255, 255, 0.3);
border-top: 4px solid #007bff;
border-radius: 50%;
width: 30px;
height: 30px;
animation: spin 1s linear infinite;
margin: auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Answer Section */
.answer-section{
overflow-y: auto;
max-height: 70vh;
padding: 10px;
border-radius: 6px;
background: #2c2c3e;
}
.answer-section h6 {
color: #ffffff;
font-weight: bold;
text-align: center;
}
.answer-item {
background: #1a1a2e;
padding: 10px;
border-radius: 6px;
margin-bottom: 10px;
}
/* History Section */
.history-section {
overflow-y: auto;
max-height: 70vh;
padding: 10px;
border-radius: 6px;
background: #2c2c3e;
}
.history-item {
background: #1a1a2e;
padding: 10px;
border-radius: 6px;
margin-bottom: 10px;
}
.alert-error {
background-color: #ff4d4d;
color: white;
}
.alert-table_selected {
background-color: #4dff74;
color: white;
}
</style>
<div class="container">
<!-- Left Pane -->
<div class="card">
<h5 class="card-title">Document AI</h5>
<p>Enter a query and get an answer based on stored context.</p>
<form method="POST" action="{{ url_for('chat') }}" onsubmit="showLoader()">
<div class="form-group">
<input type="text" name="query_text" placeholder="Enter your query" value="{{ query_text }}" required class="form-control">
</div>
<div class="form-group mt-2">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
<div class="loader" id="loader"></div>
{% if answer %}
<div class="answer-section">
<div class="answer-item">
<h6><strong>Answer:</strong></h6>
<hr>
{{ answer }}
</div>
</div>
{% endif %}
</div>
<!-- Right Pane -->
<div class="card">
<h5 class="card-title">Previous Queries</h5>
<div class="history-section">
{% for question, answer in history %}
<div class="history-item">
<div><strong>Query:</strong> {{ question }}</div>
<hr>
<div><strong>Answer:</strong> {{ answer }}</div>
</div>
{% endfor %}
</div>
</div>
</div>
<script>
function showLoader() {
document.getElementById('loader').style.display = 'block';
document.querySelector('.answer-section')?.classList.add('d-none');
}
// Ensure the answer section is visible when an answer is displayed
window.onload = function() {
if (document.querySelector('.answer-section')) {
document.querySelector('.answer-section').classList.remove('d-none');
}
};
</script>
{% endblock %} |