Commit b36cf82d authored by 水玉婷's avatar 水玉婷
Browse files

feat:修复历史消息无法复制bug

parent 8b8f892f
...@@ -520,9 +520,34 @@ const handleMessageClick = (message: Message, block: any) => { ...@@ -520,9 +520,34 @@ const handleMessageClick = (message: Message, block: any) => {
} }
try { try {
// 直接使用原始内容 // 提取消息中的文本内容
if (message.originalContent) { let textToInput = '';
messageText.value = message.originalContent;
if (message.contentBlocks && message.contentBlocks.length > 0) {
message.contentBlocks.forEach(block => {
// 跳过非文字内容块
if (block.audioData || block.chartData) {
return;
}
if (block.content) {
// 移除HTML标签,只保留纯文本
const textContent = block.content.replace(/<[^>]*>/g, '').trim();
if (textContent) {
textToInput += textContent + '\n';
}
}
});
}
// 如果没有内容,使用原始内容
if (!textToInput.trim() && message.originalContent) {
textToInput = message.originalContent;
}
if (textToInput.trim()) {
// 将内容设置到输入框
messageText.value = textToInput.trim();
// 自动调整输入框高度 // 自动调整输入框高度
adjustTextareaHeight(); adjustTextareaHeight();
// 聚焦到输入框 // 聚焦到输入框
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment