Spaces:
Running
Running
{% extends 'base.html' %} | |
{% block content %} | |
<style> | |
/* Ensure full-page setup */ | |
html, body { | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
} | |
.container { | |
display: flex; | |
height: 50vh; /* Locks the height of the containers */ | |
margin-top: 50px; | |
} | |
/* Styling for left and right panes */ | |
.card { | |
height: 100%; /* Ensures cards fill the container height */ | |
overflow: hidden; /* Prevents overflow of content */ | |
} | |
.row { | |
height: 100%; /* Ensures the row fills the container */ | |
margin: auto; | |
} | |
.col-md-5 { | |
display: flex; | |
flex-direction: column; | |
gap: 20px; /* Adds space between left and right containers */ | |
max-height: 100%; | |
} | |
.card-body { | |
display: flex; | |
flex-direction: column; | |
height: auto; /* Occupies full height of the card */ | |
} | |
/* Scrollable left pane's history section */ | |
.history-section { | |
overflow-y: auto; /* Adds vertical scrolling */ | |
flex: 1; /* Ensures this section takes up remaining space */ | |
overflow-x: hidden; | |
} | |
/* Scrollbar customization */ | |
.history-section::-webkit-scrollbar { | |
width: 8px; | |
} | |
.history-section::-webkit-scrollbar-thumb { | |
background-color: #888; | |
border-radius: 4px; | |
} | |
.history-section::-webkit-scrollbar-thumb:hover { | |
background-color: #555; | |
} | |
.history-section::-webkit-scrollbar-track { | |
background-color: #f1f1f1; | |
} | |
/* Space between left and right columns */ | |
.row > .col-md-5:not(:last-child) { | |
margin-right: 20px; /* Adds space between left and right pane */ | |
} | |
/* Form input and button adjustments */ | |
.form-group input { | |
border-radius: 4px; | |
} | |
.btn-primary { | |
background-color: #007bff; | |
border-color: #007bff; | |
} | |
.btn-primary:hover { | |
background-color: #0056b3; | |
border-color: #0056b3; | |
} | |
/* Scrollable left section for queries */ | |
.answer-section { | |
background: #2c2c3e; | |
padding: 10px; | |
border-radius: 4px; | |
border: 1px solid #2c2c3e; | |
} | |
</style> | |
<div class="container"> | |
<div class="row justify-content-center"> | |
<!-- Left Pane --> | |
<div class="col-md-5"> | |
<div class="card"> | |
<div class="card-body"> | |
<h5 class="card-title">Document AI</h5> | |
<p class="card-text">Enter a query and get an answer based on the stored context.</p> | |
<form method="POST" action="{{ url_for('chat') }}"> | |
<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> | |
{% if answer %} | |
<div class="answer-section mt-3"> | |
<h6>Answer:</h6> | |
<div class="answer">{{ answer }}</div> | |
</div> | |
{% endif %} | |
</div> | |
</div> | |
</div> | |
<!-- Right Pane --> | |
<div class="col-md-5"> | |
<div class="card"> | |
<div class="card-body"> | |
<h5 class="card-title">Previous Queries</h5> | |
<div class="history-section"> | |
{% for question, answer in history %} | |
<div class="card mb-3"> | |
<div class="card-body"> | |
<div class="question"> | |
<strong>Query:</strong> {{ question }} | |
</div> | |
<hr> | |
<div class="answer mt-2"> | |
<strong>Answer:</strong> {{ answer }} | |
</div> | |
</div> | |
</div> | |
{% endfor %} | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
{% endblock %} |