-
Notifications
You must be signed in to change notification settings - Fork 30
Feat/revert message chat #2132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/revert message chat #2132
Conversation
- Added editing capabilities to ChatMessages and MessageUser components, allowing users to edit their messages. - Introduced new props for handling edit actions: onStartEdit, onCancelEdit, and onSubmitEdit. - Updated ChatPanel and AssistantChatPanel to manage editing state and integrate message editing logic. - Enhanced useMessageActions hook to support batch message deletion when editing. - Improved user experience with appropriate UI changes during editing, including placeholders and button states.
- Replaced inline editing functionality with a new branching feature in ChatMessages and MessageUser components. - Updated props to handle branching actions, allowing users to create new conversation threads from existing messages. - Modified ChatPanel and AssistantChatPanel to manage branching state and integrate new branching logic. - Enhanced user experience with UI updates for branching actions, including original message previews and input handling.
🧪 BenchmarkShould we run the MCP Gateway benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Release OptionsShould a new version be published when this PR is merged? React with an emoji to vote on the release type:
Current version: Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 6 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/mesh/src/web/hooks/use-chat-store.ts">
<violation number="1" location="apps/mesh/src/web/hooks/use-chat-store.ts:298">
P1: Query key mismatch: predicate checks for `"threadMessages"` but `KEYS.threadMessages` returns `"thread-messages"`. This will prevent thread message cache invalidation after bulk deletion.</violation>
</file>
<file name="apps/mesh/src/web/components/chat/side-panel-chat.tsx">
<violation number="1" location="apps/mesh/src/web/components/chat/side-panel-chat.tsx:432">
P2: This `<span>` with `onClick` is not keyboard accessible. Add `role="button"`, `tabIndex={0}`, and an `onKeyDown` handler for Enter/Space keys to ensure keyboard users can dismiss the branch context.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| queryClient.invalidateQueries({ | ||
| predicate: (query) => | ||
| Array.isArray(query.queryKey) && | ||
| query.queryKey[0] === "threadMessages" && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Query key mismatch: predicate checks for "threadMessages" but KEYS.threadMessages returns "thread-messages". This will prevent thread message cache invalidation after bulk deletion.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/hooks/use-chat-store.ts, line 298:
<comment>Query key mismatch: predicate checks for `"threadMessages"` but `KEYS.threadMessages` returns `"thread-messages"`. This will prevent thread message cache invalidation after bulk deletion.</comment>
<file context>
@@ -278,10 +278,34 @@ export function useMessageActions() {
+ queryClient.invalidateQueries({
+ predicate: (query) =>
+ Array.isArray(query.queryKey) &&
+ query.queryKey[0] === "threadMessages" &&
+ query.queryKey[1] === locator,
+ });
</file context>
| query.queryKey[0] === "threadMessages" && | |
| query.queryKey[0] === "thread-messages" && |
✅ Addressed in 10a2fb1
| {branchContext.originalMessageText} | ||
| </div> | ||
| </div> | ||
| <span |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: This <span> with onClick is not keyboard accessible. Add role="button", tabIndex={0}, and an onKeyDown handler for Enter/Space keys to ensure keyboard users can dismiss the branch context.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/components/chat/side-panel-chat.tsx, line 432:
<comment>This `<span>` with `onClick` is not keyboard accessible. Add `role="button"`, `tabIndex={0}`, and an `onKeyDown` handler for Enter/Space keys to ensure keyboard users can dismiss the branch context.</comment>
<file context>
@@ -318,12 +402,46 @@ export function ChatPanel() {
+ {branchContext.originalMessageText}
+ </div>
+ </div>
+ <span
+ onClick={(e) => {
+ e.stopPropagation();
</file context>
✅ Addressed in 22d5358
- Removed inline message editing and integrated branching logic directly into the usePersistedChat hook. - Updated ChatPanel and AssistantChatPanel to utilize the new branchFromMessage method for creating threads from existing messages. - Simplified state management for input values and branch context, enhancing clarity and maintainability. - Improved user experience by ensuring consistent handling of branching actions across chat components.
…ching - Introduced ChatInputContext to manage input state and branching context across chat components. - Implemented BranchPreview and ChatInputField for better user experience during message editing. - Updated ChatPanel and AssistantChatPanel to utilize the new context, enhancing input handling and state management. - Streamlined input value management to prevent unnecessary re-renders, improving performance.
- Removed unnecessary branch context clearing in the chat input state management. - Updated icon imports in the MessageUser component, replacing CornerUpLeft with ReverseLeft for better visual consistency. - Enhanced button styling for improved user interaction feedback.
- Added keyboard accessibility to the BranchPreview component, allowing users to clear the branch context using the Enter and Space keys. - Updated the query key format in the useMessageActions hook from "threadMessages" to "thread-messages" for consistency and clarity.
…amline message handling.
…t components to improve code clarity.
…e resetting input value, improving reliability of message submission.
What is this contribution about?
Screenshots/Demonstration
https://www.loom.com/share/6f294db4798c4fd88b9cea23b380cd0e
Review Checklist
Summary by cubic
Add “Edit from here” branching in chat. Users can start a new thread from any user message and continue editing without changing the original conversation.
New Features
Refactors
Written for commit f40eff2. Summary will update on new commits.