Spaces:
Running
Running
feat: raise exception and eos token
Browse files- index.html +24 -0
index.html
CHANGED
@@ -217,6 +217,19 @@
|
|
217 |
font-size: 14px;
|
218 |
line-height: 1.5;
|
219 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
/* Checkbox styling */
|
222 |
.checkbox-wrapper {
|
@@ -270,6 +283,7 @@
|
|
270 |
</div>
|
271 |
<div class="input-group" style="margin-bottom: 0; flex-grow: 1;">
|
272 |
<input type="text" id="bosToken" placeholder="BOS Token (e.g., <s>)" style="flex-grow: 1;">
|
|
|
273 |
</div>
|
274 |
</div>
|
275 |
|
@@ -282,6 +296,7 @@
|
|
282 |
<div class="card">
|
283 |
<h2>Output</h2>
|
284 |
<pre id="output"></pre>
|
|
|
285 |
</div>
|
286 |
</div>
|
287 |
|
@@ -361,16 +376,25 @@
|
|
361 |
updateMessageDisplay();
|
362 |
}
|
363 |
}
|
|
|
|
|
|
|
|
|
|
|
364 |
|
365 |
function applyTemplate() {
|
|
|
366 |
const template = document.getElementById('template').value;
|
367 |
const addGenerationPrompt = document.getElementById('addGenerationPrompt').checked;
|
368 |
const bosToken = document.getElementById('bosToken').value;
|
|
|
369 |
|
370 |
const context = {
|
371 |
messages: messages,
|
372 |
add_generation_prompt: addGenerationPrompt,
|
373 |
bos_token: bosToken,
|
|
|
|
|
374 |
};
|
375 |
|
376 |
try {
|
|
|
217 |
font-size: 14px;
|
218 |
line-height: 1.5;
|
219 |
}
|
220 |
+
|
221 |
+
#error {
|
222 |
+
white-space: pre-wrap;
|
223 |
+
color: #ffffff;
|
224 |
+
background-color: #f8090a;
|
225 |
+
padding: 16px;
|
226 |
+
border-radius: 8px;
|
227 |
+
font-family: monospace;
|
228 |
+
border: 1.5px solid #ddd;
|
229 |
+
overflow-x: auto;
|
230 |
+
font-size: 14px;
|
231 |
+
line-height: 1.5;
|
232 |
+
}
|
233 |
|
234 |
/* Checkbox styling */
|
235 |
.checkbox-wrapper {
|
|
|
283 |
</div>
|
284 |
<div class="input-group" style="margin-bottom: 0; flex-grow: 1;">
|
285 |
<input type="text" id="bosToken" placeholder="BOS Token (e.g., <s>)" style="flex-grow: 1;">
|
286 |
+
<input type="text" id="eosToken" placeholder="EOS Token (e.g., </s>)" style="flex-grow: 1;">
|
287 |
</div>
|
288 |
</div>
|
289 |
|
|
|
296 |
<div class="card">
|
297 |
<h2>Output</h2>
|
298 |
<pre id="output"></pre>
|
299 |
+
<pre id="error" style="display: none"></pre>
|
300 |
</div>
|
301 |
</div>
|
302 |
|
|
|
376 |
updateMessageDisplay();
|
377 |
}
|
378 |
}
|
379 |
+
function raiseException(string) {
|
380 |
+
document.getElementById("output").style.display = "none";
|
381 |
+
document.getElementById("error").style.display = "block";
|
382 |
+
document.getElementById('error').textContent = `Error: ${string}`;
|
383 |
+
}
|
384 |
|
385 |
function applyTemplate() {
|
386 |
+
document.getElementById("error").style.display = "none";
|
387 |
const template = document.getElementById('template').value;
|
388 |
const addGenerationPrompt = document.getElementById('addGenerationPrompt').checked;
|
389 |
const bosToken = document.getElementById('bosToken').value;
|
390 |
+
const eosToken = document.getElementById('eosToken').value;
|
391 |
|
392 |
const context = {
|
393 |
messages: messages,
|
394 |
add_generation_prompt: addGenerationPrompt,
|
395 |
bos_token: bosToken,
|
396 |
+
eos_token: eosToken,
|
397 |
+
raise_exception: raiseException,
|
398 |
};
|
399 |
|
400 |
try {
|