mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-08 17:06:42 +00:00
some fixes
This commit is contained in:
@@ -31,6 +31,7 @@ whiskr is a private, self-hosted web chat interface for interacting with AI mode
|
|||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- resizable chat box
|
- resizable chat box
|
||||||
|
- cost tracker
|
||||||
- settings
|
- settings
|
||||||
- auto-retry on edit
|
- auto-retry on edit
|
||||||
- ctrl+enter vs enter for sending
|
- ctrl+enter vs enter for sending
|
||||||
|
@@ -39,8 +39,20 @@
|
|||||||
let searchAvailable = false,
|
let searchAvailable = false,
|
||||||
activeMessage;
|
activeMessage;
|
||||||
|
|
||||||
|
function updateScrollButton() {
|
||||||
|
const bottom = $messages.scrollHeight - ($messages.scrollTop + $messages.offsetHeight);
|
||||||
|
|
||||||
|
if (bottom >= 80) {
|
||||||
|
$bottom.classList.remove("hidden");
|
||||||
|
} else {
|
||||||
|
$bottom.classList.add("hidden");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function scroll(force = false) {
|
function scroll(force = false) {
|
||||||
if (!autoScrolling && !force) {
|
if (!autoScrolling && !force) {
|
||||||
|
updateScrollButton();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,13 +172,13 @@
|
|||||||
_toggle.addEventListener("click", () => {
|
_toggle.addEventListener("click", () => {
|
||||||
this.#expanded = !this.#expanded;
|
this.#expanded = !this.#expanded;
|
||||||
|
|
||||||
|
this.#_message.classList.toggle("expanded", this.#expanded);
|
||||||
|
|
||||||
if (this.#expanded) {
|
if (this.#expanded) {
|
||||||
this.#updateReasoningHeight();
|
this.#updateReasoningHeight();
|
||||||
|
|
||||||
this.#_message.classList.add("expanded");
|
|
||||||
} else {
|
|
||||||
this.#_message.classList.remove("expanded");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateScrollButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
// message reasoning (height wrapper)
|
// message reasoning (height wrapper)
|
||||||
@@ -211,6 +223,8 @@
|
|||||||
|
|
||||||
_call.addEventListener("click", () => {
|
_call.addEventListener("click", () => {
|
||||||
this.#_tool.classList.toggle("expanded");
|
this.#_tool.classList.toggle("expanded");
|
||||||
|
|
||||||
|
updateScrollButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
// tool call name
|
// tool call name
|
||||||
@@ -423,6 +437,8 @@
|
|||||||
this.#updateToolHeight();
|
this.#updateToolHeight();
|
||||||
|
|
||||||
noScroll || scroll();
|
noScroll || scroll();
|
||||||
|
|
||||||
|
updateScrollButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!only || only === "statistics") {
|
if (!only || only === "statistics") {
|
||||||
@@ -435,7 +451,7 @@
|
|||||||
price = cost < 1 ? `${fixed(cost * 100, 1)}ct` : `$${fixed(cost, 2)}`;
|
price = cost < 1 ? `${fixed(cost * 100, 1)}ct` : `$${fixed(cost, 2)}`;
|
||||||
|
|
||||||
html = [
|
html = [
|
||||||
provider ? `<div class="provider">${provider} (<span class="mono">${model.split("/").pop()}</span>)</div>` : "",
|
provider ? `<div class="provider">${provider} (${model.split("/").pop()})</div>` : "",
|
||||||
`<div class="ttft">${formatMilliseconds(ttft)}</div>`,
|
`<div class="ttft">${formatMilliseconds(ttft)}</div>`,
|
||||||
`<div class="tps">${fixed(tps, 2)} t/s</div>`,
|
`<div class="tps">${fixed(tps, 2)} t/s</div>`,
|
||||||
`<div class="tokens">
|
`<div class="tokens">
|
||||||
@@ -463,6 +479,8 @@
|
|||||||
this.#updateReasoningHeight();
|
this.#updateReasoningHeight();
|
||||||
|
|
||||||
noScroll || scroll();
|
noScroll || scroll();
|
||||||
|
|
||||||
|
updateScrollButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.#_message.classList.toggle("has-reasoning", !!this.#reasoning);
|
this.#_message.classList.toggle("has-reasoning", !!this.#reasoning);
|
||||||
@@ -477,6 +495,8 @@
|
|||||||
|
|
||||||
this.#patch("text", this.#_text, text, () => {
|
this.#patch("text", this.#_text, text, () => {
|
||||||
noScroll || scroll();
|
noScroll || scroll();
|
||||||
|
|
||||||
|
updateScrollButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.#_message.classList.toggle("has-text", !!this.#text);
|
this.#_message.classList.toggle("has-text", !!this.#text);
|
||||||
@@ -552,7 +572,7 @@
|
|||||||
this.#save();
|
this.#save();
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadGenerationData(generationID) {
|
async loadGenerationData(generationID, retrying = false) {
|
||||||
if (!generationID) {
|
if (!generationID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -568,6 +588,10 @@
|
|||||||
this.setStatistics(data);
|
this.setStatistics(data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
|
if (!retrying && err.message.includes("not found")) {
|
||||||
|
setTimeout(this.loadGenerationData.bind(this), 750, generationID, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,7 +903,7 @@
|
|||||||
|
|
||||||
message.setState(false);
|
message.setState(false);
|
||||||
|
|
||||||
setTimeout(message.loadGenerationData.bind(message), 750, generationID);
|
setTimeout(message.loadGenerationData.bind(message), 500, generationID);
|
||||||
|
|
||||||
message = null;
|
message = null;
|
||||||
generationID = null;
|
generationID = null;
|
||||||
@@ -912,7 +936,6 @@
|
|||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
},
|
},
|
||||||
chunk => {
|
chunk => {
|
||||||
console.log(chunk);
|
|
||||||
if (!chunk) {
|
if (!chunk) {
|
||||||
controller = null;
|
controller = null;
|
||||||
|
|
||||||
@@ -1200,13 +1223,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$messages.addEventListener("scroll", () => {
|
$messages.addEventListener("scroll", () => {
|
||||||
const bottom = $messages.scrollHeight - ($messages.scrollTop + $messages.offsetHeight);
|
updateScrollButton();
|
||||||
|
|
||||||
if (bottom >= 80) {
|
|
||||||
$bottom.classList.remove("hidden");
|
|
||||||
} else {
|
|
||||||
$bottom.classList.add("hidden");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$bottom.addEventListener("click", () => {
|
$bottom.addEventListener("click", () => {
|
||||||
|
Reference in New Issue
Block a user