Skip to content

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jul 19, 2025

📝 Walkthrough

Walkthrough

This update introduces a configurable "creativity level" (specificity) for AI note enhancement, allowing users to control how strictly or creatively the AI processes meeting notes. It adds UI controls, configuration persistence, and template logic for this feature. The enhancement system now also extracts H1 headers from raw content for use in prompt generation when no template is selected.

Changes

File(s) Change Summary
apps/desktop/src/components/editor-area/index.tsx Added logic to extract H1 headers from raw HTML and conditionally use them in enhancement prompts; refactored grammar section extraction for metadata.
apps/desktop/src/components/settings/views/ai.tsx Added AI creativity level (specificity) configuration: schema, form, mutation, and UI controls for selecting and persisting the creativity level.
crates/db-user/src/config_types.rs Added ai_specificity field to ConfigAI struct; removed #[derive(Default)] and implemented a custom Default with ai_specificity defaulting to 3.
plugins/db/js/bindings.gen.ts Extended ConfigAI type to include optional `ai_specificity: number
crates/template/assets/enhance.system.jinja Updated template to use specificity for controlling header adherence and creativity; added guidelines and conditional example sections based on specificity.
crates/template/assets/enhance.user.jinja Added explicit instruction to ensure raw note content is included in the enhanced note.
packages/ui/package.json Added @radix-ui/react-slider dependency.
packages/ui/src/components/ui/slider.tsx Introduced a new Slider component based on Radix UI, supporting size variants and custom styling.
apps/desktop/src/locales/en/messages.po
apps/desktop/src/locales/ko/messages.po
Updated translation references and added new entries for "Creativity Level" and related descriptions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsUI
    participant DB
    participant Editor
    participant AIEnhanceSystem
    participant TemplateEngine

    User->>SettingsUI: Selects Creativity Level (1-4)
    SettingsUI->>DB: Save ai_specificity config
    DB-->>SettingsUI: Confirm save

    User->>Editor: Triggers Enhance
    Editor->>DB: Fetch ai_specificity config
    DB-->>Editor: Return ai_specificity (default 3 if unset)
    Editor->>Editor: Extract H1 headers from raw content
    Editor->>AIEnhanceSystem: Prepare enhancement prompt
    AIEnhanceSystem->>TemplateEngine: Render system prompt with specificity and headers/template
    TemplateEngine-->>AIEnhanceSystem: Rendered prompt
    AIEnhanceSystem-->>Editor: Enhanced note
Loading

Possibly related PRs

  • fastrepl/hyprnote#1050: Also modifies useEnhanceMutation to incorporate template info and grammar, directly related to changes in prompt generation.
  • fastrepl/hyprnote#972: Updates useEnhanceMutation to handle a preMeetingNote parameter, related as both PRs extend enhancement input handling.
  • fastrepl/hyprnote#935: Adds and integrates useGenerateTitleMutation with useEnhanceMutation; both PRs modify the same core enhancement logic.
✨ 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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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.

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

@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 (2)
apps/desktop/src/locales/ko/messages.po (1)

495-498: New localization entries need translation.

The new entries for "Creativity Level" and its description have been properly added but need Korean translations to complete the localization.

Also applies to: 520-523

apps/desktop/src/components/editor-area/index.tsx (1)

261-281: Optimize regex usage for better performance.

The extractH1Headers function recreates the regex pattern on each execution. Consider moving the regex outside the function for better performance.

+const H1_REGEX = /<h1[^>]*>(.*?)<\/h1>/gi;
+
 const extractH1Headers = useCallback((htmlContent: string): string[] => {
   if (!htmlContent) {
     return [];
   }

-  const h1Regex = /<h1[^>]*>(.*?)<\/h1>/gi;
   const headers: string[] = [];
   let match;

-  while ((match = h1Regex.exec(htmlContent)) !== null) {
+  H1_REGEX.lastIndex = 0; // Reset regex state
+  while ((match = H1_REGEX.exec(htmlContent)) !== null) {
     const headerText = match[1].replace(/<[^>]*>/g, "").trim();
     if (headerText) {
       headers.push(headerText);
     }
   }

   return headers;
 }, []);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 692516d and 3ea6584.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • apps/desktop/src/components/editor-area/index.tsx (3 hunks)
  • apps/desktop/src/components/settings/views/ai.tsx (4 hunks)
  • apps/desktop/src/locales/en/messages.po (11 hunks)
  • apps/desktop/src/locales/ko/messages.po (11 hunks)
  • crates/db-user/src/config_types.rs (1 hunks)
  • crates/template/assets/enhance.system.jinja (4 hunks)
  • crates/template/assets/enhance.user.jinja (1 hunks)
  • packages/ui/package.json (1 hunks)
  • packages/ui/src/components/ui/slider.tsx (1 hunks)
  • plugins/db/js/bindings.gen.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

Instructions used from:

Sources:
⚙️ CodeRabbit Configuration File

🔇 Additional comments (22)
packages/ui/package.json (1)

33-33: LGTM: Dependency addition follows existing patterns.

The addition of @radix-ui/react-slider is consistent with other Radix UI dependencies and supports the new Slider component implementation.

packages/ui/src/components/ui/slider.tsx (7)

1-5: LGTM: All imports are properly used.

Import statements are clean with no unused imports, adhering to coding guidelines.


7-21: LGTM: Well-structured variant definitions.

The sliderVariants provide appropriate size options with logical height progression and proper default configuration.


23-37: LGTM: Track variants are properly sized.

The trackVariants use appropriate heights that are smaller than their container counterparts, ensuring proper visual hierarchy.


39-42: LGTM: Range variants are appropriately minimal.

The rangeVariants correctly omit size variants since the range inherits dimensions from its track container.


44-58: LGTM: Comprehensive thumb styling with accessibility features.

The thumbVariants include proper focus states, accessibility features, and consistent sizing that maintains square proportions.


60-62: LGTM: Well-defined props interface.

The SliderProps interface properly combines Radix component props with variant props, using appropriate TypeScript patterns for forwardRef components.


64-81: LGTM: Clean component implementation following React patterns.

The Slider component properly implements forwardRef, correctly applies variant styling, and maintains appropriate component structure with proper exports.

crates/db-user/src/config_types.rs (1)

87-99: Well-implemented AI specificity configuration.

The addition of the ai_specificity field with a default value of 3 is well thought out. The manual Default implementation is necessary and correctly structured.

plugins/db/js/bindings.gen.ts (1)

153-153: Correct type binding for AI specificity.

The generated TypeScript binding properly maps the Rust Option<u8> to number | null, maintaining type safety across the language boundary.

crates/template/assets/enhance.user.jinja (1)

18-20: Good clarification for content incorporation.

The explicit instruction to incorporate raw_note content reinforces an important requirement and helps ensure the AI enhancement properly includes user input.

apps/desktop/src/locales/en/messages.po (1)

495-498: Complete English localization for creativity feature.

The English translations for the new AI creativity level feature are clear and descriptive, properly supporting the new UI elements.

Also applies to: 520-523

apps/desktop/src/components/editor-area/index.tsx (2)

340-354: LGTM! Clean conditional logic for H1 headers.

The logic correctly determines when to use extracted H1 headers versus template information, and the variable extraction is well-structured.


407-407: Good optimization extracting grammar sections once.

This change eliminates the inline mapping and reuses the extracted sections, improving performance.

crates/template/assets/enhance.system.jinja (4)

3-3: LGTM! Proper default value handling for specificity.

The template correctly sets a default value of 3 for the specificity configuration, ensuring backward compatibility.


5-39: Well-structured adherence level logic.

The conditional logic for different specificity levels (1-4) is clear and provides appropriate guidance for each creativity level. The structure makes it easy to understand the different modes.


84-108: Comprehensive creativity level guidelines.

The creativity level guidelines provide clear, actionable instructions for each specificity level, from minimal changes (level 1) to extensive enhancement (level 4).


117-169: Smart conditional example display.

Only showing examples for specificity levels 3 and 4 makes sense, as these are the levels where users would benefit most from detailed guidance on the expected output format.

apps/desktop/src/components/settings/views/ai.tsx (4)

11-11: LGTM! Necessary import for database commands.

The import is correctly added and used throughout the component for configuration management.


126-152: Well-designed schema and level definitions.

The Zod schema properly validates the integer range (1-4), and the specificity levels mapping provides clear titles and descriptions for each creativity level.


275-316: Robust configuration management implementation.

The React Query setup for config fetching, form handling with proper defaults, and mutation logic with query invalidation is well-implemented and follows best practices.


759-813: Excellent UI implementation with proper accessibility.

The creativity level selection UI is well-designed with:

  • Proper form integration
  • Visual feedback for selected state
  • Disability handling when custom endpoint is not enabled
  • Clear descriptions for each level
  • Good color contrast and accessibility features

@duckduckhero duckduckhero merged commit 124edb4 into main Jul 19, 2025
8 checks passed
This was referenced Aug 18, 2025
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.

2 participants