make some overall QoL improvements
CI / check (22) (push) Failing after 15m53s
CI / check (24) (push) Failing after 15m50s

This commit is contained in:
Frederik Spirgi
2026-10-12 13:07:59 +02:00
parent f67d918d09
commit 7723125c93
11 changed files with 159 additions and 25 deletions
+8 -1
View File
@@ -2,6 +2,7 @@
import * as defaultApi from "./api.js";
import {updateReasoning, finishReasoning} from "./reasoning.js";
import {createStreamRenderer} from "./streamRenderer.js";
import {titleFromFirstMessage} from "./chatTitle.js";
export function createComposerController({
state, elements, attachmentComposer, webSearchButton, reasoningToggle, webSearchToggle,
@@ -98,7 +99,7 @@ export function createComposerController({
}
const currentChat = getChatById(chatId);
if (currentChat && !currentChat.assistant_persona_id && currentChat.title === "New chat") {
const title = message.length > 40 ? `${message.slice(0, 40)}...` : message;
const title = titleFromFirstMessage(message);
const renamed = await api.put(`/chats/${chatId}`, {title}, {signal});
signal.throwIfAborted();
if (renamed.error) throw new Error(renamed.error);
@@ -150,6 +151,12 @@ export function createComposerController({
}, {signal});
rendering.flush();
rendering.dispose();
const updatedChat = getChatById(chatId);
if (updatedChat && completedReply !== null) {
updatedChat.last_message_preview = completedReply.slice(0, 180);
updatedChat.updated_at = new Date().toISOString();
renderChatList();
}
// Keep a completed answer in both state and the DOM until history replaces it.
if (visible()) {
const reply = {role: "bot", content: completedReply, modelName: model,