1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-08 17:06:42 +00:00

improvements

This commit is contained in:
2025-08-30 00:25:48 +02:00
parent c7c3bff2d8
commit be17a801f8
3 changed files with 15 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ type ToolCall struct {
Args string `json:"args"`
Result string `json:"result,omitempty"`
Done bool `json:"done,omitempty"`
Invalid bool `json:"invalid,omitempty"`
Cost float64 `json:"cost,omitempty"`
}
@@ -323,7 +324,8 @@ func HandleChat(w http.ResponseWriter, r *http.Request) {
return
}
default:
return
tool.Invalid = true
tool.Result = "error: invalid tool call"
}
tool.Done = true

View File

@@ -368,6 +368,8 @@ body:not(.loading) #loading {
width: calc(800px - 24px);
}
.message .tool.invalid,
.message .tool .result.error,
.message .text .error {
color: #ed8796;
}

View File

@@ -493,7 +493,7 @@
if (!only || only === "tool") {
if (this.#tool) {
const { name, args, result, cost } = this.#tool;
const { name, args, result, cost, invalid } = this.#tool;
const _name = this.#_tool.querySelector(".name"),
_arguments = this.#_tool.querySelector(".arguments"),
@@ -508,8 +508,11 @@
_cost.textContent = cost ? `${formatMoney(cost)}` : "";
_result.classList.toggle("error", result?.startsWith("error: "));
_result.innerHTML = render(result || "*processing*");
this.#_tool.classList.toggle("invalid", invalid);
this.#_tool.setAttribute("data-tool", name);
} else {
this.#_tool.removeAttribute("data-tool");