mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-08 00:29:54 +00:00
Compare commits
4 Commits
be17a801f8
...
118e88ab67
Author | SHA1 | Date | |
---|---|---|---|
![]() |
118e88ab67 | ||
![]() |
dc8ad8d408 | ||
![]() |
7abfd965db | ||
![]() |
fc0a34ee12 |
@@ -714,6 +714,7 @@ body:not(.loading) #loading {
|
||||
.files {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.files:not(.has-files) {
|
||||
|
@@ -267,6 +267,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
this.#_edit.addEventListener("input", () => {
|
||||
this.updateEditHeight();
|
||||
});
|
||||
|
||||
// message tool
|
||||
this.#_tool = make("div", "tool");
|
||||
|
||||
@@ -381,7 +385,7 @@
|
||||
|
||||
mark(false);
|
||||
|
||||
generate(false);
|
||||
generate(false, true);
|
||||
});
|
||||
|
||||
// edit option
|
||||
@@ -511,7 +515,7 @@
|
||||
_result.classList.toggle("error", result?.startsWith("error: "));
|
||||
_result.innerHTML = render(result || "*processing*");
|
||||
|
||||
this.#_tool.classList.toggle("invalid", invalid);
|
||||
this.#_tool.classList.toggle("invalid", !!invalid);
|
||||
|
||||
this.#_tool.setAttribute("data-tool", name);
|
||||
} else {
|
||||
@@ -797,6 +801,11 @@
|
||||
this.toggleEdit();
|
||||
}
|
||||
|
||||
updateEditHeight() {
|
||||
this.#_edit.style.height = "";
|
||||
this.#_edit.style.height = `${Math.max(100, this.#_edit.scrollHeight + 2)}px`;
|
||||
}
|
||||
|
||||
toggleEdit() {
|
||||
this.#editing = !this.#editing;
|
||||
|
||||
@@ -804,11 +813,10 @@
|
||||
activeMessage = this;
|
||||
|
||||
this.#_edit.value = this.#text;
|
||||
this.#_edit.style.height = "";
|
||||
|
||||
this.setState("editing");
|
||||
|
||||
this.#_edit.style.height = `${Math.max(100, this.#_edit.scrollHeight)}px`;
|
||||
this.updateEditHeight();
|
||||
|
||||
this.#_edit.focus();
|
||||
} else {
|
||||
@@ -932,7 +940,7 @@
|
||||
|
||||
let chatController;
|
||||
|
||||
function generate(cancel = false) {
|
||||
function generate(cancel = false, noPush = false) {
|
||||
if (chatController) {
|
||||
chatController.abort();
|
||||
|
||||
@@ -972,7 +980,9 @@
|
||||
$reasoningTokens.classList.remove("invalid");
|
||||
}
|
||||
|
||||
pushMessage();
|
||||
if (!noPush) {
|
||||
pushMessage();
|
||||
}
|
||||
|
||||
chatController = new AbortController();
|
||||
|
||||
@@ -1599,6 +1609,7 @@
|
||||
|
||||
$export.addEventListener("click", () => {
|
||||
const data = JSON.stringify({
|
||||
title: chatTitle,
|
||||
message: $message.value,
|
||||
attachments: attachments,
|
||||
role: $role.value,
|
||||
@@ -1639,6 +1650,7 @@
|
||||
|
||||
clearMessages();
|
||||
|
||||
storeValue("title", data.title);
|
||||
storeValue("message", data.message);
|
||||
storeValue("attachments", data.attachments);
|
||||
storeValue("role", data.role);
|
||||
|
10
title.go
10
title.go
@@ -16,8 +16,7 @@ type TitleRequest struct {
|
||||
}
|
||||
|
||||
type TitleResponse struct {
|
||||
Title string `json:"title"`
|
||||
Cost float64 `json:"cost,omitempty"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -146,7 +145,8 @@ func HandleTitle(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
result.Cost = cost
|
||||
|
||||
RespondJson(w, http.StatusOK, result)
|
||||
RespondJson(w, http.StatusOK, map[string]any{
|
||||
"title": result.Title,
|
||||
"cost": cost,
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user