File size: 2,466 Bytes
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
{% extends 'base.html' %}

{% block content %}

<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>
                                <strong><hr></strong>
                                <div class="answer mt-2">
                                    <strong>Answer:</strong> {{ answer }}
                                </div>
                            </div>
                        </div>
                        <!-- {% if not loop.last %}

                        <hr>

                        {% endif %} -->
                        {% endfor %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}