fix: 兼容低版本浏览器消息复制

- 为 Chrome 90 增加剪贴板兼容回退

- 统一聊天与智能体试运行的原色对勾反馈
This commit is contained in:
2026-07-22 20:07:34 +08:00
parent 5a3d4788da
commit 9f06c238d3
15 changed files with 423 additions and 83 deletions

View File

@@ -21,6 +21,7 @@ import {
ChatTimeline,
ChatTimelineBuilder,
} from '@easyflow/common-ui';
import { copyTextToClipboard } from '@easyflow/utils';
import {
Delete,
@@ -872,13 +873,15 @@ function handleStop() {
async function handleCopyMessage(item: ChatTimelineMessageItem) {
const text = copyMessageText(item);
if (!text) {
return;
return false;
}
try {
await navigator.clipboard.writeText(text);
ElMessage.success('已复制');
} catch {
await copyTextToClipboard(text);
return true;
} catch (error) {
console.error('复制消息失败:', error);
ElMessage.error('复制失败');
return false;
}
}
@@ -1133,9 +1136,9 @@ onBeforeUnmount(() => {
:image-loader="loadAgentChatImage"
empty-text="选择智能体后开始对话"
:approval-loading="Boolean(approvalLoadingKey)"
:copy-action="handleCopyMessage"
:copyable="canCopyMessage"
@approve="handleApprove"
@copy-message="handleCopyMessage"
@reject="handleReject"
@select-next-variant="() => undefined"
@select-previous-variant="() => undefined"