Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
水玉婷
ai-wechat
Commits
b36cf82d
Commit
b36cf82d
authored
Feb 13, 2026
by
水玉婷
Browse files
feat:修复历史消息无法复制bug
parent
8b8f892f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/views/components/AiChat.vue
View file @
b36cf82d
...
...
@@ -520,9 +520,34 @@ const handleMessageClick = (message: Message, block: any) => {
}
try
{
// 直接使用原始内容
if
(
message
.
originalContent
)
{
messageText
.
value
=
message
.
originalContent
;
// 提取消息中的文本内容
let
textToInput
=
''
;
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
();
// 聚焦到输入框
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment