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