704
return undefined;
705
}
707
>
const existing = sessionState.chats.find(c => c.resource === chatUri);
708
>
if (existing) {
709
return existing;
710
}
712
>
// A session gains its first additional chat here: snapshot the current
713
>
// session title onto the still-inheriting default chat so the two
714
>
// titles become fully independent. Without this the default chat keeps
715
>
// an empty title (= inherit the session title), so renaming the session
716
>
// would also move the default chat tab and vice-versa.
717
>
const defaultChatUri = sessionState.defaultChat ?? buildDefaultChatUri(session);
718
const defaultEntry = sessionState.chats.find(c => c.resource === defaultChatUri);
719
if (defaultEntry && !defaultEntry.title && sessionState.title) {
720
this.updateChatTitle(session, defaultChatUri, sessionState.title);
721
}
723
>
const chatSummary: ChatSummary = {
724
>
...createDefaultChatSummary(this._toSummary(session, entry), chatUri),
725
title: options?.title ?? '',
726
status: SessionStatus.Idle,