nikhile-galileo commited on
Commit
ede8222
·
1 Parent(s): a8bb1d0

Added more editable parameters

Browse files
Files changed (1) hide show
  1. backend/api/templates/index.html +69 -6
backend/api/templates/index.html CHANGED
@@ -49,7 +49,6 @@
49
 
50
  <!-- Sidebar on the right -->
51
  <div class="w-1/4 bg-white shadow p-6">
52
- <h2 class="text-xl font-bold mb-4">Options</h2>
53
  <div class="flex flex-col space-y-4">
54
  <label class="block">
55
  <span class="text-gray-700">Top K:</span>
@@ -61,6 +60,15 @@
61
  class="mt-1 p-2 w-full border rounded"
62
  />
63
  </label>
 
 
 
 
 
 
 
 
 
64
  <label class="flex items-center space-x-2">
65
  <input
66
  type="checkbox"
@@ -89,6 +97,39 @@
89
  <span>Induce Hallucination</span>
90
  </label>
91
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  </div>
93
 
94
  <script>
@@ -102,6 +143,15 @@
102
  if (urlParams.has('top_k')) {
103
  $('#top_k').val(urlParams.get('top_k'));
104
  }
 
 
 
 
 
 
 
 
 
105
  if (urlParams.has('protection')) {
106
  $('#protection').prop('checked', urlParams.get('protection') === 'true');
107
  }
@@ -117,10 +167,13 @@
117
 
118
  const query = $('#query').val();
119
  const top_k = $('#top_k').val();
 
120
  const protection = $('#protection').is(':checked');
121
  const hallucination_detection = $('#hallucination_detection').is(':checked');
122
  const induce_hallucination = $('#induce_hallucination').is(':checked');
123
-
 
 
124
  // Show loading spinner
125
  $('#loadingSpinner').removeClass('hidden');
126
 
@@ -134,9 +187,13 @@
134
  data: {
135
  query: query,
136
  top_k: top_k,
 
137
  protection: protection,
138
  hallucination_detection: hallucination_detection,
139
- induce_hallucination: induce_hallucination
 
 
 
140
  },
141
  success: function (response) {
142
  // Hide loading spinner
@@ -205,6 +262,7 @@
205
  <style>
206
  pii {
207
  font-weight: bold;
 
208
  background-color: yellow;
209
  }
210
  </style>
@@ -340,19 +398,24 @@
340
  $(document).on('click', '#retry_button', function() {
341
  const query = $('#query').val();
342
  const retry_top_k = $('#retry_top_k').val();
 
 
 
 
343
  const protection = $('#protection').is(':checked');
344
  const hallucination_detection = $('#hallucination_detection').is(':checked');
345
  const induce_hallucination = $('#induce_hallucination').is(':checked');
346
-
347
  // Create URL parameters to reload with form pre-filled
348
  const params = new URLSearchParams();
349
  params.set('query', query);
350
  params.set('top_k', retry_top_k);
351
  params.set('retry', 'true'); // Flag to indicate this is a retry attempt
 
 
 
352
  if (protection) params.set('protection', 'true');
353
  if (hallucination_detection) params.set('hallucination_detection', 'true');
354
  if (induce_hallucination) params.set('induce_hallucination', 'true');
355
-
356
  // Reload the page with parameters
357
  window.location.href = window.location.pathname + '?' + params.toString();
358
  });
@@ -365,4 +428,4 @@
365
  </script>
366
 
367
  </body>
368
- </html>
 
49
 
50
  <!-- Sidebar on the right -->
51
  <div class="w-1/4 bg-white shadow p-6">
 
52
  <div class="flex flex-col space-y-4">
53
  <label class="block">
54
  <span class="text-gray-700">Top K:</span>
 
60
  class="mt-1 p-2 w-full border rounded"
61
  />
62
  </label>
63
+ <label class="flex items-center space-x-2">
64
+ <input
65
+ type="checkbox"
66
+ id="add_to_dataset"
67
+ name="add_to_dataset"
68
+ class="form-checkbox text-green-600 focus:ring-green-500"
69
+ />
70
+ <span>Add to Dataset</span>
71
+ </label>
72
  <label class="flex items-center space-x-2">
73
  <input
74
  type="checkbox"
 
97
  <span>Induce Hallucination</span>
98
  </label>
99
  </div>
100
+ <div class="my-4 border-t border-gray-300"></div>
101
+ <div class="flex flex-col space-y-4">
102
+ <label class="block">
103
+ <span class="text-gray-700">Project:</span>
104
+ <input
105
+ type="text"
106
+ id="project_name"
107
+ name="project_name"
108
+ value="{{ default_project_name }}"
109
+ class="mt-1 p-2 w-full border rounded"
110
+ />
111
+ </label>
112
+ <label class="block">
113
+ <span class="text-gray-700">Logstream:</span>
114
+ <input
115
+ type="text"
116
+ id="logstream_name"
117
+ name="logstream_name"
118
+ value="{{ default_logstream_name }}"
119
+ class="mt-1 p-2 w-full border rounded"
120
+ />
121
+ </label>
122
+ <label class="block">
123
+ <span class="text-gray-700">Dataset:</span>
124
+ <input
125
+ type="text"
126
+ id="dataset_name"
127
+ name="dataset_name"
128
+ value="{{ default_dataset_name }}"
129
+ class="mt-1 p-2 w-full border rounded"
130
+ />
131
+ </label>
132
+ </div>
133
  </div>
134
 
135
  <script>
 
143
  if (urlParams.has('top_k')) {
144
  $('#top_k').val(urlParams.get('top_k'));
145
  }
146
+ if (urlParams.has('dataset_name')) {
147
+ $('#dataset_name').val(urlParams.get('dataset_name'));
148
+ }
149
+ if (urlParams.has('logstream_name')) {
150
+ $('#logstream_name').val(urlParams.get('logstream_name'));
151
+ }
152
+ if (urlParams.has('project_name')) {
153
+ $('#project_name').val(urlParams.get('project_name'));
154
+ }
155
  if (urlParams.has('protection')) {
156
  $('#protection').prop('checked', urlParams.get('protection') === 'true');
157
  }
 
167
 
168
  const query = $('#query').val();
169
  const top_k = $('#top_k').val();
170
+ const add_to_dataset = $('#add_to_dataset').is(':checked');
171
  const protection = $('#protection').is(':checked');
172
  const hallucination_detection = $('#hallucination_detection').is(':checked');
173
  const induce_hallucination = $('#induce_hallucination').is(':checked');
174
+ const project_name = $('#project_name').val();
175
+ const dataset_name = $('#dataset_name').val();
176
+ const logstream_name = $('#logstream_name').val();
177
  // Show loading spinner
178
  $('#loadingSpinner').removeClass('hidden');
179
 
 
187
  data: {
188
  query: query,
189
  top_k: top_k,
190
+ add_to_dataset: add_to_dataset,
191
  protection: protection,
192
  hallucination_detection: hallucination_detection,
193
+ induce_hallucination: induce_hallucination,
194
+ project_name: project_name,
195
+ logstream_name: logstream_name,
196
+ dataset_name: dataset_name,
197
  },
198
  success: function (response) {
199
  // Hide loading spinner
 
262
  <style>
263
  pii {
264
  font-weight: bold;
265
+ text-decoration: line-through;
266
  background-color: yellow;
267
  }
268
  </style>
 
398
  $(document).on('click', '#retry_button', function() {
399
  const query = $('#query').val();
400
  const retry_top_k = $('#retry_top_k').val();
401
+ const project_name = $('#project_name').val();
402
+ const dataset_name = $('#dataset_name').val();
403
+ const logstream_name = $('#logstream_name').val();
404
+ const add_to_dataset = $('#add_to_dataset').is(':checked');
405
  const protection = $('#protection').is(':checked');
406
  const hallucination_detection = $('#hallucination_detection').is(':checked');
407
  const induce_hallucination = $('#induce_hallucination').is(':checked');
 
408
  // Create URL parameters to reload with form pre-filled
409
  const params = new URLSearchParams();
410
  params.set('query', query);
411
  params.set('top_k', retry_top_k);
412
  params.set('retry', 'true'); // Flag to indicate this is a retry attempt
413
+ if (project_name) params.set('project_name', project_name);
414
+ if (logstream_name) params.set('logstream_name', logstream_name);
415
+ if (add_to_dataset) params.set('add_to_dataset', 'true');
416
  if (protection) params.set('protection', 'true');
417
  if (hallucination_detection) params.set('hallucination_detection', 'true');
418
  if (induce_hallucination) params.set('induce_hallucination', 'true');
 
419
  // Reload the page with parameters
420
  window.location.href = window.location.pathname + '?' + params.toString();
421
  });
 
428
  </script>
429
 
430
  </body>
431
+ </html>