Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
7f0a1d4c
Commit
7f0a1d4c
authored
Mar 07, 2025
by
nick zheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'beta' into 'master'
Beta See merge request
!171
parents
8172e088
de89d166
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
154 additions
and
52 deletions
+154
-52
message-item.vue
...ts/agent-config/agent-preview/components/message-item.vue
+80
-25
message-item.vue
src/views/share/components/message-item.vue
+74
-27
No files found.
src/views/personal-space/personal-app-setting/components/agent-config/agent-preview/components/message-item.vue
View file @
7f0a1d4c
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
computed
,
ref
}
from
'vue'
import
{
computed
,
ref
,
useTemplateRef
}
from
'vue'
import
{
useI18n
}
from
'vue-i18n'
import
{
useI18n
}
from
'vue-i18n'
import
{
throttle
}
from
'lodash-es'
import
{
CheckOne
,
Down
}
from
'@icon-park/vue-next'
import
{
CheckOne
,
Down
}
from
'@icon-park/vue-next'
import
CustomLoading
from
'./custom-loading.vue'
import
CustomLoading
from
'./custom-loading.vue'
import
{
usePersonalAppConfigStore
}
from
'@/store/modules/personal-app-config'
import
{
usePersonalAppConfigStore
}
from
'@/store/modules/personal-app-config'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
asBlob
}
from
'html-docx-js-typescript'
import
{
downloadFile
}
from
'@/utils/download-file'
import
{
copyToClip
}
from
'@/utils/copy'
interface
Props
{
interface
Props
{
role
:
'user'
|
'assistant'
role
:
'user'
|
'assistant'
...
@@ -24,6 +28,8 @@ const { t } = useI18n()
...
@@ -24,6 +28,8 @@ const { t } = useI18n()
const
userStore
=
useUserStore
()
const
userStore
=
useUserStore
()
const
personalAppConfigStore
=
usePersonalAppConfigStore
()
const
personalAppConfigStore
=
usePersonalAppConfigStore
()
const
markdownRenderRef
=
useTemplateRef
<
InstanceType
<
typeof
MarkdownRender
>>
(
'markdownRenderRef'
)
const
isShowReasoningContent
=
ref
(
true
)
const
isShowReasoningContent
=
ref
(
true
)
const
useAvatar
=
computed
(()
=>
{
const
useAvatar
=
computed
(()
=>
{
...
@@ -65,6 +71,32 @@ function handleAudioControl() {
...
@@ -65,6 +71,32 @@ function handleAudioControl() {
function
handleShowReasoningContentSwitch
()
{
function
handleShowReasoningContentSwitch
()
{
isShowReasoningContent
.
value
=
!
isShowReasoningContent
.
value
isShowReasoningContent
.
value
=
!
isShowReasoningContent
.
value
}
}
const
handleContentDownload
=
throttle
(
()
=>
{
if
(
markdownRenderRef
.
value
)
{
const
content
=
markdownRenderRef
.
value
.
getRenderTextContent
()
asBlob
(
content
).
then
((
data
)
=>
{
downloadFile
(
data
as
Blob
).
then
(()
=>
{
window
.
$message
.
success
(
t
(
'common_module.copy_success_message'
))
})
})
}
},
1000
,
{
leading
:
true
,
trailing
:
false
},
)
const
handleContentCopy
=
throttle
(
()
=>
{
copyToClip
(
props
.
messageItem
.
textContent
).
then
(()
=>
{
window
.
$message
.
success
(
t
(
'common_module.copy_success_message'
))
})
},
1000
,
{
leading
:
true
,
trailing
:
false
},
)
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -109,6 +141,7 @@ function handleShowReasoningContentSwitch() {
...
@@ -109,6 +141,7 @@ function handleShowReasoningContentSwitch() {
/>
/>
<
template
v
-
else
>
<
template
v
-
else
>
<
MarkdownRender
<
MarkdownRender
ref
=
"markdownRenderRef"
:
raw
-
text
-
content
=
"
:
raw
-
text
-
content
=
"
messageItem.reasoningContent
messageItem.reasoningContent
? messageItem.reasoningContent
? messageItem.reasoningContent
...
@@ -158,6 +191,7 @@ function handleShowReasoningContentSwitch() {
...
@@ -158,6 +191,7 @@ function handleShowReasoningContentSwitch() {
<
div
v
-
else
>
<
div
v
-
else
>
<
p
class
=
"break-all"
>
<
p
class
=
"break-all"
>
<
MarkdownRender
<
MarkdownRender
ref
=
"markdownRenderRef"
:
raw
-
text
-
content
=
"
:
raw
-
text
-
content
=
"
messageItem.isEmptyContent
messageItem.isEmptyContent
? t('common_module.dialogue_module.empty_message_content')
? t('common_module.dialogue_module.empty_message_content')
...
@@ -173,6 +207,8 @@ function handleShowReasoningContentSwitch() {
...
@@ -173,6 +207,8 @@ function handleShowReasoningContentSwitch() {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
class
=
"flex w-full items-center justify-between"
>
<
div
>
<
div
<
div
v
-
show
=
"isShowAudioControl"
v
-
show
=
"isShowAudioControl"
class
=
"text-font-color flex items-center gap-0.5"
class
=
"text-font-color flex items-center gap-0.5"
...
@@ -180,7 +216,10 @@ function handleShowReasoningContentSwitch() {
...
@@ -180,7 +216,10 @@ function handleShowReasoningContentSwitch() {
@
click
=
"handleAudioControl"
@
click
=
"handleAudioControl"
>
>
<
i
v
-
if
=
"!messageItem.isVoicePlaying"
class
=
"iconfont icon-play text-[24px]"
/>
<
i
v
-
if
=
"!messageItem.isVoicePlaying"
class
=
"iconfont icon-play text-[24px]"
/>
<
div
v
-
else
class
=
"mx-1.5 my-3 h-[12px] w-[12px] bg-[url(@/assets/images/playing.gif)] bg-[length:100%_100%]"
/>
<
div
v
-
else
class
=
"mx-1.5 my-3 h-[12px] w-[12px] bg-[url(@/assets/images/playing.gif)] bg-[length:100%_100%]"
/>
<
span
<
span
v
-
show
=
"isPlayableAudio"
v
-
show
=
"isPlayableAudio"
...
@@ -201,5 +240,21 @@ function handleShowReasoningContentSwitch() {
...
@@ -201,5 +240,21 @@ function handleShowReasoningContentSwitch() {
<
CustomLoading
/>
<
CustomLoading
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
v
-
show
=
"role === 'assistant' && messageItem.textContent && !messageItem.isAnswerResponseLoading"
class
=
"py-[10px] pr-[14px] text-end"
>
<
i
class
=
"iconfont icon-download hover:text-theme-color mr-[14px] transform cursor-pointer text-[14px]"
@
click
=
"handleContentDownload"
/>
<
i
class
=
"iconfont icon-copy1 hover:text-theme-color transform cursor-pointer text-[14px]"
@
click
=
"handleContentCopy"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
src/views/share/components/message-item.vue
View file @
7f0a1d4c
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
computed
,
ref
}
from
'vue'
import
{
computed
,
ref
,
useTemplateRef
}
from
'vue'
import
{
useI18n
}
from
'vue-i18n'
import
{
useI18n
}
from
'vue-i18n'
import
{
throttle
}
from
'lodash-es'
import
{
CheckOne
,
Down
}
from
'@icon-park/vue-next'
import
{
CheckOne
,
Down
}
from
'@icon-park/vue-next'
import
CustomLoading
from
'./custom-loading.vue'
import
CustomLoading
from
'./custom-loading.vue'
import
MusicWavesLoading
from
'./music-waves-loading.vue'
import
MusicWavesLoading
from
'./music-waves-loading.vue'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
MarkdownRender
from
'@/components/markdown-render/markdown-render.vue'
import
EditorDrawer
from
'@/components/editor-drawer/editor-drawer.vue'
import
{
PersonalAppConfigState
}
from
'@/store/types/personal-app-config'
import
{
PersonalAppConfigState
}
from
'@/store/types/personal-app-config'
import
{
useLayoutConfig
}
from
'@/composables/useLayoutConfig'
import
{
useLayoutConfig
}
from
'@/composables/useLayoutConfig'
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
copyToClip
}
from
'@/utils/copy'
interface
Props
{
interface
Props
{
role
:
'user'
|
'assistant'
role
:
'user'
|
'assistant'
...
@@ -28,7 +31,11 @@ const userStore = useUserStore()
...
@@ -28,7 +31,11 @@ const userStore = useUserStore()
const
{
isMobile
}
=
useLayoutConfig
()
const
{
isMobile
}
=
useLayoutConfig
()
const
markdownRenderRef
=
useTemplateRef
<
InstanceType
<
typeof
MarkdownRender
>>
(
'markdownRenderRef'
)
const
isShowReasoningContent
=
ref
(
true
)
const
isShowReasoningContent
=
ref
(
true
)
const
isShowEditorDrawer
=
ref
(
false
)
const
editorDrawerContent
=
ref
(
''
)
const
useAvatar
=
computed
(()
=>
{
const
useAvatar
=
computed
(()
=>
{
return
userStore
.
userInfo
.
avatarUrl
||
'https://gsst-poe-sit.gz.bcebos.com/data/20240910/1725952917468.png'
return
userStore
.
userInfo
.
avatarUrl
||
'https://gsst-poe-sit.gz.bcebos.com/data/20240910/1725952917468.png'
...
@@ -84,6 +91,21 @@ function handleAudioControl() {
...
@@ -84,6 +91,21 @@ function handleAudioControl() {
function
handleShowReasoningContentSwitch
()
{
function
handleShowReasoningContentSwitch
()
{
isShowReasoningContent
.
value
=
!
isShowReasoningContent
.
value
isShowReasoningContent
.
value
=
!
isShowReasoningContent
.
value
}
}
function
handleContentEdit
()
{
isShowEditorDrawer
.
value
=
true
editorDrawerContent
.
value
=
props
.
messageItem
.
textContent
||
''
}
const
handleContentCopy
=
throttle
(
()
=>
{
copyToClip
(
props
.
messageItem
.
textContent
).
then
(()
=>
{
window
.
$message
.
success
(
t
(
'common_module.copy_success_message'
))
})
},
1000
,
{
leading
:
true
,
trailing
:
false
},
)
</
script
>
</
script
>
<
template
>
<
template
>
...
@@ -105,8 +127,8 @@ function handleShowReasoningContentSwitch() {
...
@@ -105,8 +127,8 @@ function handleShowReasoningContentSwitch() {
/>
/>
<div
<div
class=
"flex
w-full
flex-col overflow-x-auto"
class=
"flex flex-col overflow-x-auto"
:class=
"
isMobile && role === 'user' ? 'items-end' : 'items-start'
"
:class=
"
[isMobile && role === 'user' ? 'items-end' : 'items-start', isMobile ? 'w-full' : '']
"
>
>
<template
v-if=
"role === 'assistant' && isDeepSeekR1"
>
<template
v-if=
"role === 'assistant' && isDeepSeekR1"
>
<div
class=
"my-[7px] select-none text-[14px]"
>
<div
class=
"my-[7px] select-none text-[14px]"
>
...
@@ -138,6 +160,7 @@ function handleShowReasoningContentSwitch() {
...
@@ -138,6 +160,7 @@ function handleShowReasoningContentSwitch() {
/>
/>
<
template
v
-
else
>
<
template
v
-
else
>
<
MarkdownRender
<
MarkdownRender
ref
=
"markdownRenderRef"
:
raw
-
text
-
content
=
"
:
raw
-
text
-
content
=
"
messageItem.reasoningContent
messageItem.reasoningContent
? messageItem.reasoningContent
? messageItem.reasoningContent
...
@@ -189,6 +212,7 @@ function handleShowReasoningContentSwitch() {
...
@@ -189,6 +212,7 @@ function handleShowReasoningContentSwitch() {
<
div
v
-
else
>
<
div
v
-
else
>
<
p
class
=
"break-all"
>
<
p
class
=
"break-all"
>
<
MarkdownRender
<
MarkdownRender
ref
=
"markdownRenderRef"
:
raw
-
text
-
content
=
"
:
raw
-
text
-
content
=
"
messageItem.isEmptyContent
messageItem.isEmptyContent
? t('common_module.dialogue_module.empty_message_content')
? t('common_module.dialogue_module.empty_message_content')
...
@@ -220,15 +244,20 @@ function handleShowReasoningContentSwitch() {
...
@@ -220,15 +244,20 @@ function handleShowReasoningContentSwitch() {
<
/n-popover
>
<
/n-popover
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<!--
pc
端展示
-->
<
div
v
-
show
=
"!isMobile"
class
=
"flex w-full items-center justify-between"
>
<
div
>
<
div
<
div
v
-
show
=
"isShowAudioControl && !isMobile
"
v
-
show
=
"isShowAudioControl
"
class
=
"text-font-color flex items-center gap-0.5"
class
=
"text-font-color flex items-center gap-0.5"
:
class
=
"isPlayableAudio ? 'hover:text-theme-color cursor-pointer hover:opacity-80' : 'cursor-not-allowed'"
:
class
=
"isPlayableAudio ? 'hover:text-theme-color cursor-pointer hover:opacity-80' : 'cursor-not-allowed'"
@
click
=
"handleAudioControl"
@
click
=
"handleAudioControl"
>
>
<
i
v
-
if
=
"!messageItem.isVoicePlaying"
class
=
"iconfont icon-play text-[24px]"
/>
<
i
v
-
if
=
"!messageItem.isVoicePlaying"
class
=
"iconfont icon-play text-[24px]"
/>
<
div
v
-
else
class
=
"mx-1.5 my-3 h-[12px] w-[12px] bg-[url(@/assets/images/playing.gif)] bg-[length:100%_100%]"
/>
<
div
v
-
else
class
=
"mx-1.5 my-3 h-[12px] w-[12px] bg-[url(@/assets/images/playing.gif)] bg-[length:100%_100%]"
/>
<
span
<
span
v
-
show
=
"isPlayableAudio"
v
-
show
=
"isPlayableAudio"
...
@@ -249,5 +278,23 @@ function handleShowReasoningContentSwitch() {
...
@@ -249,5 +278,23 @@ function handleShowReasoningContentSwitch() {
<
CustomLoading
/>
<
CustomLoading
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
v
-
show
=
"role === 'assistant' && messageItem.textContent && !messageItem.isAnswerResponseLoading"
class
=
"py-[10px] pr-[14px] text-end"
>
<
i
class
=
"iconfont icon-edit1 hover:text-theme-color mr-[14px] transform cursor-pointer text-[14px]"
@
click
=
"handleContentEdit"
/>
<
i
class
=
"iconfont icon-copy1 hover:text-theme-color transform cursor-pointer text-[14px]"
@
click
=
"handleContentCopy"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
EditorDrawer
v
-
model
:
is
-
show
-
editor
-
drawer
=
"isShowEditorDrawer"
:
content
=
"editorDrawerContent"
/>
<
/template
>
<
/template
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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