mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
fixes
This commit is contained in:
@@ -145,6 +145,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Message {
|
class Message {
|
||||||
|
#destroyed = false;
|
||||||
|
|
||||||
#id;
|
#id;
|
||||||
#role;
|
#role;
|
||||||
#reasoning;
|
#reasoning;
|
||||||
@@ -704,6 +706,7 @@
|
|||||||
data.files = this.#files.map(file => ({
|
data.files = this.#files.map(file => ({
|
||||||
name: file.name,
|
name: file.name,
|
||||||
content: file.content,
|
content: file.content,
|
||||||
|
tokens: file.tokens,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,7 +753,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadGenerationData(generationID, retrying = false) {
|
async loadGenerationData(generationID, retrying = false) {
|
||||||
if (!generationID) {
|
if (!generationID || this.#destroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -937,6 +940,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
|
this.#destroyed = true;
|
||||||
|
|
||||||
const index = messages.findIndex(msg => msg.#id === this.#id);
|
const index = messages.findIndex(msg => msg.#id === this.#id);
|
||||||
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
@@ -1148,16 +1153,19 @@
|
|||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function finish(aborted = false) {
|
function finish() {
|
||||||
if (!message) {
|
if (!message) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.setState(false);
|
const msg = message,
|
||||||
|
genID = generationID;
|
||||||
|
|
||||||
if (!aborted) {
|
msg.setState(false);
|
||||||
setTimeout(message.loadGenerationData.bind(message), 1000, generationID);
|
|
||||||
}
|
setTimeout(() => {
|
||||||
|
msg.loadGenerationData(genID);
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
message = null;
|
message = null;
|
||||||
generationID = null;
|
generationID = null;
|
||||||
@@ -1192,23 +1200,17 @@
|
|||||||
chunk => {
|
chunk => {
|
||||||
stopLoadingTimeout();
|
stopLoadingTimeout();
|
||||||
|
|
||||||
console.log("chunk", chunk);
|
if (chunk === "aborted" || chunk === "done") {
|
||||||
|
|
||||||
if (chunk === "aborted") {
|
|
||||||
chatController = null;
|
|
||||||
|
|
||||||
finish(true);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else if (chunk === "done") {
|
|
||||||
chatController = null;
|
chatController = null;
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
$chat.classList.remove("completing");
|
if (chunk === "done") {
|
||||||
|
$chat.classList.remove("completing");
|
||||||
|
|
||||||
if (!chatTitle && !titleController) {
|
if (!chatTitle && !titleController) {
|
||||||
refreshTitle();
|
refreshTitle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1517,7 +1519,7 @@
|
|||||||
_file.appendChild(_name);
|
_file.appendChild(_name);
|
||||||
|
|
||||||
// token count
|
// token count
|
||||||
if ("tokens" in file) {
|
if ("tokens" in file && Number.isInteger(file.tokens)) {
|
||||||
const _tokens = make("div", "tokens");
|
const _tokens = make("div", "tokens");
|
||||||
|
|
||||||
_tokens.textContent = `~${new Intl.NumberFormat("en-US").format(file.tokens)} tokens`;
|
_tokens.textContent = `~${new Intl.NumberFormat("en-US").format(file.tokens)} tokens`;
|
||||||
|
|||||||
Reference in New Issue
Block a user