mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-09 01:09:54 +00:00
Compare commits
2 Commits
87d33a8d1d
...
v1.4.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
07ca59cfb1 | ||
![]() |
703d5373f0 |
@@ -378,10 +378,15 @@ body:not(.loading) #loading {
|
||||
border: 2px solid #ed8796;
|
||||
}
|
||||
|
||||
.tool .result pre,
|
||||
.reasoning-text pre {
|
||||
background: #1b1d2a;
|
||||
}
|
||||
|
||||
.tool .result pre.l-json .pre-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.message .tool .result,
|
||||
.message .reasoning-text {
|
||||
background: #1e2030;
|
||||
|
@@ -513,7 +513,7 @@
|
||||
_cost.textContent = cost ? `${formatMoney(cost)}` : "";
|
||||
|
||||
_result.classList.toggle("error", result?.startsWith("error: "));
|
||||
_result.innerHTML = render(result || "*processing*");
|
||||
_result.innerHTML = render(result ? wrapJSON(result) : "*processing*");
|
||||
|
||||
this.#_tool.classList.toggle("invalid", !!invalid);
|
||||
|
||||
|
@@ -114,6 +114,20 @@ function clamp(num, min, max) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
}
|
||||
|
||||
function wrapJSON(txt) {
|
||||
if (!txt || !txt.startsWith("{")) {
|
||||
return txt;
|
||||
}
|
||||
|
||||
try {
|
||||
const data = JSON.parse(txt);
|
||||
|
||||
return `\`\`\`json\n${JSON.stringify(data, null, 2)}\n\`\`\``;
|
||||
} catch {}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
function download(name, type, data) {
|
||||
let blob;
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
code(code) {
|
||||
const header = `<div class="pre-header">${escapeHtml(code.lang)}<button class="pre-copy" title="Copy code contents"></button></div>`;
|
||||
|
||||
return `<pre>${header}<code>${code.text}</code></pre>`;
|
||||
return `<pre class="l-${escapeHtml(code.lang)}">${header}<code>${code.text}</code></pre>`;
|
||||
},
|
||||
|
||||
link(link) {
|
||||
|
Reference in New Issue
Block a user