feat(webui): show forked history boundary

This commit is contained in:
Xubin Ren
2026-06-10 04:26:06 +08:00
parent 73d4b1cb2f
commit 26a58282d4
21 changed files with 242 additions and 121 deletions
+11 -2
View File
@@ -29,6 +29,7 @@ import {
loadSavedSecret,
saveSecret,
} from "@/lib/bootstrap";
import { displayTitle } from "@/lib/chat-groups";
import { deriveTitle } from "@/lib/format";
import { NanobotClient } from "@/lib/nanobot-client";
import { ClientProvider, useClient } from "@/providers/ClientProvider";
@@ -890,7 +891,15 @@ function Shell({
beforeUserIndex: number,
) => {
try {
const chatId = await forkChat(sourceChatId, beforeUserIndex);
const sourceSession = sessions.find((session) => session.chatId === sourceChatId);
const sourceTitle = sourceSession
? displayTitle(sourceSession, sidebarState.title_overrides, t("chat.newChat"))
: t("chat.newChat");
const chatId = await forkChat(
sourceChatId,
beforeUserIndex,
t("chat.forkTitle", { title: sourceTitle }),
);
navigate({
view: "chat",
activeKey: `websocket:${chatId}`,
@@ -902,7 +911,7 @@ function Shell({
console.error("Failed to fork chat", e);
return null;
}
}, [forkChat, navigate]);
}, [forkChat, navigate, sessions, sidebarState.title_overrides, t]);
const onNewChat = useCallback(() => {
navigate(defaultShellRoute());