Skip to content

Release assistant. Switch between document and chat mode#452

Merged
elie222 merged 4 commits intomainfrom
document-chat-mode
May 26, 2025
Merged

Release assistant. Switch between document and chat mode#452
elie222 merged 4 commits intomainfrom
document-chat-mode

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented May 25, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a toggle to switch between "chat" and "document" modes in the chat interface.
    • Added a new document mode that displays a simplified prompt form with persona selection and loading/error handling.
  • Refactor

    • Simplified the rules prompt form layout by removing card, grid, and scroll components, as well as example prompts.
    • Streamlined the chat UI to conditionally display chat or document mode based on user selection.
  • Bug Fixes & Improvements

    • Updated navigation paths throughout the app to consistently use the "/assistant" prefix instead of "/automation".
    • Added an alert banner promoting the new AI Assistant experience on the Automation page.
    • Enhanced chat widget visibility logic to hide it on assistant-related pages.
    • Updated links and redirects to improve user routing to the assistant features.
  • Chores

    • Bumped application version to v1.2.0.

@vercel
Copy link

vercel bot commented May 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
inbox-zero ✅ Ready (Inspect) Visit Preview May 26, 2025 7:38am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 25, 2025

Walkthrough

The changes refactor the RulesPrompt component by simplifying its UI, removing card and scroll wrappers, and eliminating the example prompts section. A new PromptFile component is introduced to handle prompt data fetching, persona dialog management, and error/loading states. The chat interface is updated to support a toggle between "chat" and "document" modes, conditionally rendering either the chat UI or the new PromptFile UI. Additionally, multiple navigation paths across the app are updated from /automation to /assistant to reflect a shift in routing context.

Changes

File(s) Change Summary
apps/web/app/(app)/[emailAccountId]/automation/RulesPrompt.tsx Refactored RulesPrompt to simplify UI, removed card/scroll/example prompts, added new PromptFile component
apps/web/components/assistant-chat/chat.tsx Refactored ChatUI to support "chat"/"document" modes, added toggle, integrated PromptFile, updated imports
Multiple app files (e.g., onboarding, automation, assistant pages, RuleForm, Rules, etc.) Updated navigation paths from /automation to /assistant across routing, links, redirects, and revalidation
apps/web/components/CrispChat.tsx, NavBottom.tsx, SideNav.tsx Updated navigation link paths from /automation to /assistant
apps/web/app/(app)/[emailAccountId]/automation/page.tsx Added alert banner promoting AI Assistant, updated onboarding redirect path from /automation to /assistant
apps/web/utils/actions/rule.ts Changed revalidation paths from /automation to /assistant
apps/web/utils/ai/assistant/process-user-request.ts Updated system prompt URL from /automation?tab=rules to /assistant?tab=rules
packages/resend/emails/summary.tsx Changed "View Pending" button URL from /automation to /assistant
apps/web/next.config.ts Changed root redirect from /automation to /assistant
apps/web/app/api/v1/openapi/route.ts Updated parameter description URL from /automation?tab=groups to /assistant?tab=groups
apps/web/components/email-list/EmailList.tsx Updated alert link and text from /automation to /assistant

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChatUI
    participant SWRProvider
    participant PromptFile

    User->>ChatUI: Toggle mode (chat/document)
    alt Chat Mode
        ChatUI->>ChatUI: Render chat interface with message list and input
    else Document Mode
        ChatUI->>SWRProvider: Provide data context
        SWRProvider->>PromptFile: Render prompt UI with persona dialog
        PromptFile->>PromptFile: Fetch prompt data, manage persona dialog state
    end
Loading

Possibly related PRs

Poem

In the warren of code, we hop and delight,
Cards and scrolls gone, the UI feels light.
With prompts and personas, new dialogs appear,
Toggle your mode—chat or document’s near!
A rabbit’s quick click, a fresh interface cheer!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/app/(app)/[emailAccountId]/assistant/onboarding/CategoriesSetup.tsx

Oops! Something went wrong! :(

ESLint: 9.24.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

apps/web/app/(app)/[emailAccountId]/assistant/onboarding/completed/page.tsx

Oops! Something went wrong! :(

ESLint: 9.24.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

apps/web/app/(app)/[emailAccountId]/assistant/onboarding/draft-replies/page.tsx

Oops! Something went wrong! :(

ESLint: 9.24.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

  • 18 others

📜 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 44886aa and 2f54fa9.

📒 Files selected for processing (22)
  • apps/web/app/(app)/[emailAccountId]/assistant/onboarding/CategoriesSetup.tsx (2 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/onboarding/completed/page.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/onboarding/draft-replies/page.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/page.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/AssistantTabs.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/ProcessingPromptFileDialog.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/RuleForm.tsx (3 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/Rules.tsx (2 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/RulesPrompt.tsx (4 hunks)
  • apps/web/app/(app)/[emailAccountId]/automation/page.tsx (4 hunks)
  • apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/common.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/setup/page.tsx (2 hunks)
  • apps/web/app/api/v1/openapi/route.ts (1 hunks)
  • apps/web/components/CrispChat.tsx (1 hunks)
  • apps/web/components/NavBottom.tsx (1 hunks)
  • apps/web/components/SideNav.tsx (2 hunks)
  • apps/web/components/email-list/EmailList.tsx (1 hunks)
  • apps/web/next.config.ts (1 hunks)
  • apps/web/utils/actions/rule.ts (4 hunks)
  • apps/web/utils/ai/assistant/process-user-request.ts (1 hunks)
  • packages/resend/emails/summary.tsx (1 hunks)
  • version.txt (1 hunks)
✅ Files skipped from review due to trivial changes (17)
  • apps/web/components/NavBottom.tsx
  • apps/web/next.config.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/onboarding/draft-replies/page.tsx
  • version.txt
  • apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/common.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/onboarding/completed/page.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/AssistantTabs.tsx
  • apps/web/utils/ai/assistant/process-user-request.ts
  • apps/web/app/(app)/[emailAccountId]/setup/page.tsx
  • apps/web/app/api/v1/openapi/route.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/onboarding/CategoriesSetup.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/RuleForm.tsx
  • apps/web/components/SideNav.tsx
  • apps/web/utils/actions/rule.ts
  • apps/web/components/email-list/EmailList.tsx
  • packages/resend/emails/summary.tsx
  • apps/web/app/(app)/[emailAccountId]/automation/Rules.tsx
🧰 Additional context used
🧬 Code Graph Analysis (2)
apps/web/app/(app)/[emailAccountId]/assistant/page.tsx (1)
apps/web/utils/path.ts (1)
  • prefixPath (1-4)
apps/web/app/(app)/[emailAccountId]/automation/ProcessingPromptFileDialog.tsx (1)
apps/web/utils/path.ts (1)
  • prefixPath (1-4)
🔇 Additional comments (9)
apps/web/components/CrispChat.tsx (1)

30-34: LGTM! Consistent with the migration pattern.

The addition of /assistant to the Crisp chat visibility logic maintains consistency with the existing pattern and aligns with the broader URL migration from /automation to /assistant throughout the codebase.

apps/web/app/(app)/[emailAccountId]/assistant/page.tsx (1)

32-32:

Details

❓ Verification inconclusive

Verify URL consistency for onboarding flows.

There's an inconsistency in onboarding redirect patterns across the codebase. This file redirects to /assistant?onboarding=true (query parameter), while apps/web/app/(app)/[emailAccountId]/automation/page.tsx redirects to /assistant/onboarding (nested path).

Please verify which URL structure is intended for the onboarding flow to ensure consistent routing behavior.


🏁 Script executed:

#!/bin/bash
# Search for onboarding-related routes and redirects to check consistency
echo "=== Searching for onboarding routes and redirects ==="
rg -A 2 -B 2 "onboarding" --type tsx --type ts | grep -E "(redirect|href|pathname)" 

echo -e "\n=== Searching for assistant onboarding paths ==="
rg "/assistant.*onboarding|onboarding.*assistant" --type tsx --type ts

Length of output: 442


I've updated the search to use glob patterns instead of unsupported --type flags. This should surface all onboarding redirects and links in .ts/.tsx files:


🏁 Script executed:

#!/bin/bash
echo "=== Find onboarding redirects in TSX/TS files ==="
rg -n "redirect.*onboarding" -g "*.ts" -g "*.tsx" || echo "No redirect patterns with onboarding found."

echo -e "\n=== Find hrefs linking to onboarding ==="
rg -n "href=.*onboarding" -g "*.ts" -g "*.tsx" || echo "No href patterns with onboarding found."

echo -e "\n=== Find pathname usages for onboarding ==="
rg -n "pathname.*onboarding" -g "*.ts" -g "*.tsx" || echo "No pathname patterns with onboarding found."

Length of output: 1993


Verify and unify assistant onboarding URL patterns.

We’ve detected two different approaches for the assistant onboarding redirect:

  • Nested path pattern (/assistant/onboarding):
    • apps/web/app/(app)/[emailAccountId]/automation/page.tsx (line 44)
    • apps/web/app/(app)/[emailAccountId]/automation/Rules.tsx (line 405)
    • apps/web/app/(app)/[emailAccountId]/setup/page.tsx (line 290)

  • Query-parameter pattern (/assistant?onboarding=true):
    • apps/web/app/(app)/[emailAccountId]/assistant/page.tsx (line 32)

Please confirm which URL structure is intended for the assistant onboarding flow and update all related redirects and links to use the chosen format for consistent routing behavior.

apps/web/app/(app)/[emailAccountId]/automation/ProcessingPromptFileDialog.tsx (1)

274-274: LGTM! Consistent URL migration.

The change correctly updates the link destination from /automation?tab=test to /assistant?tab=test, maintaining the same functionality while directing users to the new assistant interface. The prefixPath utility is used appropriately.

apps/web/app/(app)/[emailAccountId]/automation/page.tsx (3)

4-5: LGTM! Appropriate imports for the alert functionality.

The new imports are correctly added to support the alert banner functionality.

Also applies to: 20-21


44-44: URL inconsistency detected.

This redirect uses /assistant/onboarding (nested path), but apps/web/app/(app)/[emailAccountId]/assistant/page.tsx line 32 uses /assistant?onboarding=true (query parameter). This inconsistency could lead to different onboarding flows.

Please verify which URL structure is intended for consistency across the application.


58-72: Excellent migration UX strategy!

The alert banner implementation effectively guides users from the legacy automation interface to the new AI Assistant experience. The blue variant with sparkles icon creates good visual appeal, and the messaging clearly explains the benefit of switching.

This approach allows for a gradual migration while maintaining the legacy interface for users who need it.

apps/web/app/(app)/[emailAccountId]/automation/RulesPrompt.tsx (3)

25-25: LGTM: Clean import additions.

The new imports for personas and Label are appropriately added and used in the updated components.

Also applies to: 32-32


151-151: LGTM: Navigation path correctly updated.

The routing change from /automation?tab=test to /assistant?tab=test aligns perfectly with the PR objectives for switching to assistant mode.


205-312: LGTM: Form simplification preserves functionality.

The RulesPromptForm has been successfully flattened by removing card wrappers and complex UI structure while maintaining all core functionality including form validation, submission logic, and user interactions.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/web/components/assistant-chat/chat.tsx (1)

233-233: Remove commented-out code.

Clean up the commented-out props to improve code readability.

           <MultimodalInput
-            // chatId={chatId}
             input={input}
             setInput={setInput}
             handleSubmit={handleSubmit}
             status={status}
             stop={stop}
-            // attachments={attachments}
-            // setAttachments={setAttachments}
-            // messages={messages}
             setMessages={setMessages}
-            // append={append}
           />

Also applies to: 239-241

apps/web/app/(app)/[emailAccountId]/automation/RulesPrompt.tsx (1)

34-79: Clarify the architectural purpose of two similar components.

Both RulesPrompt and PromptFile components serve similar purposes with minor UI differences. The architectural reasoning for maintaining two separate components is unclear.

Consider either:

  1. Consolidating into a single component with a prop to control UI variations
  2. Adding clear documentation explaining when to use each component

Also applies to: 314-354

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bc023c0 and 44886aa.

📒 Files selected for processing (2)
  • apps/web/app/(app)/[emailAccountId]/automation/RulesPrompt.tsx (3 hunks)
  • apps/web/components/assistant-chat/chat.tsx (5 hunks)
🔇 Additional comments (8)
apps/web/components/assistant-chat/chat.tsx (5)

9-15: LGTM! Import additions are appropriate.

The new imports for icons and the PromptFile/RulesPrompt components are correctly added to support the new document mode functionality.

Also applies to: 40-43


150-150: Good cleanup - removed unused prop.

Removing the unused chatId prop from the ChatUI component improves code clarity.


162-164: Clean mode state management.

Using useQueryState for the mode allows URL persistence, and the isDocumentMode boolean simplifies conditional rendering throughout the component.


170-199: Well-implemented mode toggle with good accessibility.

The toggle buttons have proper tooltips, screen reader labels, and the MAX_MESSAGES warning is appropriately shown only in chat mode.


202-210: Appropriate conditional rendering of chat controls.

Chat-specific controls (new chat, examples, history) are correctly hidden in document mode.

apps/web/app/(app)/[emailAccountId]/automation/RulesPrompt.tsx (3)

25-25: Import changes look good.

The import reorganization and addition of the Label component are appropriate for the refactored UI.

Also applies to: 32-32


205-212: Dialog placement updated for flattened UI structure.

The ProcessingPromptFileDialog is appropriately moved to align with the simplified component structure.


223-309: UI simplification improves clarity.

The removal of card wrappers and grid layout creates a cleaner, more maintainable structure while preserving all functionality.

@elie222 elie222 changed the title switch between document and chat mode Release assistant. Switch between document and chat mode May 26, 2025
@elie222 elie222 merged commit 77bd3ba into main May 26, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 18, 2025
@elie222 elie222 deleted the document-chat-mode branch December 18, 2025 23:01
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.

1 participant

Comments