make some overall QoL improvements
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user