Skip to content

Conversation

@emmanuelbaa
Copy link
Member

fixes #9428

make conf

This commit introduces several key improvements to the chat feature to enhance user experience and fix bugs.

  1. Enter-to-Send Functionality:

    • Implements the standard chat behavior where the "Enter" key sends the message and "Shift + Enter" creates a new line.
    • Adds a keydown event listener to the chat textarea to handle this logic.
    • Replicates the existing form validation from the send button to prevent empty messages or multiple submissions.
  2. Immediate UI Feedback (Optimistic Update):

    • The chat UI is now updated optimistically. The user's message is added to the conversation list and the input field is cleared as soon as the message is submitted, rather than waiting for the server response. This makes the chat feel more responsive.
  3. Sidebar Conversation History Fix:

    • Fixes a bug where new conversations were not appearing in the sidebar history until after the first response was received.
    • A signal is now sent to the ChatService as soon as a message is sent in a new conversation, ensuring the sidebar updates immediately.
    • Fixes a subsequent bug where this signal was being sent twice.
  4. UI Rendering Fix:

    • Restores the role: 'user' property to the conversation object when performing an optimistic update, preventing potential UI rendering issues for user messages.

google-labs-jules bot and others added 4 commits December 12, 2025 19:00
Implements the standard chat behavior where the "Enter" key sends the message and "Shift + Enter" creates a new line.

- Adds a `keydown` event listener to the chat textarea.
- The event handler checks for the "Enter" key press without the "Shift" key.
- Replicates the existing form validation from the send button to ensure empty messages or multiple submissions while processing are not allowed.
Implements the standard chat behavior where the "Enter" key sends the message and "Shift + Enter" creates a new line.

- Adds a `keydown` event listener to the chat textarea.
- The event handler checks for the "Enter" key press without the "Shift" key and sends the message.
- Replicates the existing form validation from the send button to ensure empty messages or multiple submissions while processing are not allowed.

Additionally, this change improves the user experience by providing immediate feedback when a message is sent.

- The chat UI is now updated optimistically, adding the user's message to the conversation list and clearing the input field as soon as the message is sent, rather than waiting for the server response. This makes the chat feel more responsive.
This commit introduces several key improvements to the chat feature to enhance user experience and fix bugs.

1.  **Enter-to-Send Functionality:**
    - Implements the standard chat behavior where the "Enter" key sends the message and "Shift + Enter" creates a new line.
    - Adds a `keydown` event listener to the chat textarea to handle this logic.
    - Replicates the existing form validation from the send button to prevent empty messages or multiple submissions.

2.  **Immediate UI Feedback (Optimistic Update):**
    - The chat UI is now updated optimistically. The user's message is added to the conversation list and the input field is cleared as soon as the message is submitted, rather than waiting for the server response. This makes the chat feel more responsive.

3.  **Sidebar Conversation History Fix:**
    - Fixes a bug where new conversations were not appearing in the sidebar history until after the first response was received.
    - A signal is now sent to the `ChatService` as soon as a message is sent in a new conversation, ensuring the sidebar updates immediately.
    - Fixes a subsequent bug where this signal was being sent twice.

4.  **UI Rendering Fix:**
    - Restores the `role: 'user'` property to the conversation object when performing an optimistic update, preventing potential UI rendering issues for user messages.
Mutugiii and others added 3 commits December 17, 2025 23:48
Co-authored-by: dogi <dogi@users.noreply.github.com>
Co-authored-by: mutugiii <mutugimutuma@gmail.com>
Co-authored-by: dogi <dogi@users.noreply.github.com>
Co-authored-by: mutugiii <mutugimutuma@gmail.com>
Co-authored-by: dogi <dogi@users.noreply.github.com>
Copy link
Member

@Mutugiii Mutugiii left a comment

Choose a reason for hiding this comment

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

This brings about some regressions in the chat:

  • On submit, we see the last created chat instead of the question asked
  • Newly created chats are no longer showing up in the sidebar
  • Enter submission disregards the chat disabled state

@emmanuelbaa
Copy link
Member Author

This brings about some regressions in the chat:

  • On submit, we see the last created chat instead of the question asked
  • Newly created chats are no longer showing up in the sidebar
  • Enter submission disregards the chat disabled state

great reviews, i will work on that

Mutugiii and others added 8 commits December 22, 2025 04:41
Co-authored-by: dogi <dogi@users.noreply.github.com>
Co-authored-by: mutugiii <mutugimutuma@gmail.com>
Co-authored-by: dogi <dogi@users.noreply.github.com>
Co-authored-by: mutugiii <mutugimutuma@gmail.com>
Co-authored-by: dogi <dogi@users.noreply.github.com>
Co-authored-by: dogi <dogi@users.noreply.github.com>
Modify the onKeyDown method in ChatWindowComponent to check the
'disabled' state of the chat before allowing submission via the
Enter key. This prevents unintended submissions when the chat
input is visually or programmatically disabled.
Refactor submitPrompt() and postSubmit() in ChatWindowComponent to:
- Prevent premature clearing of conversation messages for new chats.
- Ensure the sidebar is notified correctly when a new chat is created
  and saved.

This addresses regressions where the last asked question was not
displaying on submit, and the last chat was not showing in the
sidebar.
@emmanuelbaa
Copy link
Member Author

please kindly review again

emmanuelbaa and others added 6 commits December 22, 2025 18:19
This commit re-applies the fix for the issue where pressing Enter
would submit a chat message even when the chat input was in a
disabled state. The onKeyDown method in ChatWindowComponent now
correctly checks the 'disabled' property before allowing submission.
…tempt)

Re-addresses the regressions where the last asked question was not
displaying on submit and the last chat was not showing in the
sidebar.

- Modified subscribeToSelectedConversation() to filter out
  unnecessary re-fetches from the database after a local update,
  preventing overwrites of the current conversation.
- Corrected TypeScript error TS2339 by casting conversationId to
  any within the filter operator to allow access to the _id
  property.
- Modified submitPrompt() to correctly handle new conversation
  initiation and postSubmit() to conditionally send new chat
  signals, preventing double conversation resets and ensuring
  correct chat display and sidebar updates.
Implements the standard chat behavior where the "Enter" key sends the message and "Shift + Enter" creates a new line.

- Adds a `keydown` event listener to the chat textarea.
- The event handler checks for the "Enter" key press without the "Shift" key.
- Replicates the existing form validation from the send button to ensure empty messages or multiple submissions while processing are not allowed.
Implements the standard chat behavior where the "Enter" key sends the message and "Shift + Enter" creates a new line.

- Adds a `keydown` event listener to the chat textarea.
- The event handler checks for the "Enter" key press without the "Shift" key and sends the message.
- Replicates the existing form validation from the send button to ensure empty messages or multiple submissions while processing are not allowed.

Additionally, this change improves the user experience by providing immediate feedback when a message is sent.

- The chat UI is now updated optimistically, adding the user's message to the conversation list and clearing the input field as soon as the message is sent, rather than waiting for the server response. This makes the chat feel more responsive.
This commit introduces several key improvements to the chat feature to enhance user experience and fix bugs.

1.  **Enter-to-Send Functionality:**
    - Implements the standard chat behavior where the "Enter" key sends the message and "Shift + Enter" creates a new line.
    - Adds a `keydown` event listener to the chat textarea to handle this logic.
    - Replicates the existing form validation from the send button to prevent empty messages or multiple submissions.

2.  **Immediate UI Feedback (Optimistic Update):**
    - The chat UI is now updated optimistically. The user's message is added to the conversation list and the input field is cleared as soon as the message is submitted, rather than waiting for the server response. This makes the chat feel more responsive.

3.  **Sidebar Conversation History Fix:**
    - Fixes a bug where new conversations were not appearing in the sidebar history until after the first response was received.
    - A signal is now sent to the `ChatService` as soon as a message is sent in a new conversation, ensuring the sidebar updates immediately.
    - Fixes a subsequent bug where this signal was being sent twice.

4.  **UI Rendering Fix:**
    - Restores the `role: 'user'` property to the conversation object when performing an optimistic update, preventing potential UI rendering issues for user messages.
Modify the onKeyDown method in ChatWindowComponent to check the
'disabled' state of the chat before allowing submission via the
Enter key. This prevents unintended submissions when the chat
input is visually or programmatically disabled.
Refactor submitPrompt() and postSubmit() in ChatWindowComponent to:
- Prevent premature clearing of conversation messages for new chats.
- Ensure the sidebar is notified correctly when a new chat is created
  and saved.

This addresses regressions where the last asked question was not
displaying on submit, and the last chat was not showing in the
sidebar.
This commit re-applies the fix for the issue where pressing Enter
would submit a chat message even when the chat input was in a
disabled state. The onKeyDown method in ChatWindowComponent now
correctly checks the 'disabled' property before allowing submission.
…tempt)

Re-addresses the regressions where the last asked question was not
displaying on submit and the last chat was not showing in the
sidebar.

- Modified subscribeToSelectedConversation() to filter out
  unnecessary re-fetches from the database after a local update,
  preventing overwrites of the current conversation.
- Corrected TypeScript error TS2339 by casting conversationId to
  any within the filter operator to allow access to the _id
  property.
- Modified submitPrompt() to correctly handle new conversation
  initiation and postSubmit() to conditionally send new chat
  signals, preventing double conversation resets and ensuring
  correct chat display and sidebar updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chat: enter key does not send chat message

5 participants