mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-08 17:06:42 +00:00
styling fixes
This commit is contained in:
@@ -378,6 +378,7 @@ body:not(.loading) #loading {
|
||||
border: 2px solid #ed8796;
|
||||
}
|
||||
|
||||
.tool .result pre,
|
||||
.reasoning-text pre {
|
||||
background: #1b1d2a;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user