fix: 兼容低版本浏览器消息复制
- 为 Chrome 90 增加剪贴板兼容回退 - 统一聊天与智能体试运行的原色对勾反馈
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user