fix: 兼容低版本浏览器消息复制
- 为 Chrome 90 增加剪贴板兼容回退 - 统一聊天与智能体试运行的原色对勾反馈
This commit is contained in:
@@ -1650,18 +1650,6 @@ const isFinalAssistantInRound = (item: BubbleMessage) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleCopyMessage = async (item: BubbleMessage) => {
|
||||
if (!canCopyMessage(item)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(String(item.content || ''));
|
||||
ElMessage.success($t('bot.publicChatCopySuccess'));
|
||||
} catch {
|
||||
ElMessage.error($t('bot.publicChatCopyFail'));
|
||||
}
|
||||
};
|
||||
|
||||
const handleRegenerateMessage = async (item: BubbleMessage) => {
|
||||
if (sending.value || item.role !== 'assistant') {
|
||||
return;
|
||||
@@ -1960,6 +1948,8 @@ function prefetchVisibleVariants() {
|
||||
<ChatMessageActionBar
|
||||
:align="item.role === 'user' ? 'end' : 'start'"
|
||||
:allow-copy="canCopyMessage(item)"
|
||||
:copy-error-message="$t('bot.publicChatCopyFail')"
|
||||
:copy-text="String(item.content || '').trim()"
|
||||
:allow-regenerate="
|
||||
item.role === 'assistant' &&
|
||||
getLatestAssistantMessage()?.id === item.id &&
|
||||
@@ -1976,7 +1966,6 @@ function prefetchVisibleVariants() {
|
||||
Number(item.variantIndex || item.selectedVariantIndex || 1)
|
||||
"
|
||||
:variant-total="Number(item.variantCount || 1)"
|
||||
@copy="handleCopyMessage(item)"
|
||||
@regenerate="handleRegenerateMessage(item)"
|
||||
@select-next-variant="handleSelectVariant(item, 'next')"
|
||||
@select-previous-variant="
|
||||
|
||||
Reference in New Issue
Block a user