fix(ui): rename forked session to parent title

This commit is contained in:
Shantur Rathore
2026-01-29 22:34:30 +00:00
parent afa7243eab
commit 81102cc6bf

View File

@@ -9,7 +9,7 @@ import PromptInput from "../prompt-input"
import type { Attachment as PromptAttachment } from "../../types/attachment"
import { getAttachments, removeAttachment } from "../../stores/attachments"
import { instances } from "../../stores/instances"
import { loadMessages, sendMessage, forkSession, isSessionMessagesLoading, setActiveParentSession, setActiveSession, runShellCommand, abortSession } from "../../stores/sessions"
import { loadMessages, sendMessage, forkSession, renameSession, isSessionMessagesLoading, setActiveParentSession, setActiveSession, runShellCommand, abortSession } from "../../stores/sessions"
import { isSessionBusy as getSessionBusyStatus } from "../../stores/session-status"
import { showAlertDialog } from "../../stores/alerts"
import { getLogger } from "../../lib/logger"
@@ -217,10 +217,15 @@ export const SessionView: Component<SessionViewProps> = (props) => {
}
const restoredText = getUserMessageText(messageId)
const parentTitle = (session()?.title ?? "").trim() || t("sessionList.session.untitled")
try {
const forkedSession = await forkSession(props.instanceId, props.sessionId, { messageId })
renameSession(props.instanceId, forkedSession.id, `Fork: ${parentTitle}`).catch((error) => {
log.error("Failed to rename forked session", error)
})
const parentToActivate = forkedSession.parentId ?? forkedSession.id
setActiveParentSession(props.instanceId, parentToActivate)
if (forkedSession.parentId) {