Add "Branch & Continue" action to continue conversation from any message #152
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#152
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Feature Request: Branch & Continue Action
Add a "Branch & Continue" button to the message actions menu that continues the conversation from any message by sending the thread context (up to that message) to the LLM without creating a new user message. For leaf messages, this continues where it left off; for non-leaf messages, this creates a new sibling assistant message (a new branch).
Use Cases
Implementation Plan
Backend Changes
Modify
ProcessNewMessageRequest(common/src/commonMain/.../ProcessNewMessageRequest.kt)contentfield nullable (content: String?)Refactor
buildContextmethod inChatServiceImpl(server/src/main/.../ChatServiceImpl.kt)buildContext(userMessage: ChatMessage.UserMessage, ...)tobuildContext(startingMessageId: Long, ...)Update
processNewMessageandprocessNewMessageStreaminginChatServiceImplsaveUserMessageonly whencontent != nulllastMessageId = parentMessageId!!(non-null assertion since validation ensures it)buildContext(parentMessageId, ...)instead ofbuildContext(userMessage, ...)Update
ChatServiceinterface signaturescontent: Stringparameter tocontent: String?for bothprocessNewMessageandprocessNewMessageStreamingAdd validation in
validateProcessNewMessageRequestcontent == null,parentMessageIdmust not be nullValidateNewMessageError.ModelConfigurationErrorwith appropriate message if validation failsFrontend Changes
Add
onBranchAndContinuecallback toMessageActionsdata classval onBranchAndContinue: (ChatMessage) -> UnitAdd
BranchAndContinueMenuItemcomposable inMessageActionRow.ktMoreActionsMenudropdownIcons.Default.PlayArrowicon (or considerIcons.Default.CallSplit,Icons.AutoFixHigh)messageActions.onBranchAndContinue(message)on clickAdd
onBranchAndContinuemethod toChatAreaActionsinterfaceChatScreen.ktto callchatViewModel.branchAndContinue(message)ChatArea.ktto passonBranchAndContinue = actions::onBranchAndContinueCreate
BranchAndContinueUseCaseapp/src/commonMain/.../viewmodel/chat/usecase/BranchAndContinueUseCase.ktChatState,SessionRepository,NotificationServiceProcessNewMessageRequestwithcontent = nullandparentMessageId = message.idSendMessageUseCaseAdd method to
ChatViewModelfun branchAndContinue(message: ChatMessage)that calls the use caseWire up dependency injection in Koin app module
BranchAndContinueUseCaseto ChatViewModel factory parametersUI/UX Considerations
Icons.Default.PlayArrowfor a clean "continue/play" metaphorTechnical Notes
buildContextfunction already traverses from any message up to the root, building the conversation threadTesting Checklist