File size: 4,582 Bytes
1f2ba2d
 
 
 
070a9b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1f2ba2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
070a9b0
1f2ba2d
 
 
 
 
 
 
 
 
 
 
 
070a9b0
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
{% 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 %}