1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-08 17:06:42 +00:00

styling fixes

This commit is contained in:
Laura
2025-08-31 00:29:45 +02:00
parent 87d33a8d1d
commit 703d5373f0
3 changed files with 16 additions and 1 deletions

View File

@@ -378,6 +378,7 @@ body:not(.loading) #loading {
border: 2px solid #ed8796;
}
.tool .result pre,
.reasoning-text pre {
background: #1b1d2a;
}

View File

@@ -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);

View File

@@ -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;