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
d541bf27
Commit
d541bf27
authored
Apr 21, 2025
by
nick zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(多模型调试): 支持上滑查看对话记录
parent
8e5e71c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
21 deletions
+72
-21
footer-operation.vue
...iews/multi-model-dialogue/components/footer-operation.vue
+18
-8
message-list.vue
src/views/multi-model-dialogue/components/message-list.vue
+45
-11
model-dialogue-item.vue
...s/multi-model-dialogue/components/model-dialogue-item.vue
+5
-0
multi-model-dialogue.vue
src/views/multi-model-dialogue/multi-model-dialogue.vue
+4
-2
No files found.
src/views/multi-model-dialogue/components/footer-operation.vue
View file @
d541bf27
...
@@ -29,7 +29,7 @@ const emit = defineEmits<{
...
@@ -29,7 +29,7 @@ const emit = defineEmits<{
addAnswerMessageItem
:
[
messageId
:
string
,
messageItem
:
MessageItemInterface
,
index
:
number
]
addAnswerMessageItem
:
[
messageId
:
string
,
messageItem
:
MessageItemInterface
,
index
:
number
]
updateMessageItem
:
[
messageId
:
string
,
messageItem
:
Partial
<
MessageItemInterface
>
,
index
:
number
]
updateMessageItem
:
[
messageId
:
string
,
messageItem
:
Partial
<
MessageItemInterface
>
,
index
:
number
]
deleteMessageItem
:
[
messageId
:
string
,
index
:
number
]
deleteMessageItem
:
[
messageId
:
string
,
index
:
number
]
messageListScrollToBottom
:
[]
messageListScrollToBottom
:
[
autoScrollBottom
?:
boolean
]
clearAllMessage
:
[]
clearAllMessage
:
[]
}
>
()
}
>
()
...
@@ -69,14 +69,18 @@ const uploadFileIcon = (type: string) => {
...
@@ -69,14 +69,18 @@ const uploadFileIcon = (type: string) => {
return
`https://gsst-poe-sit.gz.bcebos.com/icon/
${
type
}
.svg`
return
`https://gsst-poe-sit.gz.bcebos.com/icon/
${
type
}
.svg`
}
}
const
messageListScrollToBottomThrottle
=
throttle
(()
=>
{
const
messageListScrollToBottomThrottle
=
throttle
(
emit
(
'messageListScrollToBottom'
)
()
=>
{
},
300
)
emit
(
'messageListScrollToBottom'
)
},
50
,
{
leading
:
true
,
trailing
:
true
},
)
watch
(
watch
(
()
=>
uploadImageList
.
value
.
length
,
()
=>
uploadImageList
.
value
.
length
,
()
=>
{
()
=>
{
emit
(
'messageListScrollToBottom'
)
emit
(
'messageListScrollToBottom'
,
true
)
},
},
)
)
...
@@ -123,7 +127,7 @@ function handleQuestionSubmit() {
...
@@ -123,7 +127,7 @@ function handleQuestionSubmit() {
imageUrl
:
uploadImageList
.
value
?.[
0
]?.
url
||
''
,
imageUrl
:
uploadImageList
.
value
?.[
0
]?.
url
||
''
,
})
})
emit
(
'messageListScrollToBottom'
)
emit
(
'messageListScrollToBottom'
,
true
)
multiModelDialogueList
.
value
.
forEach
((
modelItem
,
modelIndex
)
=>
{
multiModelDialogueList
.
value
.
forEach
((
modelItem
,
modelIndex
)
=>
{
const
messages
:
QuestionMessageItem
[]
=
[]
const
messages
:
QuestionMessageItem
[]
=
[]
...
@@ -158,7 +162,10 @@ function handleQuestionSubmit() {
...
@@ -158,7 +162,10 @@ function handleQuestionSubmit() {
{
...
messageItemFactory
(),
role
:
'assistant'
,
isTextContentLoading
:
true
,
isAnswerResponseLoading
:
true
},
{
...
messageItemFactory
(),
role
:
'assistant'
,
isTextContentLoading
:
true
,
isAnswerResponseLoading
:
true
},
modelIndex
,
modelIndex
,
)
)
emit
(
'messageListScrollToBottom'
)
setTimeout
(()
=>
{
emit
(
'messageListScrollToBottom'
,
true
)
},
200
)
modelItem
.
controller
=
new
AbortController
()
modelItem
.
controller
=
new
AbortController
()
...
@@ -234,7 +241,10 @@ function handleQuestionSubmit() {
...
@@ -234,7 +241,10 @@ function handleQuestionSubmit() {
modelItem
.
isAnswerResponseWait
=
false
modelItem
.
isAnswerResponseWait
=
false
userStore
.
fetchUpdateEquityInfo
()
userStore
.
fetchUpdateEquityInfo
()
emit
(
'updateMessageItem'
,
answerMessageId
,
{
isAnswerResponseLoading
:
false
},
modelIndex
)
emit
(
'updateMessageItem'
,
answerMessageId
,
{
isAnswerResponseLoading
:
false
},
modelIndex
)
emit
(
'messageListScrollToBottom'
)
setTimeout
(()
=>
{
emit
(
'messageListScrollToBottom'
)
},
100
)
},
},
})
})
...
...
src/views/multi-model-dialogue/components/message-list.vue
View file @
d541bf27
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
nextTick
,
useTemplateRef
}
from
'vue'
import
{
useTemplateRef
}
from
'vue'
import
{
ScrollbarInst
}
from
'naive-ui'
import
{
ScrollbarInst
}
from
'naive-ui'
import
{
useElementVisibility
}
from
'@vueuse/core'
import
MessageItem
from
'./message-item.vue'
import
MessageItem
from
'./message-item.vue'
import
type
{
MessageItemInterface
}
from
'../types'
import
type
{
MessageItemInterface
}
from
'../types'
...
@@ -14,25 +15,28 @@ const emit = defineEmits<{
...
@@ -14,25 +15,28 @@ const emit = defineEmits<{
showKnowledgeResult
:
[
knowledgeContentResult
:
KnowledgeContentResultItem
[]]
showKnowledgeResult
:
[
knowledgeContentResult
:
KnowledgeContentResultItem
[]]
}
>
()
}
>
()
defineExpose
({
scrollToBottom
,
})
const
scrollbarRef
=
useTemplateRef
<
ScrollbarInst
|
null
>
(
'scrollbarRef'
)
const
scrollbarRef
=
useTemplateRef
<
ScrollbarInst
|
null
>
(
'scrollbarRef'
)
const
backBottomBtnFlagRef
=
useTemplateRef
<
HTMLDivElement
|
null
>
(
'backBottomBtnFlagRef'
)
const
isNotShowBackBottomBtn
=
useElementVisibility
(
backBottomBtnFlagRef
)
function
scrollToBottom
()
{
function
scrollToBottom
()
{
nextTick
(()
=>
{
if
(
scrollbarRef
.
value
)
{
if
(
scrollbarRef
.
value
)
{
scrollbarRef
.
value
.
scrollTo
({
top
:
999999999
,
behavior
:
'smooth'
})
scrollbarRef
.
value
.
scrollTo
({
top
:
999999999
,
behavior
:
'smooth'
})
}
}
})
}
}
defineExpose
({
scrollToBottom
,
isNotShowBackBottomBtn
,
})
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"relative flex-1 overflow-hidden overflow-y-auto py-[20px]"
>
<div
class=
"relative flex-1 overflow-hidden overflow-y-auto py-[20px]"
>
<n-scrollbar
ref=
"scrollbarRef"
class=
"min-h-full"
content-class=
"min-h-full flex"
>
<n-scrollbar
ref=
"scrollbarRef"
class=
"min-h-full"
content-class=
"min-h-full flex"
>
<div
class=
"flex flex-col-reverse overflow-hidden"
>
<div
class=
"
relative
flex flex-col-reverse overflow-hidden"
>
<div
class=
"pr-[10px]"
>
<div
class=
"pr-[10px]"
>
<MessageItem
<MessageItem
v-for=
"[key, messageItem] in messageList"
v-for=
"[key, messageItem] in messageList"
...
@@ -41,7 +45,37 @@ function scrollToBottom() {
...
@@ -41,7 +45,37 @@ function scrollToBottom() {
@
show-knowledge-result=
"emit('showKnowledgeResult', messageItem.knowledgeContentResult)"
@
show-knowledge-result=
"emit('showKnowledgeResult', messageItem.knowledgeContentResult)"
/>
/>
</div>
</div>
<div
ref=
"backBottomBtnFlagRef"
class=
"-z-1 absolute bottom-0 h-[100px] w-full"
></div>
</div>
</div>
</n-scrollbar>
</n-scrollbar>
<Transition
name=
"back-bottom-btn"
mode=
"out-in"
>
<div
v-show=
"!isNotShowBackBottomBtn"
class=
"absolute bottom-[30px] right-[30px] text-end"
style=
"translate: calc(-50% + 30px)"
>
<button
class=
"flex-center flex-center hover:text-theme-color inline-flex h-[26px] w-[26px] rounded-full border bg-white"
@
click
.
stop=
"scrollToBottom"
>
<i
class=
"iconfont icon-huidaodibu text-[12px]"
/>
</button>
</div>
</Transition>
</div>
</div>
</
template
>
</
template
>
<
style
lang=
"scss"
scoped
>
.back-bottom-btn-enter-active
,
.back-bottom-btn-leave-active
{
transition-timing-function
:
ease-in-out
;
transition-duration
:
0
.2s
;
transition-property
:
opacity
;
}
.back-bottom-btn-enter-from
,
.back-bottom-btn-leave-to
{
opacity
:
0
;
}
</
style
>
src/views/multi-model-dialogue/components/model-dialogue-item.vue
View file @
d541bf27
...
@@ -38,8 +38,13 @@ const modelDialogueRef = ref<HTMLElement | null>(null)
...
@@ -38,8 +38,13 @@ const modelDialogueRef = ref<HTMLElement | null>(null)
const
{
height
}
=
useElementSize
(
modelDialogueRef
)
const
{
height
}
=
useElementSize
(
modelDialogueRef
)
const
isNotShowBackBottomBtn
=
computed
(()
=>
{
return
messageListRef
.
value
?.
isNotShowBackBottomBtn
||
false
})
defineExpose
({
defineExpose
({
scrollToBottom
,
scrollToBottom
,
isNotShowBackBottomBtn
,
})
})
const
isShowModelConfigMenu
=
ref
(
false
)
const
isShowModelConfigMenu
=
ref
(
false
)
...
...
src/views/multi-model-dialogue/multi-model-dialogue.vue
View file @
d541bf27
...
@@ -278,14 +278,16 @@ function handleClearAllMessage() {
...
@@ -278,14 +278,16 @@ function handleClearAllMessage() {
}
}
// 滚动页面
// 滚动页面
function
handleMessageListScrollToBottom
()
{
function
handleMessageListScrollToBottom
(
autoScrollBottom
?:
boolean
)
{
if
(
modelDialogueListRef
.
value
)
{
if
(
modelDialogueListRef
.
value
)
{
modelDialogueListRef
.
value
.
forEach
((
modelDialogueItemRef
,
index
)
=>
{
modelDialogueListRef
.
value
.
forEach
((
modelDialogueItemRef
,
index
)
=>
{
if
(
!
multiModelDialogueList
.
value
?.[
index
]?.
isAnswerResponseWait
)
{
if
(
!
multiModelDialogueList
.
value
?.[
index
]?.
isAnswerResponseWait
)
{
return
return
}
}
modelDialogueItemRef
?.
scrollToBottom
&&
modelDialogueItemRef
.
scrollToBottom
()
if
(
modelDialogueItemRef
?.
scrollToBottom
&&
(
modelDialogueItemRef
?.
isNotShowBackBottomBtn
||
autoScrollBottom
))
{
modelDialogueItemRef
.
scrollToBottom
()
}
})
})
}
}
}
}
...
...
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