yyqdbngt opened a new pull request, #4100:
URL: https://github.com/apache/rocketmq-dashboard/pull/4100

   ## Summary
   
   Add a "复制最新回答" (Copy Latest Answer) button to the AI page bottom toolbar. It 
copies the text of the latest assistant message in the current conversation via 
`navigator.clipboard.writeText`, with a textarea + 
`document.execCommand('copy')` fallback, and shows success/error toasts. The 
button is disabled when the current conversation has no assistant message with 
content.
   
   Field notes (per the actual page structure, which differs slightly from the 
issue description): assistant messages use `role: 'ai'` (not `'assistant'`), 
and the streamed answer text lives in the `summary` field (`text` is only set 
on user messages). The copy handler therefore reads `summary || text` of the 
last `ai`-role message.
   
   ## Why
   
   Copying a long generated answer currently requires manual selection in the 
chat area. A one-click copy action is a small, common quality-of-life 
improvement for the assistant workflow.
   
   ## Testing
   
   - Local type-check: `cd web && ./node_modules/.bin/tsc -b tsconfig.app.json` 
→ exit 0.
   - Server Node 20: `./node_modules/.bin/vitest run 
src/pages/ai/__tests__/AiPage.test.tsx` → all tests green.
   - New tests (existing tests did not cover clipboard behavior):
     - copies the latest assistant answer to the clipboard (mocked 
`navigator.clipboard.writeText`, asserts the streamed answer text and the 
success toast);
     - disables the copy button when there is no assistant answer.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to