Skip to content

fix: Improve copy message placement in AI assistant - #392

Merged
bdjulbic merged 4 commits into
mainfrom
fix/rollback-copy-button
Mar 2, 2026
Merged

bdjulbic merged 4 commits into
mainfrom
fix/rollback-copy-button

Conversation

@bdjulbic

@bdjulbic bdjulbic commented Feb 26, 2026 •

Copy link
Copy Markdown
Collaborator

Rollback copy button in the ai assistant
and I would suggest we decrease the gap of the messages to 2 instead of 4

Here are the screenshots showing gap-2
Screenshot 2026-02-26 at 13 48 23
Screenshot 2026-02-26 at 13 48 00

Summary by CodeRabbit

  • New Features
    • Added a Copy button to analysis results to copy the aggregated textual response with one click (tooltip: "Copy message"); shown only when textual content exists.
  • UI Improvements
    • Reduced spacing for a tighter, more compact result display; Copy button has a subtle border and is positioned after the message/error content.

@bdjulbic bdjulbic changed the title fix: rollback copy button fix: rollback copy button ti ai assistant Feb 26, 2026
@bdjulbic
bdjulbic requested a review from Copilot February 26, 2026 12:49
@coderabbitai

coderabbitai Bot commented Feb 26, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Aggregates text and reasoning parts from a message and conditionally renders a CopyButton that copies the combined text; adjusts main container gap from 4 to 2.

Changes

Cohort / File(s) Summary
Copy Button Integration
packages/ai-core/src/components/AnalysisResult.tsx
Imported CopyButton and isTextPart/isReasoningPart; collect and join text content from message parts into a single string, compute hasTextContent, reduce UI gap from 4 to 2, and render a bordered CopyButton with tooltip "Copy message" when text exists.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • igorDykhta
  • lixun910

Poem

🐰 I hopped through parts both short and long,
Collected words and reasoned song,
One gentle click, the bundle flies —
Copied lines beneath bright skies,
A tiny button, tidy and strong.

🚥 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 describes a specific improvement to copy message placement in the AI assistant, which aligns with the main change of adding/repositioning a CopyButton component.
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 (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/rollback-copy-button

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.

Copilot AI 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.

Pull request overview

This PR restores the copy button functionality to the AI assistant's analysis results and reduces the spacing between message elements for a more compact UI. The copy button allows users to easily copy all text and reasoning content from an analysis response.

Changes:

  • Added copy button to AnalysisResult component that collects all text and reasoning parts
  • Reduced gap spacing from gap-4 to gap-2 for tighter message layout

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ai-core/src/components/AnalysisResult.tsx`:
- Line 2: Remove the reintroduced copy-button behavior: delete the new import of
CopyButton and remove any JSX and handlers that render or wire the copy button
inside the AnalysisResult component (search for CopyButton usage and any
functions/props like onCopy, handleCopy, or copy-related state within
AnalysisResult) so the component returns to the original UI without copy
functionality; ensure related props or state introduced only for copying are
also removed to avoid unused variables.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7ba4f2 and edbab79.

📒 Files selected for processing (1)
  • packages/ai-core/src/components/AnalysisResult.tsx

@@ -1,11 +1,13 @@
import {AnalysisResultSchema} from '@sqlrooms/ai-config';
import {CopyButton} from '@sqlrooms/ui';

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 | 🟠 Major

Rollback objective is not met: copy button was reintroduced.

This change adds copy-button behavior instead of rolling it back (Line 132 onward), which conflicts with the PR goal.

Suggested rollback diff
 import {AnalysisResultSchema} from '@sqlrooms/ai-config';
-import {CopyButton} from '@sqlrooms/ui';
 import type {UIMessage} from 'ai';
@@
-import {isTextPart, isReasoningPart} from '../utils';
@@
-  // Collect all text content from message parts for copy button
-  const allTextContent = uiMessageParts
-    .filter((part) => isTextPart(part) || isReasoningPart(part))
-    .map((part) => part.text)
-    .join('\n\n');
-  const hasTextContent = allTextContent.trim().length > 0;
@@
-        {hasTextContent && (
-          <div className="flex justify-start">
-            <CopyButton
-              text={allTextContent}
-              tooltipLabel="Copy entire response"
-              className="border-muted border"
-            />
-          </div>
-        )}

Also applies to: 10-10, 61-67, 132-140

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai-core/src/components/AnalysisResult.tsx` at line 2, Remove the
reintroduced copy-button behavior: delete the new import of CopyButton and
remove any JSX and handlers that render or wire the copy button inside the
AnalysisResult component (search for CopyButton usage and any functions/props
like onCopy, handleCopy, or copy-related state within AnalysisResult) so the
component returns to the original UI without copy functionality; ensure related
props or state introduced only for copying are also removed to avoid unused
variables.

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/ai-core/src/components/AnalysisResult.tsx Outdated
@ilyabo ilyabo changed the title fix: rollback copy button ti ai assistant fix: Improve copy message placement in AI assistant Mar 2, 2026
Comment thread packages/ai-core/src/components/AnalysisResult.tsx Outdated

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

♻️ Duplicate comments (1)
packages/ai-core/src/components/AnalysisResult.tsx (1)

2-2: ⚠️ Potential issue | 🟠 Major

Rollback objective is still not met: copy-button flow is reintroduced.

Line 2, Line 10, Line 61-67, and Line 133-141 collectively add back copy behavior (CopyButton import, content aggregation, and render path), which conflicts with the PR goal to roll back the copy button.

Suggested rollback diff
 import {AnalysisResultSchema} from '@sqlrooms/ai-config';
-import {CopyButton} from '@sqlrooms/ui';
 import type {UIMessage} from 'ai';
@@
-import {isTextPart, isReasoningPart} from '../utils';
@@
-  // Collect all text content from message parts for copy button
-  const allTextContent = uiMessageParts
-    .flatMap((part) =>
-      isTextPart(part) || isReasoningPart(part) ? [part.text] : [],
-    )
-    .join('\n\n');
-  const hasTextContent = allTextContent.trim().length > 0;
@@
-        {hasTextContent && (
-          <div className="flex justify-start">
-            <CopyButton
-              text={allTextContent}
-              tooltipLabel="Copy message"
-              className="border-muted border"
-            />
-          </div>
-        )}

Also applies to: 10-10, 61-67, 133-141

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai-core/src/components/AnalysisResult.tsx` at line 2, The rollback
reintroduces copy behavior by importing and using CopyButton; remove the
CopyButton import and all code paths that aggregate content for copying and the
JSX that renders CopyButton in AnalysisResult.tsx (remove the import line for
CopyButton and delete the variables/logic that build the copy content and the
render block that returns <CopyButton .../>), ensuring the component no longer
references CopyButton or any copy-related functions/variables.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/ai-core/src/components/AnalysisResult.tsx`:
- Line 2: The rollback reintroduces copy behavior by importing and using
CopyButton; remove the CopyButton import and all code paths that aggregate
content for copying and the JSX that renders CopyButton in AnalysisResult.tsx
(remove the import line for CopyButton and delete the variables/logic that build
the copy content and the render block that returns <CopyButton .../>), ensuring
the component no longer references CopyButton or any copy-related
functions/variables.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53228da and cb3ee3d.

📒 Files selected for processing (1)
  • packages/ai-core/src/components/AnalysisResult.tsx

@bdjulbic
bdjulbic merged commit fce659c into main Mar 2, 2026
4 checks passed
@bdjulbic
bdjulbic deleted the fix/rollback-copy-button branch March 2, 2026 15:33
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.

4 participants