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

This commit is contained in:
M57
2026-08-27 01:50:43 +03:00
committed by GitHub
parent 48c9039e02
commit 4e666b49a8
5 changed files with 63 additions and 1 deletions
@@ -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 -> {