Skip to content

Conversation

oyasumiaiko
Copy link
Contributor

@oyasumiaiko oyasumiaiko commented Aug 25, 2025

What this PR does

This PR introduces several significant UX improvements, new features, and bug fixes aimed at creating a more fluid and responsive user experience.

  1. UX & Interaction Overhaul:
    • Removes the loading state block on the input bar, allowing users to prepare the next message while a response is being generated.
    • Replaces the separate "Pause" button with a right-click context menu on the "Send" button, cleaning up the input area.
    • Removes the confirmation pop-ups for "Regenerate" and "Delete" actions, making these operations immediate and faster.
    • Ensures message menubars remain visible and interactive even while a new message is streaming in, allowing users to act on previous messages without interruption.
  2. New Feature:
    • Adds a "Retry failed messages" button to the message group menubar. This allows users to regenerate all failed or empty assistant responses within a group with a single click.
  3. Stability & Fixes:
    • Implements a fallback mechanism in the API service and message thunk to ensure that the message context sent to the backend is never empty. It guarantees at least the last user message is included, preventing potential API errors.
    • Adds i18n translations for the new "Retry failed messages" feature across all supported languages (en-US, ja-JP, ru-RU, zh-CN, zh-TW).

Before this PR:

  • The input bar was disabled during message generation, showing a "Pause" button.
  • Deleting or regenerating a message required an extra click on a confirmation dialog.
  • If multiple messages in a group failed, they had to be regenerated individually.
  • Message menubars were hidden or disabled during streaming, preventing actions like copying or creating a new branch.
  • In some edge cases, an empty message array could be sent to the API, causing a request failure.

After this PR:

  • The input bar is always active. Users can right-click the "Send" button to pause generation.
  • Delete and Regenerate actions are instant (one-click).
  • A new "Retry" button on the group menubar can regenerate all failed messages at once.
  • All UI elements, including menubars on previous messages, remain fully interactive during generation.
  • The application is more robust, with safeguards against sending empty payloads to the API.

Fixes

Why we need it and why it was done in this way

The primary goal of these changes is to enhance user efficiency and streamline the application's core chat experience.

  • Decoupling UI from Loading State: By removing the global loading block, we empower users to multitask and maintain their flow. The previous implementation was overly restrictive and interrupted common workflows.
  • Reducing Interaction Friction: Removing confirmation dialogs for frequent actions respects the user's intent and speeds up the process of editing and curating conversations, a pattern common in power-user tools.
  • Improving UI Consistency: Consolidating the "Pause" action into the "Send" button's context menu creates a cleaner and more predictable interface, avoiding layout shifts caused by elements appearing and disappearing.
  • Enhancing Robustness: The context fallback is a critical defensive measure that prevents a class of hard-to-debug errors and improves the overall reliability of the chat functionality.
  • Adding Bulk Actions: The "Retry all" feature is a direct response to the pain point of handling multiple model or network failures, turning a tedious task into a single-click operation.

Breaking changes

  • User Workflow Change: The removal of confirmation dialogs for "Delete" and "Regenerate" is a behavioral breaking change. Users accustomed to the safety net will need to adapt to the new, immediate actions. This change prioritizes speed and efficiency over error prevention.

Special notes for your reviewer

Please pay close attention to the UX changes:

  1. Removal of Confirmations: This is a deliberate design choice to improve flow. Please consider if this aligns with our product's philosophy.
  2. Right-Click to Pause: Kindly test this new interaction on different operating systems (Windows, macOS) to ensure it is intuitive and functions as expected.

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

- **New**: Added a "Retry failed messages" button in the message group menubar to regenerate all failed responses at once.
- **Improved**: Removed confirmation dialogs for deleting and regenerating messages for a faster workflow. **action required**: Be aware that these actions are now immediate.
- **Improved**: The input bar and message menubars are no longer blocked during message generation, improving UI responsiveness.
- **Improved**: You can now pause a streaming response by right-clicking the "Send" button.
- **Fixed**: Prevented potential errors by ensuring API requests do not contain an empty message list.

@oyasumiaiko oyasumiaiko marked this pull request as ready for review August 25, 2025 12:04
@DeJeune DeJeune self-assigned this Aug 26, 2025
@DeJeune DeJeune requested a review from EurFelux August 26, 2025 05:58
@EurFelux
Copy link
Collaborator

  • 删除操作和重新生成都是会导致已有数据丢失的危险操作,不建议去除二次确认,至少做成设置项
  • 允许响应生成中时发送新消息将导致无法获取正确的消息历史上下文
  • 重试出错这个按钮应该在存在出错时才显示

@oyasumiaiko
Copy link
Contributor Author

oyasumiaiko commented Aug 26, 2025

  • 删除操作和重新生成都是会导致已有数据丢失的危险操作,不建议去除二次确认,至少做成设置项

已经在输入设置里针对重新生成和删除消息分别加入了设置项,默认启用确认对话框 af1465d
对此前本就缺少确认的用户消息下的重新生成按钮也应用了通过设置项控制是否二次确认的功能 614680f

image
  • 允许响应生成中时发送新消息将导致无法获取正确的消息历史上下文

目前的实现是,即便在AI响应生成中发送新消息,系统也会采用​​本次正在生成之前​​的对话历史作为上下文。因此,新消息的上下文是准确的,不会包含正在流式输出的不完整内容。
为了让用户对操作有更清晰的掌控,现在已将“暂停”按钮从发送键中独立出来。用户可以随时中断当前的生成任务,然后再发送新消息,确保了操作的确定性。b4dc1b1

image
  • 重试出错这个按钮应该在存在出错时才显示

感谢指出,已经加入了这个判断 3c804c0

Copy link
Collaborator

@EurFelux EurFelux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

基本ok,只有一点小问题。允许对生成中的消息进行操作存在潜在风险,但目前没发现什么问题,后面有bug可以再修。

@EurFelux
Copy link
Collaborator

还有冲突

@oyasumiaiko oyasumiaiko force-pushed the remove-loading-state-blocking branch 2 times, most recently from 3014c75 to 8fe6067 Compare August 27, 2025 19:22
- Inputbar: drop loading check; keep Send clickable; right-click to pause
- Message/MessageMenubar: render menubar even while streaming
- Minor cleanup of unused imports and lints
…context fallback

- MessageMenubar: remove Popconfirm; click to regenerate
- ApiService: ensure last user message is included if filters empty (avoid messages=[])
- Minor cleanup
…g streaming

- MessageGroupMenuBar: add “Retry all” (ReloadOutlined) to retry errored/empty/no-block replies; tooltip via i18n
- Context fallback: always include last user message in both messageThunk and ApiService
- i18n: add message.group.retry_failed (zh-CN, en-US, ja-JP, ru-RU, zh-TW)
- Cleanup: remove unused imports; fix lints
- Add "Confirm before deleting message" and "Confirm before regenerating message" options to the settings page, allowing users to customize action confirmations.
- Update internationalization files to support multi-language prompt messages.
- Modify the message menu bar to integrate the confirmation logic, enhancing the user experience.
Previously, the "Regenerate" action on user messages would trigger immediately, bypassing the `confirmRegenerateMessage` setting. This behavior was inconsistent with the regeneration logic for assistant messages, which correctly showed a confirmation dialog.

This commit wraps the user message's regenerate button in a `Popconfirm` component, conditioned on the `confirmRegenerateMessage` setting. This aligns its behavior with the existing logic for assistant messages.

Now, all regeneration actions are uniformly governed by the user's confirmation preference, creating a more consistent and predictable user experience.
fix(ui): Conditionally render the 'Retry failed' button

The 'Retry failed messages' button in the message group menu bar was previously always visible, even when no messages had failed.

- The 'Retry failed' button is now conditionally rendered and will only appear if one or more messages in the group meet the failure criteria.
Replaced the undiscoverable right-click-to-pause functionality on the send button with a dedicated, visible "Pause" button. This new button only appears during message generation, making the action intuitive and accessible.

- Removed `onPause` and context menu logic from `SendMessageButton`.
- Added a conditional `CirclePause` button to the `Inputbar` when loading.
…sers

- Add migration 138 to default confirmDeleteMessage/confirmRegenerateMessage
- No behavior change for fresh installs (uses initialState)

fix(format): correct indentation in MessageMenubar

fix(settings/migrate): fix persistedReducer verison
- Remove unnecessary `topic.prompt` dependencies from Message components
- Remove `loading` dependency from Inputbar useCallback

Resolves ESLint exhaustive-deps warnings.
@oyasumiaiko oyasumiaiko force-pushed the remove-loading-state-blocking branch from 25b3a19 to a9b7421 Compare August 28, 2025 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants