1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-12-02 20:22:52 +00:00

auto-update model list and show creation date

This commit is contained in:
Laura
2025-09-28 00:12:50 +02:00
parent f7b43fb559
commit 6bede7483d
6 changed files with 73 additions and 16 deletions

View File

@@ -1451,7 +1451,7 @@
// render models
fillSelect($model, data.models, (el, model) => {
el.value = model.id;
el.title = model.description;
el.title = `${model.name} (${formatTimestamp(model.created)})\n---\n${model.description}`;
el.textContent = model.name;
el.dataset.tags = (model.tags || []).join(",");

View File

@@ -97,7 +97,6 @@
// option label
const _label = make("div", "label");
_label.title = option.label;
_label.textContent = option.label;
_opt.appendChild(_label);

View File

@@ -56,6 +56,10 @@ function formatMilliseconds(ms) {
return `${Math.round(ms / 1000)}s`;
}
function formatTimestamp(ts) {
return new Date(ts * 1000).toLocaleDateString();
}
function dataBlob(dataUrl) {
const [header, data] = dataUrl.split(","),
mime = header.match(/data:(.*?)(;|$)/)[1];