Skip to content

Comments

Persona onboarding for AI assistant#292

Merged
elie222 merged 6 commits intomainfrom
personas
Jan 6, 2025
Merged

Persona onboarding for AI assistant#292
elie222 merged 6 commits intomainfrom
personas

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Jan 6, 2025

Summary by CodeRabbit

  • New Features

    • Added a persona selection dialog for customizing email automation.
    • Introduced a new ButtonList component for improved user interface interactions.
    • Enhanced email automation rules with persona-specific prompts.
  • Improvements

    • Streamlined user experience in automation and onboarding flows.
    • Added more flexible prompt selection mechanism for email handling.
  • Changes

    • Removed AutomationOnboarding and ClientOnly from the main automation page.
    • Updated import sources for example prompts.

@vercel
Copy link

vercel bot commented Jan 6, 2025

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

Name Status Preview Updated (UTC)
inbox-zero ✅ Ready (Inspect) Visit Preview Jan 6, 2025 1:28pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2025

Warning

Rate limit exceeded

@elie222 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 39 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between e7635a1 and d8e2533.

📒 Files selected for processing (1)
  • apps/web/app/(app)/automation/RulesPrompt.tsx (5 hunks)

Walkthrough

This pull request introduces significant enhancements to the automation and onboarding functionalities within the web application. Key changes include the addition of a PersonaDialog for persona selection, a new ButtonList component for improved button rendering, and modifications to existing components to incorporate new callback parameters and state management. These updates enhance user interaction and streamline the overall structure of the automation features across multiple files.

Changes

File Change Summary
apps/web/app/(app)/automation/AutomationOnboarding.tsx Added onComplete callback parameter to function.
apps/web/app/(app)/automation/PersonaDialog.tsx New dialog component for persona selection.
apps/web/app/(app)/automation/ReportMistake.tsx Replaced individual buttons with ButtonList component.
apps/web/app/(app)/automation/RulesPrompt.tsx Added persona state, dynamic prompt generation, and persona selection dialog.
apps/web/app/(app)/automation/examples.ts Added commonPrompts, examplePrompts, and personas constants.
apps/web/app/(app)/automation/page.tsx Removed AutomationOnboarding and ClientOnly components.
apps/web/app/(app)/onboarding/OnboardingEmailAssistant.tsx Updated import for examplePrompts.
apps/web/components/ButtonList.tsx New reusable component for rendering lists of buttons.

Sequence Diagram

sequenceDiagram
    participant User
    participant RulesPrompt
    participant PersonaDialog
    participant ButtonList
    
    User->>RulesPrompt: Open Prompt Generation
    RulesPrompt->>PersonaDialog: Open Persona Selection
    User->>PersonaDialog: Select Persona
    PersonaDialog-->>RulesPrompt: Update Persona
    RulesPrompt->>ButtonList: Display Prompt Options
    User->>ButtonList: Select Prompt
    ButtonList-->>RulesPrompt: Generate Prompt
Loading

Possibly related PRs

Poem

🐰 A Rabbit's Ode to Automation's Grace

Personas dance, buttons align,
Prompts and dialogs now intertwine,
With ButtonList's magical might,
Our workflow takes a clever flight!
Automation's rabbit hops with glee! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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: 0

🧹 Nitpick comments (8)
apps/web/app/(app)/automation/PersonaDialog.tsx (1)

16-37: Good UX consideration with immediate persona selection closure.

Invoking onSelect(id) and setIsOpen(false) in quick succession provides a seamless user experience. Also, passing an empty emptyMessage string avoids clutter.

If you anticipate no personas available in the future, consider adding a more descriptive empty message or fallback to guide the user.

apps/web/components/ButtonList.tsx (1)

20-54: Effective use of grid layout for button rendering.

Dynamically switching grid layouts based on the columns prop is a nice implementation detail.

Consider robust fallback handling (e.g., default to 1 column when columns is outside known bounds) or a more flexible approach (e.g., a numeric class generation) if you plan to allow more column counts in the future.

apps/web/app/(app)/automation/RulesPrompt.tsx (1)

107-110: Reset logic for persona updates.

Using reset whenever personaPrompt changes nicely updates the form. This is a neat approach, though be mindful that it might override any user text if the user is typing while switching personas.

apps/web/app/(app)/automation/examples.ts (4)

1-8: Encapsulate repeated concepts in a shared resource.
These lines look good, but note that repeated instructions (e.g., labeling and archiving) also appear within other persona prompts. Consider centralizing any frequently repeated actions to improve maintainability.


12-30: Watch out for duplicating instructions.
The "Label receipts as \"Receipt\"" prompt appears twice (here and in commonPrompts). If this duplication is unintentional, consider removing or consolidating it. Otherwise, clarify its purpose to avoid confusion.


148-169: Potential overlap in instructions.
Some items in the recruiter persona (e.g., “recruiters” or “job interviews”) could conflict with instructions in commonPrompts. For clarity, confirm that you don’t need to unify or override them if they appear in both places.


196-203: Leverage commonPrompts effectively.
For the "reachout" and "other" personas, you might benefit by combining more shared instructions from commonPrompts to avoid scattering similar logic across multiple persona configurations.

apps/web/app/(app)/automation/ReportMistake.tsx (1)

361-368: Minor optimization consideration for the ButtonList items.
Filtering the rules array inline is straightforward, but if the rules array becomes large, consider memoizing the filtered array for performance.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d9b314c and 8db2ea9.

📒 Files selected for processing (8)
  • apps/web/app/(app)/automation/AutomationOnboarding.tsx (2 hunks)
  • apps/web/app/(app)/automation/PersonaDialog.tsx (1 hunks)
  • apps/web/app/(app)/automation/ReportMistake.tsx (3 hunks)
  • apps/web/app/(app)/automation/RulesPrompt.tsx (5 hunks)
  • apps/web/app/(app)/automation/examples.ts (1 hunks)
  • apps/web/app/(app)/automation/page.tsx (0 hunks)
  • apps/web/app/(app)/onboarding/OnboardingEmailAssistant.tsx (1 hunks)
  • apps/web/components/ButtonList.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/app/(app)/automation/page.tsx
✅ Files skipped from review due to trivial changes (1)
  • apps/web/app/(app)/onboarding/OnboardingEmailAssistant.tsx
🔇 Additional comments (19)
apps/web/app/(app)/automation/PersonaDialog.tsx (2)

1-6: Great use of imports and "use client" directive.

It’s good to see that the file declares "use client" at the top and imports necessary components. This ensures that the component renders properly on the client side without confusion.


7-15: Well-defined prop types.

The prop signatures (isOpen, setIsOpen, onSelect) are strongly typed and clear. This should help maintain clarity and correctness throughout the codebase.

apps/web/components/ButtonList.tsx (2)

6-9: Concise item definition.

Defining ButtonListItem with id and name keeps things simple and straightforward.


11-18: Flexible props for ButtonList.

Allowing an optional title, selectedId, columns, and an emptyMessage provides a versatile component for multiple use cases.

apps/web/app/(app)/automation/AutomationOnboarding.tsx (2)

15-19: Optional callback nicely introduced.

Adding onComplete to the function signature provides a clean extensibility point for any post-onboarding step.


48-54: Order of operations may warrant a review.

Invoking onComplete(); before onClose(); is fine if you intend the completion logic to run fully while the dialog is still visible. However, if onComplete triggers asynchronous side effects, ensure that closing the dialog immediately does not interrupt or overshadow the user feedback flow.

apps/web/app/(app)/automation/RulesPrompt.tsx (10)

3-3: Thoughtful addition of React hooks.

Your import of useEffect, useState, and useCallback indicates a well-structured approach to managing UI state and side effects in a growing component.


35-38: Nicely organized aggregator import statements.

Bundling examplePrompts and personas from examples.ts consolidates references in one place, optimizing code readability.


46-49: Modal logic is straightforward.

Managing the modal open state with useModal and a callback for toggling is clear. This simplifies controlling the PersonaDialog.


51-55: Persona state usage.

Storing persona in state and dynamically computing personaPrompt keeps data flow minimal and direct. The optional chaining of persona prompt helps prevent undefined errors.


58-67: Integrating persona selection with form.

Passing both rulesPrompt and personaPrompt to the RulesPromptForm covers the scenario where a user chooses a persona or manually enters prompts. This is user-friendly and well-structured.


68-71: Reusing the modal for persona selection.

Displaying PersonaDialog outside RulesPromptForm but still controlling its state from the same component is a good approach to keep concerns separated while sharing the state logically.


79-86: Extended signature for RulesPromptForm.

Introducing the personaPrompt and onOpenPersonaDialog props is consistent with the code changes. Nice addition to keep the form’s UI relevant to the persona flow.


102-102: Multiple form states are nicely tracked.

Combining isSubmitting & isGenerating with the react-hook-form state covers potential edge cases where user actions overlap. This ensures a robust user experience.


214-214: Clear example prompt content.

Providing realistic instructions about labeling emails and forwarding them is a user-friendly example. Encouraging the user to adapt or add more rules fosters a good onboarding experience.


275-278: Persona selection action is consistent.

Adding “Choose persona” with UserPenIcon is a small but effective UI element giving more context to the persona-based workflow.

apps/web/app/(app)/automation/examples.ts (1)

69-71: Verify reusing founderPrompt for assistant.
Here, the assistant persona references the founderPrompt. Ensure that this is desired—otherwise, consider providing a distinct prompt tailored to an assistant’s responsibilities.

apps/web/app/(app)/automation/ReportMistake.tsx (2)

17-17: New ButtonList import looks good.
No issues with importing ButtonList. This improves maintainability by reusing shared UI logic.


49-49: Imported action is consistent with usage.
The import of addGroupItemAction aligns with its usage in the GroupMismatch component.

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: 0

🧹 Nitpick comments (3)
apps/web/app/(app)/automation/RulesPrompt.tsx (1)

206-217: Contextual placeholder referencing "personas.other.prompt".
Incorporating an example referencing personas.other.prompt is a neat way to guide users. Consider providing more detail on how the placeholder will differ when an actual persona is chosen.

apps/web/app/(app)/automation/examples.ts (2)

12-30: Flexibility for general usage.
examplePrompts merges standard labeling with scenario-specific rules, providing a rich set of references. Keep an eye on overlap or redundancy to maintain clarity.


43-203: Comprehensive persona definitions.
Each persona includes highly detailed labeling and response instructions. This thorough structure is beneficial but may need occasional trimming or refactoring to avoid overly large prompts if more personas are added. Consider grouping repeated instructions or moving them into a shared base.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8db2ea9 and e7635a1.

📒 Files selected for processing (3)
  • apps/web/app/(app)/automation/RulesPrompt.tsx (5 hunks)
  • apps/web/app/(app)/automation/examples.ts (1 hunks)
  • apps/web/utils/ai/rule/generate-rules-prompt.ts (1 hunks)
🔇 Additional comments (11)
apps/web/utils/ai/rule/generate-rules-prompt.ts (1)

135-135: Consider verifying downstream usage of the <email> tag.
Changing <snippet> to <email> shifts the semantic meaning of this output. If other parts of the code rely on <snippet> for processing, this may cause unexpected behavior. Please ensure all references are updated accordingly.

apps/web/app/(app)/automation/RulesPrompt.tsx (8)

3-4: Imports look good, but confirm any unused dependencies.
The newly imported modules like UserPenIcon, AutomationOnboarding, PersonaDialog, and useModal are relevant to your new persona selection flow. Verify that each is actively used to avoid retaining dead code.

Also applies to: 35-38


46-50: Good approach for managing modal state.
Using a modal hook to manage isModalOpen and setIsModalOpen is straightforward and keeps the state localized. This pattern is clear and maintainable.


58-67: Good integration of personaPrompt into RulesPromptForm.
Connecting the persona-driven prompt to the data prop is well-structured. This encapsulation simplifies the form’s logic by centralizing persona updates in one place.


68-73: Persona dialog usage is clear.
Using PersonaDialog after the onboarding is a neat way to extend the user flow. Confirm that the UI transitions are intuitive and consider user feedback if adjustments are needed.


79-86: Extended form props provide useful flexibility.
The additional personaPrompt and onOpenPersonaDialog props give the form direct control over persona logic, which can simplify code organization and improve testability.


102-111: Resetting the form values on persona change.
This useEffect properly synchronizes the form state with the personaPrompt. Verify that re-entered text isn't inadvertently lost if the user changes persona mid-edit.


276-280: Clear CTA for persona selection.
This button effectively prompts users to choose a persona. The "UserPenIcon" aligns with a user profile concept. Confirm if tooltips or additional instructions would further clarify the persona feature’s benefits.


51-55: Ensure persona keys match the personas object.
Relying on personas[persona as keyof typeof personas]?.prompt could lead to undefined prompts if the key is invalid. Consider defensive checks or default fallbacks if persona is unrecognized.

+const personaPrompt = persona && persona in personas
+  ? personas[persona as keyof typeof personas]?.prompt
+  : undefined;
apps/web/app/(app)/automation/examples.ts (2)

1-10: Shared prompts are well-structured.
Defining commonPrompts and then converting them to a single string common is a clean approach for reuse.


32-41: Founder's persona prompt effectively extends common.
Combining the shared rules with founder-specific instructions is concise and modular. This makes it easy to maintain persona-specific expansions.

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