File size: 1,924 Bytes
b62e029
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>Hybrid Knowledge Engine</title>
  <style>
    body {
      max-width: 800px;
      margin: 0 auto;
      padding: 20px;
      line-height: 1.6;
    }

    .search-box {
      background: #f4f4f4;
      padding: 20px;
      border-radius: 8px;
      margin-bottom: 30px;
    }

    .result-item {
      border-bottom: 1px solid #eee;
      padding: 15px 0;
    }

    .metadata {
      font-size: 0.85em;
      color: #666;
      margin-bottom: 5px;
    }

    .score {
      color: #2c3e50;
      font-weight: bold;
      background: #ecf0f1;
      padding: 2px 6px;
      border-radius: 4px;
    }

    .content {
      margin-top: 10px;
      color: #333;
    }

    .latency {
      color: #999;
      font-size: 0.9em;
      text-align: right;
    }
  </style>
</head>

<body>
  <h1>Knowledge Engine</h1>

  <div class="search-box">
    <form method="post" action="/api/v1/search/demo">
      <input type="text" name="query" value="{{ query }}" placeholder="Enter Query" style="width: 80%; padding: 10px;"
        required>
      <button type="submit" style="padding: 10px 20px; cursor: pointer;">Search</button>
    </form>
  </div>

  {% if results is not none %}
  <div class="latency">Search time: {{ latency_ms }}ms</div>
  <h2>Results for "{{ query }}"</h2>

  {% if results|length > 0 %}
  {% for r in results %}
  <div class="result-item">
    <div class="metadata">
      <span class="score">Score: {{ r.score }}</span> |
      <strong>source: {{ r.metadata.title }}</strong>
      {% if r.metadata.url %} | <a href="{{ r.metadata.url }}" target="_blank">Link</a>{% endif %}
    </div>
    <div class="content">
      {{ r.text }}
    </div>
  </div>
  {% endfor %}
  {% else %}
  <p>No search results found.</p>
  {% endif %}
  {% endif %}

  {% if error_message %}
  <p style="color: red;">{{ error_message }}</p>
  {% endif %}
</body>

</html>