fix(chat): copy text content instead of raw response JSON#1471
fix(chat): copy text content instead of raw response JSON#1471xieyxclack merged 4 commits intoagentscope-ai:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the user experience in the chat console by refining how chat responses are copied. Instead of exposing complex internal JSON structures, the system now intelligently extracts and presents only the relevant, human-readable text from assistant messages. This change makes interactions more intuitive and efficient for users, ensuring that copied content is directly usable. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a custom copy action to copy readable text from chat responses instead of raw JSON. The implementation includes a robust copyText utility with a fallback for non-secure contexts. My review focuses on improving type definitions for clarity, enhancing error handling, and ensuring the new actions don't unintentionally remove existing functionality. Overall, the changes are a good improvement to the user experience.
There was a problem hiding this comment.
Pull request overview
Updates the Chat console’s “copy reply” behavior to copy assistant-readable text extracted from response content (text/refusal) instead of copying the full raw response JSON, with a clipboard fallback for non-secure contexts.
Changes:
- Added helpers to extract copyable text from a response payload and to copy text with a clipboard API fallback.
- Wired a custom copy action into
AgentScopeRuntimeWebUIactions and added success/error toast feedback. - Added an
index.module.lessimport in the Chat page.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Follow-up changes pushed in
I did not change |
|
@lllcy Thank you for your contribution! One suggestion: |
|
Thanks for catching that — fixed in Added
|
There was a problem hiding this comment.
Pull request overview
This PR updates the chat console’s “copy reply” behavior so users copy assistant-readable text (e.g., Markdown) instead of the raw response JSON payload, addressing issue #1457.
Changes:
- Added response parsing to extract assistant
text/refusalblocks for copying, with clipboard fallback support. - Overrode the runtime UI action list to provide a custom copy action with success/failure toasts.
- Added a new
common.copyi18n key across supported locales.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| console/src/pages/Chat/index.tsx | Adds text extraction + clipboard copy helper and wires a custom copy action into the chat UI options. |
| console/src/locales/en.json | Adds common.copy translation. |
| console/src/locales/zh.json | Adds common.copy translation. |
| console/src/locales/ru.json | Adds common.copy translation. |
| console/src/locales/ja.json | Adds common.copy translation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Follow-up changes pushed in
I still did not change |
Summary
textandrefusalcontent first, and fall back to JSON only when no copyable text existsFixes #1457
Testing
uv tool run --from pre-commit pre-commit run --files console/src/pages/Chat/index.tsx