1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 01:09:54 +00:00

2 Commits

Author SHA1 Message Date
Laura
07ca59cfb1 small fix 2025-08-31 00:31:43 +02:00
Laura
703d5373f0 styling fixes 2025-08-31 00:29:45 +02:00
4 changed files with 21 additions and 2 deletions

View File

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

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;

View File

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