feat(chat): intercept /new in canonical Bot Chat sessions to /compact (#979)

This commit is contained in:
M57 authored and GitHub committed 2026-08-27 01:50:43 +03:00
1 parent 48c9039e02
commit 4e666b49a8
5 files changed
+63 -1

No files matched your search

@@ -1573,7 +1573,22 @@ class ChatViewModel(
}
is SlashResult.NewSession -> {
createNewSession()
val currentTitle = _uiState.value.chatTitle
if (currentTitle.equals("Bot Chat", ignoreCase = true)) {
// Bot Chat is a canonical forever-conversation — compact instead of creating an orphan
val sessionId = _uiState.value.currentSessionId
if (!sessionId.isNullOrBlank()) {
addAssistantMessage(
"Bot chats are one continuous conversation — compacting instead. " +
"For a throwaway session, create a standard chat.",
)
dispatchViaRpc("/compact")
} else {
createNewSession()
}
} else {
createNewSession()
}
}
is SlashResult.SessionBranch -> {