Skip to content

Comments

Select persona examples in chat#451

Merged
elie222 merged 3 commits intomainfrom
examples
May 25, 2025
Merged

Select persona examples in chat#451
elie222 merged 3 commits intomainfrom
examples

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented May 25, 2025

Summary by CodeRabbit

  • New Features

    • Redesigned example prompt selection dialog to support a two-step process: first choose a persona, then select one or more example prompts to insert.
    • Added new personas, including "Realtor" and "Marketer", with curated example prompts.
  • Improvements

    • Example prompts are now organized by persona for easier navigation.
    • Multiple example prompts can be selected and inserted together.
    • Enhanced formatting and consistency for persona prompts.
    • Updated button text for improved clarity.
  • Bug Fixes

    • Textarea input height now automatically adjusts as you type.
  • Removals

    • Unused icons have been removed from the icon set.
  • Other

    • Updated app version to v1.1.17.

@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 25, 2025 9:18pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 25, 2025

Walkthrough

The changes restructure persona prompt definitions in examples.ts from multiline strings to arrays with a formatting helper, add new personas, and standardize prompt formatting. The examples dialog is refactored for multi-step persona and example selection with batch insertion. Minor UI text, icon, and input handling adjustments are made, and the version is incremented.

Changes

File(s) Change Summary
apps/web/app/(app)/[emailAccountId]/automation/examples.ts Refactored persona prompts to arrays with formatting helper; added/renamed personas; standardized prompt formatting.
apps/web/components/assistant-chat/examples-dialog.tsx Refactored dialog to support persona selection, multi-select examples, and batch insertion; updated UI/state logic.
apps/web/components/assistant-chat/chat.tsx Commented out the chatId prop for MultimodalInput.
apps/web/components/assistant-chat/icons.tsx Removed exported PencilEditIcon and ArrowUpIcon components.
apps/web/components/assistant-chat/multimodal-input.tsx Refactored textarea height adjustment to useEffect; cleaned up imports; updated icon import.
apps/web/components/assistant-chat/overview.tsx Changed button label from "Show more examples" to "Choose from examples".
version.txt Updated version from v1.1.16 to v1.1.17.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ExamplesDialog
  participant Personas
  participant UI

  User->>ExamplesDialog: Open dialog
  ExamplesDialog->>Personas: Display persona grid
  User->>ExamplesDialog: Select persona
  ExamplesDialog->>Personas: Fetch persona's prompt examples
  ExamplesDialog->>UI: Display example prompts for selected persona
  User->>ExamplesDialog: Select one or more examples
  User->>ExamplesDialog: Click "Add Selected"
  ExamplesDialog->>UI: Insert selected prompt(s) into input
Loading

Possibly related PRs

  • elie222/inbox-zero#443: Modifies examples.ts with new example chat prompts; related by file and domain.
  • elie222/inbox-zero#292: Introduces a PersonaDialog that uses personas from examples.ts; related by shared data source.

Poem

In a meadow of prompts, we hop and array,
Each persona now tidy, their words on display.
With dialogs that guide you from persona to rule,
And buttons that beckon, both clever and cool.
A version hops forward, v1.1.17—
The garden of features now pruned and serene!
🐇✨

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]/automation/examples.ts

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.

✨ 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: 3

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

125-127: Consider adding defensive checks for persona data structure.

While selectedPersona is validated by parseAsStringEnum, it's good practice to verify the persona object has the expected structure.

-                {personas[
-                  selectedPersona as keyof typeof personas
-                ].promptArray.map((example, index) => {
+                {(personas[
+                  selectedPersona as keyof typeof personas
+                ]?.promptArray || []).map((example, index) => {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 745a276 and 29ecc7a.

📒 Files selected for processing (7)
  • apps/web/app/(app)/[emailAccountId]/automation/examples.ts (2 hunks)
  • apps/web/components/ButtonListMultiSelect.tsx (1 hunks)
  • apps/web/components/assistant-chat/chat.tsx (1 hunks)
  • apps/web/components/assistant-chat/examples-dialog.tsx (2 hunks)
  • apps/web/components/assistant-chat/icons.tsx (0 hunks)
  • apps/web/components/assistant-chat/multimodal-input.tsx (4 hunks)
  • apps/web/components/assistant-chat/overview.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/web/components/assistant-chat/icons.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Static Code Analysis Js
  • GitHub Check: Jit Security
🔇 Additional comments (11)
apps/web/app/(app)/[emailAccountId]/automation/examples.ts (2)

20-22: LGTM! Well-designed formatting helper function.

The formatPromptArray function correctly formats prompt arrays into bullet-pointed strings with proper punctuation handling.


85-104:

Details

✅ Verification successful

Verify multiline string formatting in influencer persona.

The sponsorship inquiry prompt contains a multiline template with placeholders. Ensure the formatting preserves the structure correctly when processed by formatPromptArray.


🏁 Script executed:

#!/bin/bash
# Verify that multiline prompts are handled correctly in the formatted output
node -e "
const formatPromptArray = (promptArray) => \`\${promptArray.map((item) => \`* \${item}\`).join('.\n')}.\`;
const testArray = [\`Label sponsorship inquiries as \"Sponsorship\" and draft a reply as follows:
---
Hey NAME,

SENTENCE RELATED TO THEIR INQUIRY

I've attached my media kit and pricing.
---\`];
console.log('Formatted result:');
console.log(formatPromptArray(testArray));
"

Length of output: 588


Multiline template formatting is correct for influencer persona

The formatPromptArray function preserves the entire multiline string (including line breaks and delimiters) in influencer.promptArray as expected. No changes are needed.

apps/web/components/assistant-chat/overview.tsx (1)

47-47: Improved button label clarity.

The updated text "Choose from examples" better reflects the new multi-step persona and example selection workflow compared to the previous "Show more examples".

apps/web/components/assistant-chat/chat.tsx (1)

188-188:

Details

❓ Verification inconclusive

Verify that commenting out chatId doesn't break functionality.

The chatId prop is commented out, which aligns with the cleanup in multimodal-input.tsx. Ensure this doesn't break any existing functionality.


🏁 Script executed:

#!/bin/bash
# Check if chatId is still used elsewhere in the MultimodalInput component
rg -A 5 -B 5 "chatId.*MultimodalInput|MultimodalInput.*chatId" 

Length of output: 64


To be sure there are no hidden chatId usages, let’s search more broadly:


🏁 Script executed:

#!/bin/bash
# 1. Look for any mention of `chatId` in the assistant chat component
rg -n "chatId" apps/web/components/assistant-chat/chat.tsx

# 2. Check the multimodal-input component for `chatId` references
rg -n "chatId" apps/web/components/assistant-chat/multimodal-input.tsx

# 3. Search the entire codebase (TS/TSX) for any `chatId` usage
rg -n --glob="*.{ts,tsx}" "chatId"

Length of output: 4761


Ensure commented chatId props don’t break functionality

I see that chatId is still used by useQueryState, useChatMessages, ChatWithEmptySWR, and ChatUI, but a couple of its JSX props have been commented out. Please verify that the following no longer require chatId before removing or leaving them commented:

  • apps/web/components/assistant-chat/chat.tsx (line 188)
  • apps/web/components/assistant-chat/multimodal-input.tsx (lines 16, 27, 97)

Run through loading past messages, sending new messages, and any related navigation to confirm nothing regresses.

apps/web/components/assistant-chat/multimodal-input.tsx (3)

4-4: Good cleanup: Standardized imports.

Added useCallback to React imports and switched from local ArrowUpIcon to lucide-react for consistency.

Also applies to: 8-8


49-60: Improved height adjustment logic.

Converting adjustHeight to useCallback and adding a useEffect to trigger on input changes is a better approach than calling it directly in the input handler. This ensures height adjustment works regardless of how the input value changes (programmatically or user input).


92-92: Correct removal of redundant adjustHeight call.

Since height adjustment is now handled by the useEffect hook that responds to input changes, removing the direct call from handleInput is the right approach.

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

30-37: LGTM! Clean implementation of the multi-select logic.

The selection toggle logic is well-implemented, and the component provides good visual feedback with proper state management.

Also applies to: 48-62


41-41:

Details

✅ Verification successful

Verify if both name and label props are necessary for the Label component.

The same value is passed to both name and label props. This might be redundant unless the Label component specifically requires both for different purposes (e.g., name for form field identification and label for display text).


🏁 Script executed:

#!/bin/bash
# Description: Check the Label component's props interface to understand if both props are necessary

# Search for the Label component definition
ast-grep --pattern 'interface $_Props {
  $$$
  name$_
  $$$
  label$_
  $$$
}'

# Also search for the Label component implementation
rg -A 10 "export.*Label.*=|function Label"

Length of output: 15629


Label component requires distinct name and label props—no updates needed.

  • The name prop is used for the htmlFor attribute to link the label to its form control.
  • The label prop defines the visible text content.

Using the same string for both props is valid here.

apps/web/components/assistant-chat/examples-dialog.tsx (2)

77-80: Good use of query state for persona selection.

Using useQueryState with parseAsStringEnum provides URL persistence and type-safe validation against available personas.


104-179: Well-implemented multi-step selection flow with good UX.

The two-step persona and example selection flow is cleanly implemented with:

  • Clear navigation with back button
  • Dynamic dialog title
  • Good visual feedback for selected items
  • Proper state cleanup on navigation

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

♻️ Duplicate comments (3)
apps/web/app/(app)/[emailAccountId]/automation/examples.ts (3)

82-85: Excellent consistency improvement.

The founder persona now uses the getter pattern consistently with other personas. This addresses the previous review comment about inconsistent patterns.


148-151: Excellent consistency improvement.

The assistant persona now uses the getter pattern consistently. This addresses the previous review comment about inconsistent patterns.


297-300: Excellent consistency improvement.

The "other" persona now uses the getter pattern consistently and properly references the commonPrompts array. This addresses the previous review comment about inconsistent patterns.

🧹 Nitpick comments (3)
apps/web/app/(app)/[emailAccountId]/automation/examples.ts (3)

69-77: Watch for potential double periods in formatted output.

The founderPromptArray items don't end with periods, which is good for the formatting function. However, ensure consistency across all prompt arrays to avoid double periods when some items already have trailing periods.

Consider establishing a clear convention: either all prompt items should end without periods (letting the formatter add them), or the formatter should handle existing periods gracefully:

function formatPromptArray(promptArray: string[]): string {
-  return `${promptArray.map((item) => `* ${item}`).join(".\n")}.`;
+  return `${promptArray.map((item) => `* ${item.replace(/\.$/, '')}`).join(".\n")}.`;
}

90-97: Multi-line prompt may not format well with bullet points.

The sponsorship inquiry template spans multiple lines with specific formatting (template with --- delimiters). When processed by formatPromptArray, this will become a single bullet point, which may not render as intended.

Consider either:

  1. Moving complex templates to a separate property, or
  2. Adapting the formatter to handle multi-line content better:
function formatPromptArray(promptArray: string[]): string {
-  return `${promptArray.map((item) => `* ${item}`).join(".\n")}.`;
+  return `${promptArray.map((item) => {
+    if (item.includes('\n')) {
+      return `* ${item.split('\n').join('\n  ')}`;
+    }
+    return `* ${item}`;
+  }).join(".\n")}.`;
}

287-287: Consider aligning the key name with the label.

The persona key is still reachout but the label has been updated to "💬 Outreach". This inconsistency might cause confusion.

For consistency, consider updating the key to match:

- reachout: {
+ outreach: {
    label: "💬 Outreach",

Note: This would be a breaking change if other parts of the codebase reference the reachout key.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 29ecc7a and 13930a2.

📒 Files selected for processing (2)
  • apps/web/app/(app)/[emailAccountId]/automation/examples.ts (2 hunks)
  • version.txt (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • version.txt
🔇 Additional comments (3)
apps/web/app/(app)/[emailAccountId]/automation/examples.ts (3)

20-22: Good addition of the formatting helper function.

The formatPromptArray function provides a clean way to standardize prompt formatting across all personas. The logic correctly formats each prompt item as a bullet point.


107-123: Great addition of the realtor persona.

The realtor persona provides comprehensive coverage of real estate scenarios with appropriate automation rules. The prompts are well-structured and practical.


207-222: Great addition of the marketer persona.

The marketer persona covers key marketing scenarios effectively. The prompts are relevant and actionable for marketing automation.

@elie222 elie222 merged commit bc023c0 into main May 25, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request May 27, 2025
@elie222 elie222 deleted the examples 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