Skip to content

Conversation

@cmdparkour
Copy link
Contributor

@cmdparkour cmdparkour commented Jul 13, 2025

Pull Request Description

Is your feature request related to a problem? Please describe.
fixed the issue: #577
when message.content.content is already exists, can't use message.content.text, you can find the preview mode in line 46-55, the other developer don't care the case when we in edit mode.

Describe the solution you'd like

  1. cate the case with edit mode to fixed the bug.
  2. add the enter and esc keyword listener to make edit mode smoother.
  3. change the min width about the textarea. Reason: sometimes, the textarea is smaller than we want, beause the width is using with the preview text width, but the preview text width maybe too small.

UI/UX changes for Desktop Application
add the min width about the textarea, it has a min width now, and you can change the width which you design, i only do it with 40vw.

Platform Compatibility Notes
nothing to change.
i worked in windows.

Additional context
fixed the issue: #577

Summary by CodeRabbit

  • Bug Fixes
    • Improved edit mode to correctly handle messages with structured content, ensuring edits apply to the appropriate text block.
  • New Features
    • Added keyboard shortcuts in edit mode: press Enter to save edits and Escape to cancel.
  • Style
    • Enhanced the editing UI by updating the textarea to have a minimum width and full width for better usability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 13, 2025

Walkthrough

The message editing logic in the user message component was updated to properly handle structured content formats, allowing edits to target specific text blocks within a message. The editing UI was improved with a wider textarea and new keyboard shortcuts for saving or canceling edits. Unused state management was cleaned up.

Changes

File(s) Change Summary
src/renderer/src/components/message/MessageItemUser.vue Enhanced edit mode logic to support structured content, improved textarea UI, added keyboard shortcuts, and removed unused state.

Poem

A rabbit hopped through fields of code,
Fixing edits in message mode.
Now structured blocks can be revised,
With wider boxes, neatly sized.
Press Enter to save, Escape to flee—
Editing’s smooth as it can be!
🐇💬✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 28b576c and 06a127a.

📒 Files selected for processing (1)
  • src/renderer/src/components/message/MessageItemUser.vue (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/renderer/src/**/*

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/i18n.mdc
src/renderer/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
🧠 Learnings (2)
📓 Common learnings
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both `text` and `content` properties in the `handleMeetingInstruction` function's `sendMessage` call, even though they are redundant, rather than removing the `content` property.
src/renderer/src/components/message/MessageItemUser.vue (3)
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both `text` and `content` properties in the `handleMeetingInstruction` function's `sendMessage` call, even though they are redundant, rather than removing the `content` property.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
🔇 Additional comments (3)
src/renderer/src/components/message/MessageItemUser.vue (3)

34-44: UI improvements look good with proper responsive design.

The addition of min-w-[40vw] and w-full classes addresses the PR objective of setting a minimum width for the textarea. The keyboard event handlers for Enter and Escape keys enhance the user experience by providing expected shortcuts.


142-150: Excellent fix for structured content handling.

The enhanced logic properly handles the case where message.content.content exists by looking for the first text block. The fallback to props.message.content.text ensures backward compatibility with plain text messages.


157-166: Verify logic for multiple text blocks in structured content

The save routine correctly mirrors the edit logic by updating the first text block:

const row = newContent?.content?.find(block => block.type === 'text')
if (row) {
  row.content = editedText.value
} else {
  newContent.text = editedText.value
}

However, if a message’s structured content can include more than one text block (for example, multiple paragraphs), this will only update the first instance. I wasn’t able to find any existing examples of multi-block content in the codebase—please confirm whether messages may ever contain multiple text blocks. If they can, consider one of the following:

  • Update all text blocks (e.g. iterate or use .map on newContent.content)
  • Flatten into a single text block, replacing the entire content array with one block containing editedText.value

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@zerob13 zerob13 merged commit 8cb9b6d into ThinkInAIXYZ:dev Jul 13, 2025
2 checks passed
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.

2 participants