Skip to content

Template context#1458

Merged
duckduckhero merged 2 commits intomainfrom
template-context
Sep 9, 2025
Merged

Template context#1458
duckduckhero merged 2 commits intomainfrom
template-context

Conversation

@duckduckhero
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

📝 Walkthrough

Walkthrough

Threshold for considering transcript words was raised and made environment-dependent in editor-area, affecting when title generation runs post-enhancement. Template settings view updated the System Instruction textarea with a longer placeholder and increased height. No exported/public API signatures changed.

Changes

Cohort / File(s) Summary
Editor enhancement flow threshold
apps/desktop/src/components/editor-area/index.tsx
Adjusted hasTranscriptWords to require length > 5 (development) or > 100 (production); generateTitleDirect after enhancement now gated by this threshold. No other logic changes.
Template editor UI text/size
apps/desktop/src/components/settings/views/template.tsx
Expanded System Instruction Textarea placeholder to multi-line guidance and increased height from h-20 to h-48. No functional logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant EA as EditorArea
  participant EN as Enhancer
  participant TR as Transcript
  participant TS as TitleService

  U->>EA: Trigger enhancement
  EA->>EN: enhance(content)
  EN-->>EA: onSuccess(enhanced, transcriptWords)

  rect rgba(230,240,255,0.5)
    Note over EA: Check transcriptWords length against env threshold<br/>dev: >5, prod: >100
    alt length > threshold
      EA->>TS: generateTitleDirect(enhanced)
      TS-->>EA: title
      EA-->>U: Show enhanced content and title
    else length ≤ threshold
      EA-->>U: Show enhanced content (no auto title)
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks (2 warnings, 1 inconclusive)

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is currently empty and does not summarize any of the changes introduced, making it uninformative for reviewers. Add a descriptive summary outlining the key modifications, such as the new transcript word thresholds in editor-area and the expanded placeholder and height in the TemplateEditor component.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “Template context” is too vague to convey the main changes in this PR, as it does not reflect the adjustments to transcript word logic or the extended template editor placeholder. Revise the title to clearly and concisely highlight the primary changes, for example “Adjust transcript word threshold and expand template editor system instruction placeholder.”
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch template-context

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (1)
apps/desktop/src/components/settings/views/template.tsx (1)

221-227: Tighten placeholder formatting (remove extra blank line to avoid awkward leading whitespace in UI/i18n).
The empty line creates a visible blank row in the textarea placeholder and bakes whitespace into the translation key.

-          placeholder={t`Describe the summary you want to generate...
-            
-• what kind of meeting is this?
-• any format requirements?
-• what should AI remember when summarizing?`}
+          placeholder={t`Describe the summary you want to generate...
+• what kind of meeting is this?
+• any format requirements?
+• what should AI remember when summarizing?`}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86a7cda and cc19ffd.

⛔ Files ignored due to path filters (2)
  • apps/desktop/src/locales/en/messages.po is excluded by !**/*.po
  • apps/desktop/src/locales/ko/messages.po is excluded by !**/*.po
📒 Files selected for processing (2)
  • apps/desktop/src/components/editor-area/index.tsx (1 hunks)
  • apps/desktop/src/components/settings/views/template.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit configuration file

**/*.{js,ts,tsx,rs}: 1. Do not add any error handling. Keep the existing one.
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/views/template.tsx
  • apps/desktop/src/components/editor-area/index.tsx
🧬 Code graph analysis (1)
apps/desktop/src/components/editor-area/index.tsx (1)
packages/utils/src/contexts/sessions.tsx (1)
  • useSession (49-74)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: ci (windows, windows-latest)
  • GitHub Check: ci (macos, macos-14)


const preMeetingNote = useSession(sessionId, (s) => s.session.pre_meeting_memo_html) ?? "";
const hasTranscriptWords = useSession(sessionId, (s) => s.session.words.length > 0);
const hasTranscriptWords = useSession(sessionId, (s) => s.session.words.length > (import.meta.env.DEV ? 5 : 100));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Guard against undefined words to prevent runtime crash.
Directly accessing s.session.words.length can throw if session or words is undefined; keep the new threshold but add null-safe access.

-const hasTranscriptWords = useSession(sessionId, (s) => s.session.words.length > (import.meta.env.DEV ? 5 : 100));
+const hasTranscriptWords = useSession(
+  sessionId,
+  (s) => (s.session?.words?.length ?? 0) > (import.meta.env.DEV ? 5 : 100),
+);

Optional: You also compute the same threshold later (Lines 433–444). Consider centralizing it to avoid drift.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const hasTranscriptWords = useSession(sessionId, (s) => s.session.words.length > (import.meta.env.DEV ? 5 : 100));
const hasTranscriptWords = useSession(
sessionId,
(s) => (s.session?.words?.length ?? 0) > (import.meta.env.DEV ? 5 : 100),
);
🤖 Prompt for AI Agents
In apps/desktop/src/components/editor-area/index.tsx around line 156, the
selector calls s.session.words.length directly which can throw if session or
words is undefined; update the selector to safely access nested properties
(e.g., check s.session and s.session.words exist before reading length) while
preserving the DEV vs production threshold logic, and ensure it returns a
boolean default (false) when words is missing; optionally extract the threshold
expression into a shared constant (used again at lines ~433–444) to avoid
duplication and drift.

@duckduckhero duckduckhero merged commit b2cfdbb into main Sep 9, 2025
11 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 13, 2025
@ComputelessComputer ComputelessComputer deleted the template-context branch December 14, 2025 15:23
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