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

some fixes and display version

This commit is contained in:
Laura
2025-08-11 01:38:16 +02:00
parent d8ded61a09
commit 607e316f69
7 changed files with 145 additions and 12 deletions

View File

@@ -68,6 +68,29 @@ body {
overflow: hidden;
}
#version {
position: absolute;
font-size: 12px;
font-style: italic;
top: 3px;
right: 6px;
color: #a5adcb;
}
#version a {
color: #a5adcb;
text-decoration: none;
}
body.loading #version {
font-size: 0;
animation: rotating 1.2s linear infinite;
background-image: url(icons/spinner.svg);
width: 16px;
height: 16px;
top: 6px;
}
#page {
display: flex;
flex-direction: column;
@@ -419,6 +442,7 @@ select {
margin-right: 4px;
}
body.loading #version,
.reasoning .toggle::before,
.reasoning .toggle::after,
#bottom,

View File

@@ -15,7 +15,9 @@
<title>whiskr</title>
</head>
<body>
<body class="loading">
<div id="version"></div>
<div id="page">
<div id="messages"></div>
<div id="chat">

View File

@@ -1,5 +1,6 @@
(() => {
const $messages = document.getElementById("messages"),
const $version = document.getElementById("version"),
$messages = document.getElementById("messages"),
$chat = document.getElementById("chat"),
$message = document.getElementById("message"),
$bottom = document.getElementById("bottom"),
@@ -509,18 +510,22 @@
}
}
async function loadModels() {
const modelList = await json("/-/models");
async function loadData() {
const data = await json("/-/data");
if (!modelList) {
alert("Failed to load models.");
if (!data) {
alert("Failed to load data.");
return [];
return false;
}
// render version
$version.innerHTML = `<a href="https://github.com/coalaura/whiskr" target="_blank">whiskr</a> <a href="https://github.com/coalaura/whiskr/releases/tag/${data.version}" target="_blank">${data.version}</a>`;
// render models
$model.innerHTML = "";
for (const model of modelList) {
for (const model of data.models) {
const el = document.createElement("option");
el.value = model.id;
@@ -536,7 +541,7 @@
dropdown($model, 4);
return modelList;
return data;
}
function restore(modelList) {
@@ -841,5 +846,9 @@
dropdown($prompt);
dropdown($reasoningEffort);
loadModels().then(restore);
loadData().then((data) => {
restore(data?.models || []);
document.body.classList.remove("loading");
});
})();

View File

@@ -35,6 +35,10 @@
return `<pre>${header}<code>${code.text}</code></pre>`;
},
link(link) {
return `<a href="${link.href}" target="_blank">${escapeHtml(link.text || link.href)}</a>`;
},
},
});