Skip to content

feat: make View Instructions optional - #353

Merged
ilyabo merged 2 commits into
mainfrom
xli-optional-system-prompt
Feb 10, 2026
Merged

ilyabo merged 2 commits into
mainfrom
xli-optional-system-prompt

Conversation

@lixun910

@lixun910 lixun910 commented Feb 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Refactor
    • AI Model Parameters component now supports configurable visibility of the View Instructions button, providing greater flexibility in how the interface displays this option.

@lixun910
lixun910 requested a review from ilyabo February 10, 2026 19:54
@coderabbitai

coderabbitai Bot commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The AiModelParameters component is updated to accept props via a new AiModelParametersProps interface, introducing an optional showViewInstructions boolean that controls whether the View Instructions button is rendered, replacing unconditional button display.

Changes

Cohort / File(s) Summary
AiModelParameters Component Enhancement
packages/ai-settings/src/components/AiModelParameters.tsx
Added AiModelParametersProps interface with optional showViewInstructions property; updated component signature to accept and destructure props with showViewInstructions defaulting to false; made View Instructions button rendering conditional based on the prop value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A button that hides when we say so,
Props flow freely, high and low,
Control the view with just a boolean—
Flexibility blooms, quite wonderful!
The instructions stay tucked away,
Until called upon some other day. 🌸

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: making the View Instructions button optional through a new showViewInstructions prop with conditional rendering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch xli-optional-system-prompt

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/ai-settings/src/components/AiModelParameters.tsx`:
- Around line 17-23: The change defaulting showViewInstructions to false in the
AiModelParameters component will hide the "View Instructions" button for all
existing call sites that do not pass props; revert or mitigate by either
restoring the previous default (set showViewInstructions to true in the
AiModelParameters props/defaults) or updating every consumer to explicitly pass
showViewInstructions={true}; locate the AiModelParameters component (exported as
AiModelParameters) and choose one of the two fixes: (a) change the default back
to true in the component signature, or (b) update the 8 upstream call sites that
render AiModelParameters to include showViewInstructions={true} where the button
should remain visible.
🧹 Nitpick comments (1)
packages/ai-settings/src/components/AiModelParameters.tsx (1)

173-214: Consider conditionally rendering the dialog and its dependencies when showViewInstructions is false.

The useDisclosure hook (line 41), getFullInstructions selector (line 51-53), handleViewFullInstructions (line 118-120), and the entire <Dialog> block (lines 196-214) are still initialized even when the button is hidden. Wrapping the dialog JSX in the same conditional would avoid rendering a permanently-closed dialog:

♻️ Suggested change
-      {/* Full Instructions Modal */}
-      <Dialog open={isOpen} onOpenChange={onClose}>
-        ...
-      </Dialog>
+      {/* Full Instructions Modal */}
+      {showViewInstructions && (
+        <Dialog open={isOpen} onOpenChange={onClose}>
+          ...
+        </Dialog>
+      )}

Moving the getFullInstructions selector and handleViewFullInstructions behind a guard isn't feasible due to the rules of hooks, but skipping the Dialog JSX is a small win.

Comment on lines +17 to +23
export interface AiModelParametersProps {
showViewInstructions?: boolean;
}

export const AiModelParameters: FC<AiModelParametersProps> = ({
showViewInstructions = false,
}) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

rg -n --type=tsx --type=ts -C3 'AiModelParameters(?!Props)' --multiline-dotall

Repository: sqlrooms/sqlrooms

Length of output: 307


🏁 Script executed:

rg --pcre2 -n --type=tsx --type=ts -C3 'AiModelParameters(?!Props)'

Repository: sqlrooms/sqlrooms

Length of output: 88


🏁 Script executed:

rg -n 'AiModelParameters' --include='*.ts' --include='*.tsx' -C3

Repository: sqlrooms/sqlrooms

Length of output: 502


🏁 Script executed:

rg 'AiModelParameters' -C3

Repository: sqlrooms/sqlrooms

Length of output: 4524


🏁 Script executed:

cat packages/ai-settings/src/components/AiSettingsPanel.tsx

Repository: sqlrooms/sqlrooms

Length of output: 1325


🏁 Script executed:

rg 'ModelParametersSettings' -C3

Repository: sqlrooms/sqlrooms

Length of output: 6445


Defaulting showViewInstructions to false is a breaking change — all 8 existing call sites will lose the "View Instructions" button.

The component is currently used in 8 places across examples and apps (ai, ai-core, ai-rag, ai-nextjs, app-builder, ai-agent, and sqlrooms-cli-ui), all without passing props. These will silently lose the button with the new default. Update the call sites that need the button to pass showViewInstructions={true}, or reconsider the default value if the button should remain visible.

🤖 Prompt for AI Agents
In `@packages/ai-settings/src/components/AiModelParameters.tsx` around lines 17 -
23, The change defaulting showViewInstructions to false in the AiModelParameters
component will hide the "View Instructions" button for all existing call sites
that do not pass props; revert or mitigate by either restoring the previous
default (set showViewInstructions to true in the AiModelParameters
props/defaults) or updating every consumer to explicitly pass
showViewInstructions={true}; locate the AiModelParameters component (exported as
AiModelParameters) and choose one of the two fixes: (a) change the default back
to true in the component signature, or (b) update the 8 upstream call sites that
render AiModelParameters to include showViewInstructions={true} where the button
should remain visible.

@ilyabo
ilyabo merged commit 7782c36 into main Feb 10, 2026
4 checks passed
@ilyabo
ilyabo deleted the xli-optional-system-prompt branch February 10, 2026 19:59
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