Add Regenerate button for assistant messages #156

Closed
opened 2025-12-26 22:02:24 +00:00 by rwachters · 0 comments
rwachters commented 2025-12-26 22:02:24 +00:00 (Migrated from github.com)

Feature Description

Activate the Regenerate button for assistant messages. This is functionally equivalent to "Branch & Continue" from the target's parent message, but it is more intuitive for assistant messages.

The regenerate button is already present in the code, but is currently deactivated in the UI (see MessageActionRow.kt).

Implementation Plan

  1. Add onRegenerateMessage method to ChatAreaActions interface for regenerating assistant responses

  2. Implement onRegenerateMessage in ChatScreen's chatAreaActions to delegate to chatViewModel.regenerateMessage(message)

  3. Add regenerateMessage(message) method in ChatViewModel that calls sendMessage(continueFromMessage = parentMessage) after looking up the parent

  4. Wire up onRegenerateMessage in ChatArea's MessageActions initialization to use actions::onRegenerateMessage

  5. Update RegenerateButton in MessageActionRow to hide when assistant message has no parent (root message edge case)

Edge Cases

  • In case the assistant message is the root of the conversation (very unlikely), the regenerate button should not be shown
  • Add null check in ViewModel for robustness even if UI hides the button

Testing

  • Run desktop tests after implementation to ensure the feature works correctly with branch navigation
### Feature Description Activate the Regenerate button for assistant messages. This is functionally equivalent to "Branch & Continue" from the target's parent message, but it is more intuitive for assistant messages. The regenerate button is already present in the code, but is currently deactivated in the UI (see `MessageActionRow.kt`). ### Implementation Plan 1. **Add `onRegenerateMessage` method to `ChatAreaActions` interface** for regenerating assistant responses 2. **Implement `onRegenerateMessage` in `ChatScreen`'s `chatAreaActions`** to delegate to `chatViewModel.regenerateMessage(message)` 3. **Add `regenerateMessage(message)` method in `ChatViewModel`** that calls `sendMessage(continueFromMessage = parentMessage)` after looking up the parent 4. **Wire up `onRegenerateMessage` in `ChatArea`'s `MessageActions` initialization** to use `actions::onRegenerateMessage` 5. **Update `RegenerateButton` in `MessageActionRow`** to hide when assistant message has no parent (root message edge case) ### Edge Cases - In case the assistant message is the root of the conversation (very unlikely), the regenerate button should not be shown - Add null check in ViewModel for robustness even if UI hides the button ### Testing - Run desktop tests after implementation to ensure the feature works correctly with branch navigation
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Torvian.eu/chatbot#156
No description provided.