Conversation
📝 WalkthroughWalkthroughThis change set introduces a major refactor and feature enhancement to the chat functionality in the application. Chat logic, queries, and active entity management are modularized into custom React hooks, with new types and utility functions added. The UI is updated to support chat groups and improved autonomy selection. Backend and plugin layers are extended to support chat message deletion, with related permission and documentation updates. Localization files are updated to reflect UI text changes. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ChatView
participant useActiveEntity
participant useChatQueries
participant useChatLogic
participant DBPlugin
User->>ChatView: Opens chat panel / navigates
ChatView->>useActiveEntity: Detect active entity from route
useActiveEntity->>ChatView: Update active entity, reset chat state
ChatView->>useChatQueries: Fetch chat groups/messages/session data
useChatQueries->>DBPlugin: Query chat groups/messages/session
User->>ChatView: Types message / selects quick action
ChatView->>useChatLogic: handleSubmit / handleQuickAction
useChatLogic->>DBPlugin: Append user message
useChatLogic->>DBPlugin: Stream AI response (assistant message)
useChatLogic->>ChatView: Update messages state
User->>ChatView: Selects chat group from dropdown
ChatView->>useChatQueries: Set current chat group, fetch messages
User->>ChatView: Triggers message deletion (future/implicit)
ChatView->>DBPlugin: delete_chat_messages(group_id)
DBPlugin->>DBPlugin: Remove messages from DB
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{js,ts,tsx,rs}⚙️ CodeRabbit Configuration File
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (5)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 6
🔭 Outside diff range comments (1)
apps/desktop/src/components/left-sidebar/top-area/finder-button.tsx (1)
31-37: Make the button screen-reader friendly.
<Button>currently lacks an accessible name; the SVG is decorative. Addaria-label(or a visually-hidden<span>), so assistive tech can announce the purpose.- <Button + <Button variant="ghost" size="icon" onClick={handleClickFinder} className="hover:bg-neutral-200" + aria-label="Open finder view" >
🧹 Nitpick comments (11)
apps/desktop/src/components/settings/views/ai.tsx (1)
896-900: Consider error handling for analytics tracking.The analytics event could fail silently if the analytics service is unavailable. While the coding guidelines specify no error handling, consider if failed analytics should affect the user experience.
analyticsCommands.event({ event: "autonomy_selected", distinct_id: userId, level: level, - }); + }).catch(() => { + // Analytics failure shouldn't block user interaction + });apps/desktop/src/components/right-panel/components/chat/floating-action-buttons.tsx (1)
35-66: LGTM! Solid dropdown implementation with room for minor improvement.The dropdown logic is well-implemented with proper conditional rendering and state management. The text truncation at 25 characters provides good UX.
Consider extracting the text truncation logic to a utility function for reusability:
const truncateText = (text: string, maxLength: number = 25) => text.length > maxLength ? text.substring(0, maxLength) + "..." : text; // Usage in component: {group.firstMessage ? truncateText(group.firstMessage) : `Chat Group ${index + 1}`}apps/desktop/src/components/right-panel/views/chat-view.tsx (3)
33-33: Consider movingprevIsGeneratingref insideuseChatQuerieshook.The
prevIsGeneratingref is only used by theuseChatQuerieshook. For better encapsulation and separation of concerns, consider creating this ref inside the hook rather than at the component level.
81-90: Remove unnecessaryasynckeyword.The
handleNewChatfunction is marked asasyncbut doesn't useawaitor return a promise.-const handleNewChat = async () => { +const handleNewChat = () => {
92-94: Remove unnecessaryasynckeyword.The
handleSelectChatGroupfunction doesn't perform any asynchronous operations.-const handleSelectChatGroup = async (groupId: string) => { +const handleSelectChatGroup = (groupId: string) => {apps/desktop/src/components/right-panel/hooks/useChatQueries.ts (3)
81-81: Remove debug console.log statement.Debug logging should be removed before merging to production.
-console.log("🔍 DEBUG: Loading messages for chat group =", currentChatGroupId);
60-71: Optimize useEffect dependencies.The dependency array includes
sessionIdwhich isn't used in the effect body, andsetCurrentChatGroupIdwhich is a stable setter function that doesn't need to be included.-}, [chatGroupsQuery.data, sessionId, setCurrentChatGroupId]); +}, [chatGroupsQuery.data]);
94-104: Consider simplifying the generation state tracking logic.The current implementation using a ref to track previous state works but is complex. Consider using a more straightforward approach in future iterations, such as a state machine or a dedicated hook for generation state management.
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (1)
107-107: Remove debug console.log statement.Debug logging should be removed before merging.
-console.log("systemContent", systemContent);apps/desktop/src/components/left-sidebar/top-area/finder-button.tsx (2)
7-7: Replace “what” comment with a concise “why”.The inline comment explains what the code does, which is already obvious from the code itself. Per the project’s coding guidelines, comments should focus on why something is done. Either remove the comment or re-phrase it to convey the rationale (e.g., “// Use inline SVG to avoid pulling the full lucide-react bundle”).
-// Custom SVG icon component to replace the folder icon +// Inline SVG avoids importing the entire lucide-react bundle
8-22: Expose ref & misc SVG props for better re-use.Forwarding the ref and spreading remaining props makes the icon usable anywhere a regular SVG is expected (e.g., inside
<Button asChild>wrappers or animated containers) without additional wrappers.-function CustomFinderIcon({ size = 16 }: { size?: number }) { - return ( - <svg - xmlns="http://www.w3.org/2000/svg" - viewBox="0 0 24 24" - fill="currentColor" - width={size} - height={size} - > +import * as React from "react"; + +type IconProps = React.SVGProps<SVGSVGElement> & { size?: number }; + +const CustomFinderIcon = React.forwardRef<SVGSVGElement, IconProps>( + ({ size = 16, ...rest }, ref) => ( + <svg + ref={ref} + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 24 24" + fill="currentColor" + width={size} + height={size} + aria-hidden="true" + {...rest} + > <path d="M21.001 3C21.5533 3 22.001 3.44772 22.001 4V20C22.001 20.5523 21.5533 21 21.001 21H3.00098C2.44869 21 2.00098 20.5523 2.00098 20V4C2.00098 3.44772 2.44869 3 3.00098 3H21.001ZM10.4817 4.99884L4.00098 5V19L12.747 18.9997C12.6851 18.6562 12.6308 18.3163 12.5844 17.98C12.2874 17.9933 12.0929 18 12.001 18C9.79308 18 7.60332 17.2701 5.44628 15.8321L6.55568 14.1679C8.39863 15.3966 10.2089 16 12.001 16C12.1337 16 12.2664 15.9967 12.3993 15.9901C12.3747 15.4926 12.3747 14.5797 12.4064 14H9.50098V13C9.50098 9.72527 9.82146 7.06094 10.4817 4.99884ZM12.601 4.99851C11.9358 6.58176 11.5567 9.41121 11.5119 12H14.6338L14.4933 13.124C14.3927 13.9288 14.3567 14.7687 14.3857 15.6439C15.3987 15.3449 16.4174 14.8539 17.4463 14.1679L18.5557 15.8321C17.2358 16.7119 15.9038 17.3267 14.5628 17.6714C14.62 18.1052 14.6937 18.5482 14.7819 18.999L20.001 19V5L12.601 4.99851ZM7.00098 7C7.55326 7 8.00098 7.44772 8.00098 8V9C8.00098 9.55228 7.55326 10 7.00098 10C6.44869 10 6.00098 9.55228 6.00098 9V8C6.00098 7.44772 6.44869 7 7.00098 7ZM17.001 7C17.5533 7 18.001 7.44772 18.001 8V9C18.001 9.55228 17.5533 10 17.001 10C16.4487 10 16.001 9.55228 16.001 9V8C16.001 7.44772 16.4487 7 17.001 7Z" /> </svg> - ); -} + ), +); + +CustomFinderIcon.displayName = "CustomFinderIcon";
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (24)
apps/desktop/src/components/left-sidebar/top-area/finder-button.tsx(2 hunks)apps/desktop/src/components/right-panel/components/chat/chat-input.tsx(1 hunks)apps/desktop/src/components/right-panel/components/chat/chat-message.tsx(1 hunks)apps/desktop/src/components/right-panel/components/chat/empty-chat-state.tsx(1 hunks)apps/desktop/src/components/right-panel/components/chat/floating-action-buttons.tsx(1 hunks)apps/desktop/src/components/right-panel/hooks/useActiveEntity.ts(1 hunks)apps/desktop/src/components/right-panel/hooks/useChatLogic.ts(1 hunks)apps/desktop/src/components/right-panel/hooks/useChatQueries.ts(1 hunks)apps/desktop/src/components/right-panel/types/chat-types.ts(1 hunks)apps/desktop/src/components/right-panel/utils/chat-utils.ts(1 hunks)apps/desktop/src/components/right-panel/views/chat-view.tsx(4 hunks)apps/desktop/src/components/settings/views/ai.tsx(5 hunks)apps/desktop/src/locales/en/messages.po(15 hunks)apps/desktop/src/locales/ko/messages.po(15 hunks)crates/db-user/src/chat_messages_ops.rs(1 hunks)crates/template/assets/ai_chat_system.jinja(1 hunks)plugins/db/build.rs(1 hunks)plugins/db/js/bindings.gen.ts(1 hunks)plugins/db/permissions/autogenerated/commands/delete_chat_messages.toml(1 hunks)plugins/db/permissions/autogenerated/reference.md(2 hunks)plugins/db/permissions/default.toml(1 hunks)plugins/db/permissions/schemas/schema.json(2 hunks)plugins/db/src/commands/chats.rs(1 hunks)plugins/db/src/lib.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}
⚙️ CodeRabbit Configuration File
**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
Files:
apps/desktop/src/components/right-panel/components/chat/chat-input.tsxapps/desktop/src/components/right-panel/components/chat/empty-chat-state.tsxapps/desktop/src/components/right-panel/components/chat/chat-message.tsxplugins/db/build.rscrates/db-user/src/chat_messages_ops.rsplugins/db/js/bindings.gen.tsapps/desktop/src/components/left-sidebar/top-area/finder-button.tsxplugins/db/src/lib.rsplugins/db/src/commands/chats.rsapps/desktop/src/components/right-panel/utils/chat-utils.tsapps/desktop/src/components/right-panel/types/chat-types.tsapps/desktop/src/components/right-panel/components/chat/floating-action-buttons.tsxapps/desktop/src/components/settings/views/ai.tsxapps/desktop/src/components/right-panel/hooks/useChatQueries.tsapps/desktop/src/components/right-panel/hooks/useActiveEntity.tsapps/desktop/src/components/right-panel/views/chat-view.tsxapps/desktop/src/components/right-panel/hooks/useChatLogic.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: ci
- GitHub Check: ci (macos, macos-latest)
- GitHub Check: ci (windows, windows-latest)
🔇 Additional comments (32)
apps/desktop/src/components/settings/views/ai.tsx (4)
10-11: LGTM: Clean analytics integration.The imports are appropriate for the new analytics functionality being added.
173-173: LGTM: UI text improvements for autonomy levels.The updated descriptions better emphasize "AI autonomy" levels and provide clearer guidance to users about what each level means.
Also applies to: 178-178, 182-184, 186-188
879-879: LGTM: Consistent UI labeling for autonomy.The form labels now consistently use "autonomy" terminology, aligning with the updated descriptions.
Also applies to: 882-882
201-201: No need to null-check userId from useHypr
useHypr()throws if it isn’t wrapped in aHyprProvider, and theHyprContexttype definesuserId: string. Once you calluseHypr(), you’re guaranteed a non-null context and a defineduserId, so no additional guard is needed before analytics calls.Likely an incorrect or invalid review comment.
apps/desktop/src/components/right-panel/utils/chat-utils.ts (1)
24-28: LGTM: Simple and effective focus utility.The focusInput function provides a clean abstraction for focusing textarea elements with proper null checking.
apps/desktop/src/components/right-panel/components/chat/chat-input.tsx (1)
9-9: LGTM: Improved import organization.Moving BadgeType import to a dedicated types module improves code organization and separation of concerns.
apps/desktop/src/components/right-panel/components/chat/empty-chat-state.tsx (1)
34-34: LGTM: Improved user-facing text.The heading change from "Chat with meeting notes" to "Chat with this meeting" provides clearer, more direct context for users.
plugins/db/permissions/default.toml (1)
49-49: LGTM: Appropriate permission addition.The new "allow-delete-chat-messages" permission follows established naming conventions and is correctly placed in the chat section.
plugins/db/build.rs (1)
47-47: LGTM!The new command is properly added to the chat section and follows the established naming convention.
plugins/db/permissions/autogenerated/commands/delete_chat_messages.toml (1)
1-14: LGTM!The permission configuration follows the standard pattern with both allow and deny permissions defined without pre-configured scope, which is appropriate for a parameterized command.
plugins/db/js/bindings.gen.ts (1)
118-120: LGTM!The generated function follows the established pattern and correctly maps to the backend command with appropriate parameter and return types.
crates/template/assets/ai_chat_system.jinja (1)
20-33: LGTM!The conditional template sections are well-structured and follow consistent patterns. The placement before the main content and proper spacing enhance readability.
plugins/db/src/lib.rs (1)
61-61: LGTM!The command registration is properly placed within the chats section and follows the established pattern for command collection.
crates/db-user/src/chat_messages_ops.rs (1)
58-69: LGTM - Well-implemented deletion methodThe
delete_chat_messagesfunction follows the established patterns in this file with proper async handling, parameterized queries for SQL injection prevention, and consistent error propagation. The use ofimpl Into<String>for the parameter type is consistent with other methods.plugins/db/permissions/autogenerated/reference.md (2)
45-45: Documentation correctly updated for new permissionThe addition of
allow-delete-chat-messagesto the default permissions list is properly placed and consistent with the permission structure.
117-138: Permission table entries properly formattedThe new permission table entries for both allow and deny variants of
delete-chat-messagesfollow the established documentation format and provide clear descriptions.plugins/db/src/commands/chats.rs (1)
79-97: Excellent implementation following established patternsThe
delete_chat_messagescommand function perfectly follows the established patterns in this file with proper Tauri annotations, consistent error handling, and appropriate state management. The implementation is secure and well-structured.apps/desktop/src/components/right-panel/components/chat/chat-message.tsx (2)
12-36: Good UI improvement for user message differentiationThe conditional rendering for user messages creates a more standard chat interface with proper right-alignment, styling, and timestamp display. The implementation follows React best practices and uses appropriate Tailwind CSS classes.
38-47: Clean simplified rendering for non-user messagesThe simplified rendering for non-user messages removes unnecessary complexity while maintaining functionality. The component structure is clean and maintainable.
plugins/db/permissions/schemas/schema.json (2)
321-332: Permission schema entries correctly definedThe new permission kinds for
allow-delete-chat-messagesanddeny-delete-chat-messagesare properly structured with appropriate descriptions and follow the established JSON schema pattern.
838-841: Default permission description properly updatedThe default permission set description correctly includes the new
allow-delete-chat-messagespermission in the comprehensive list, maintaining consistency with the actual permission grants.apps/desktop/src/locales/ko/messages.po (2)
357-390: LGTM! Source reference updates look correct.The line number updates for API-related messages properly reflect the refactored AI settings component structure.
380-382: LGTM! Chat message updates align with UI improvements.The removal of "Assistant:" and "User:" labels and updating "Chat with meeting notes" to "Chat with this meeting" improves the chat interface clarity.
Also applies to: 441-446, 1285-1287
apps/desktop/src/components/right-panel/components/chat/floating-action-buttons.tsx (2)
1-17: LGTM! Well-designed interface extension.The optional props for chat groups maintain backward compatibility while enabling the new dropdown functionality. Import additions are appropriate for the new UI components.
19-34: LGTM! Clean component structure and button repositioning.The local state management for dropdown control is appropriate, and repositioning the New Chat button to the left provides better UX flow.
apps/desktop/src/components/right-panel/types/chat-types.ts (2)
1-9: LGTM! Clean and well-structured type definitions.The
ActiveEntityInfointerface andBadgeTypeunion type are appropriately designed for the chat entity tracking functionality.
10-21: LGTM! Comprehensive ChatState interface design.The interface covers all necessary chat state properties including messages, UI flags, and current group tracking. The re-exports provide clean type organization.
apps/desktop/src/components/right-panel/hooks/useActiveEntity.ts (3)
1-28: LGTM! Well-structured hook interface and setup.The hook props interface clearly defines state setters, and the route matching setup appropriately covers all entity types. The sessionId derivation logic is sound.
29-62: LGTM! Robust entity change detection and state management.The effect properly detects entity changes and comprehensively resets chat state to prevent data leakage between different entities. The comparison logic is thorough.
63-81: LGTM! Complete dependency management and clean API.The dependency array properly includes all referenced values, and the return object provides a clean interface for consuming components.
apps/desktop/src/components/right-panel/views/chat-view.tsx (1)
20-180: Excellent refactoring to improve separation of concerns.The extraction of chat logic, queries, and active entity management into dedicated hooks significantly improves the component's maintainability and testability. The component now focuses purely on UI concerns while delegating business logic to specialized hooks.
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (1)
1-370: Well-structured hook with clear separation of concerns.The hook effectively encapsulates chat interaction logic and provides a clean interface. Once the code duplication is addressed, this will be an excellent example of extracting complex logic into a reusable hook.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (2)
58-66: Remove error handling to comply with coding guidelines.The try-catch block violates the coding guidelines that specify "No error handling" for TypeScript files.
Apply this diff to remove the error handling:
- try { - const html = await miscCommands.opinionatedMdToHtml(markdownContent); - - sessionStore.getState().updateEnhancedNote(html); - - console.log("Applied markdown content to enhanced note"); - } catch (error) { - console.error("Failed to apply markdown content:", error); - } + const html = await miscCommands.opinionatedMdToHtml(markdownContent); + + sessionStore.getState().updateEnhancedNote(html); + + console.log("Applied markdown content to enhanced note");
171-239: Remove error handling to comply with coding guidelines.The try-catch block violates the coding guidelines that specify "No error handling" for TypeScript files.
Apply this diff to remove the error handling:
- try { const provider = await modelProvider(); const model = provider.languageModel("defaultModel"); const aiMessageId = (Date.now() + 1).toString(); const aiMessage: Message = { id: aiMessageId, content: "Generating...", isUser: false, timestamp: new Date(), }; setMessages((prev) => [...prev, aiMessage]); const { textStream } = streamText({ model, messages: await prepareMessageHistory(messages, content), }); let aiResponse = ""; for await (const chunk of textStream) { aiResponse += chunk; const parts = parseMarkdownBlocks(aiResponse); setMessages((prev) => prev.map(msg => msg.id === aiMessageId ? { ...msg, content: aiResponse, parts: parts, } : msg ) ); } await dbCommands.upsertChatMessage({ id: aiMessageId, group_id: groupId, created_at: new Date().toISOString(), role: "Assistant", content: aiResponse.trim(), }); setIsGenerating(false); - } catch (error) { - console.error("AI error:", error); - - setIsGenerating(false); - - const errorMessageId = (Date.now() + 1).toString(); - const aiMessage: Message = { - id: errorMessageId, - content: "Sorry, I encountered an error. Please try again.", - isUser: false, - timestamp: new Date(), - }; - setMessages((prev) => [...prev, aiMessage]); - - await dbCommands.upsertChatMessage({ - id: errorMessageId, - group_id: groupId, - created_at: new Date().toISOString(), - role: "Assistant", - content: "Sorry, I encountered an error. Please try again.", - }); - }
🧹 Nitpick comments (2)
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (2)
107-107: Remove debug console.log statement.Debug console statements should be removed from production code.
- console.log("systemContent", systemContent);
63-63: Remove debug console.log statement.Debug console statements should be removed from production code.
- console.log("Applied markdown content to enhanced note");
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts(1 hunks)apps/desktop/src/components/settings/views/ai.tsx(5 hunks)apps/desktop/src/locales/en/messages.po(15 hunks)apps/desktop/src/locales/ko/messages.po(15 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/desktop/src/locales/en/messages.po
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/desktop/src/components/settings/views/ai.tsx
- apps/desktop/src/locales/ko/messages.po
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}
⚙️ CodeRabbit Configuration File
**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
Files:
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts
🧠 Learnings (1)
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (1)
Learnt from: plyght
PR: #921
File: plugins/location-connectivity/src/error.rs:1-41
Timestamp: 2025-06-06T16:31:46.457Z
Learning: In the location-connectivity plugin (plugins/location-connectivity/), comprehensive error handling via LocationConnectivityError is necessary despite the "no error handling" guideline, as the plugin performs system-level operations (WiFi detection, persistent storage) that require proper error propagation to the frontend.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: ci (windows, windows-latest)
- GitHub Check: ci (macos, macos-latest)
- GitHub Check: ci
🔇 Additional comments (2)
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (2)
1-12: All imports are properly used.The imports are correctly utilized throughout the hook implementation.
242-252: Clean refactoring eliminates previous code duplication.The functions now properly delegate to the shared
processUserMessagefunction, eliminating the code duplication that was flagged in previous reviews.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/db-user/src/sessions_ops.rs (1)
113-127: Consider using a single DELETE statement with subquery for better performance.The current implementation fetches all group IDs first, then deletes messages for each group individually. This could be optimized using a single DELETE statement with a subquery to reduce database round trips.
- let mut rows = conn - .query( - "SELECT id FROM chat_groups WHERE session_id = ?", - vec![session_id.clone()], - ) - .await?; - - while let Some(row) = rows.next().await? { - let group_id: String = row.get(0)?; - conn.execute( - "DELETE FROM chat_messages WHERE group_id = ?", - vec![group_id], - ) - .await?; - } + conn.execute( + "DELETE FROM chat_messages WHERE group_id IN (SELECT id FROM chat_groups WHERE session_id = ?)", + vec![session_id.clone()], + ) + .await?;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
crates/db-user/src/sessions_ops.rs(1 hunks)plugins/db/build.rs(1 hunks)plugins/db/js/bindings.gen.ts(1 hunks)plugins/db/permissions/autogenerated/reference.md(2 hunks)plugins/db/permissions/default.toml(1 hunks)plugins/db/permissions/schemas/schema.json(2 hunks)plugins/db/src/lib.rs(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- plugins/db/permissions/autogenerated/reference.md
🚧 Files skipped from review as they are similar to previous changes (5)
- plugins/db/permissions/default.toml
- plugins/db/build.rs
- plugins/db/src/lib.rs
- plugins/db/permissions/schemas/schema.json
- plugins/db/js/bindings.gen.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}
⚙️ CodeRabbit Configuration File
**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
Files:
crates/db-user/src/sessions_ops.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: ci
- GitHub Check: ci (windows, windows-latest)
- GitHub Check: ci (macos, macos-latest)
No description provided.