-
Notifications
You must be signed in to change notification settings - Fork 376
works on adding user context #1369
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
base: main
Are you sure you want to change the base?
Conversation
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds a new "User Context" settings tab and view (persisted in the Tauri store), surfaces that value into the editor enhance flow by passing Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant S as Settings View
participant T as Tauri Store
Note over S: Mount / Load
S->>T: load("store.json") / get("user_context")
T-->>S: { value } or null
U->>S: Edit textarea + Click Save
S->>T: set("user_context", { value }) + save()
T-->>S: success / error
S-->>U: show toast (saved / error)
sequenceDiagram
autonumber
participant E as Editor Enhance Flow
participant T as Tauri Store
participant TMP as enhance.system Template
Note over E: Prepare system prompt
E->>T: load("store.json") / get("user_context")
T-->>E: { value } or null
E->>TMP: render({ userContext: <string|null>, ... })
TMP-->>E: rendered system prompt
Note over E: Continue existing enhance pipeline
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, 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: 1
🧹 Nitpick comments (5)
.vscode/settings.json (1)
24-26
: TSX formatter override looks good; consider mirroring for .ts files.If you also want VSCode to use the built-in TypeScript formatter for .ts files (not just .tsx), add a matching [typescript] override for consistency. Otherwise, TypeScript files will continue to use dprint while TSX uses the TS plugin.
crates/template/assets/enhance.system.jinja (1)
56-59
: Relocate and guard the new “User Context” block to avoid empty injections and to align with the “Inputs” section.
- “User Context (txt)” appears under “About Raw Notes,” but it’s an input, not a raw-notes attribute. Move it under “# Inputs Provided by the user.”
- Wrap the printed context in a conditional so “Here is the User Context:” isn’t shown when empty.
- Minor: trim whitespace on the injected value.
Apply:
# Inputs Provided by the user @@ - Meeting Information (txt) - Raw Note (txt) - Meeting Transcript (txt) + - User Context (txt) @@ - - User Context (txt) - -The User Context contains important background details about the user, such as their role, company, ongoing projects, style/tone preferences, and domain terminology. -You must always take this into account when generating enhanced notes to make them more relevant and personalized. - -Here is the User Context: -{{ userContext}} +The User Context contains important background details about the user, such as their role, company, ongoing projects, style/tone preferences, and domain terminology. +You must always take this into account when generating enhanced notes to make them more relevant and personalized. + +{% if userContext %} +Here is the User Context: +{{ userContext | trim }} +{% endif %}Also applies to: 66-73
apps/desktop/src/components/settings/views/user-context.tsx (3)
43-51
: Trim input before saving and improve the empty-input check/message.Prevents saving whitespace-only content and provides a clearer toast. Also reuse the trimmed value when persisting.
- if (!textAreaRef?.current?.value) { - showUserContextToast("Failed to save user context"); + const value = textAreaRef.current?.value?.trim(); + if (!value) { + showUserContextToast("Please enter some content before saving."); setIsLoading(false); return; } - store.set("user_context", { value: textAreaRef?.current?.value }); + store.set("user_context", { value }); await store.save();
72-77
: Prefill the textarea with the existing value (don’t use placeholder for stored data).Using placeholder to show saved content forces users to retype. Prefer defaultValue (or controlled value) and a simple placeholder string.
- <Textarea - className="h-full" - ref={textAreaRef} - placeholder={`${userContext?.value || "Enter details about yourself"}`} - > - </Textarea> + <Textarea + className="h-full" + ref={textAreaRef} + placeholder="Enter details about yourself" + defaultValue={userContext?.value ?? ""} + />
32-57
: Consider consolidating setIsLoading(false) with a finally block.Reduces repetition and ensures loading state resets on all paths without scattering calls. Functionality remains unchanged.
- const handleSave = async () => { - try { - setIsLoading(true); + const handleSave = async () => { + setIsLoading(true); + try { let store = await getStore(); if (!store) { showUserContextToast("Failed to retrieve user store"); - setIsLoading(false); return; } const value = textAreaRef.current?.value?.trim(); if (!value) { showUserContextToast("Please enter some content before saving."); - setIsLoading(false); return; } store.set("user_context", { value }); await store.save(); showUserContextToast("User context saved successfully"); - setIsLoading(false); } catch (error) { - setIsLoading(false); console.log("Failed to save user context with error ", error); + } finally { + setIsLoading(false); } };
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (7)
.vscode/settings.json
(1 hunks)apps/desktop/src/components/editor-area/index.tsx
(2 hunks)apps/desktop/src/components/settings/components/tab-icon.tsx
(2 hunks)apps/desktop/src/components/settings/components/types.ts
(3 hunks)apps/desktop/src/components/settings/views/user-context.tsx
(1 hunks)apps/desktop/src/routes/app.settings.tsx
(3 hunks)crates/template/assets/enhance.system.jinja
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}
⚙️ CodeRabbit Configuration File
**/*.{js,ts,tsx,rs}
: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
Files:
apps/desktop/src/components/settings/components/tab-icon.tsx
apps/desktop/src/components/settings/views/user-context.tsx
apps/desktop/src/routes/app.settings.tsx
apps/desktop/src/components/editor-area/index.tsx
apps/desktop/src/components/settings/components/types.ts
🧬 Code Graph Analysis (3)
apps/desktop/src/components/settings/views/user-context.tsx (2)
packages/ui/src/components/ui/toast.tsx (1)
toast
(67-86)packages/ui/src/components/ui/button.tsx (1)
Button
(37-89)
apps/desktop/src/routes/app.settings.tsx (1)
apps/desktop/src/components/settings/views/user-context.tsx (1)
UserContext
(7-90)
apps/desktop/src/components/editor-area/index.tsx (2)
plugins/connector/src/ext.rs (2)
store
(140-141)store
(144-145)plugins/connector/src/commands.rs (10)
store
(108-109)store
(120-121)store
(132-133)store
(177-178)store
(200-201)store
(223-224)store
(246-247)store
(280-281)store
(303-304)store
(326-327)
🔇 Additional comments (5)
apps/desktop/src/routes/app.settings.tsx (1)
22-22
: User Context tab wiring is correct.Import, title mapping, and conditional render all look consistent with the Tab union and TABS list.
Also applies to: 75-76, 146-146
apps/desktop/src/components/settings/components/tab-icon.tsx (1)
12-12
: Icon support for “user-context” is correctly added.Import + switch case render are consistent with the existing icon pattern.
Also applies to: 60-61
apps/desktop/src/components/settings/components/types.ts (1)
12-12
: Tab type and TABS entry for “user-context” look good.Union extension and TABS addition are coherent and match the icon wiring elsewhere.
Also applies to: 27-29, 42-42
apps/desktop/src/components/editor-area/index.tsx (1)
25-25
: New store import is appropriate.The plugin-store import is used only for getUserContext and is scoped appropriately.
apps/desktop/src/components/settings/views/user-context.tsx (1)
5-5
: Remove unused default React importYour
apps/desktop/src/components/settings/views/user-context.tsx
is already on the automatic JSX runtime ("jsx": "react-jsx"
in apps/desktop/tsconfig.json) and there’s no reference to theReact
identifier in the file. You can simplify the import:- import React, { useEffect, useRef, useState } from "react"; + import { useEffect, useRef, useState } from "react";[nit]
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.
1 issue found across 7 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
|
||
let customInstruction = selectedTemplate?.description; | ||
|
||
let userContext = await getUserContext() || ""; |
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.
getUserContext returns an object but the code passes the whole object instead of its value
string
Prompt for AI agents
Address the following comment on apps/desktop/src/components/editor-area/index.tsx at line 469:
<comment>getUserContext returns an object but the code passes the whole object instead of its `value` string</comment>
<file context>
@@ -448,11 +466,14 @@ export function useEnhanceMutation({
let customInstruction = selectedTemplate?.description;
+ let userContext = await getUserContext() || "";
+
const systemMessage = await templateCommands.render(
</file context>
let userContext = await getUserContext() || ""; | |
let userContext = (await getUserContext())?.value ?? ""; |
…user context is empty and also adds a default value to the text area field
Adds user context so that it is factored into meeting summary in regards to this issue #1327
Summary by cubic
Adds user context to personalize enhanced meeting summaries and introduces a Settings > User Context page to save and use it. Addresses #1327 by factoring user details into the enhance system prompt.