-
Notifications
You must be signed in to change notification settings - Fork 417
Added AI Creativity Selection to Settings #1183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThis 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
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
Possibly related PRs
✨ Finishing Touches
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.
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
extractH1Headersfunction 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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-slideris 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
sliderVariantsprovide appropriate size options with logical height progression and proper default configuration.
23-37: LGTM: Track variants are properly sized.The
trackVariantsuse appropriate heights that are smaller than their container counterparts, ensuring proper visual hierarchy.
39-42: LGTM: Range variants are appropriately minimal.The
rangeVariantscorrectly omit size variants since the range inherits dimensions from its track container.
44-58: LGTM: Comprehensive thumb styling with accessibility features.The
thumbVariantsinclude proper focus states, accessibility features, and consistent sizing that maintains square proportions.
60-62: LGTM: Well-defined props interface.The
SliderPropsinterface 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
Slidercomponent 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_specificityfield with a default value of 3 is well thought out. The manualDefaultimplementation 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>tonumber | 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
No description provided.