【优化】AI chat 发送按钮独立方法
This commit is contained in:
parent
32c6818ee8
commit
a431867f41
@ -56,7 +56,7 @@
|
|||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="default"
|
size="default"
|
||||||
@click="onSend"
|
@click="onSendBtn"
|
||||||
:loading="conversationInProgress"
|
:loading="conversationInProgress"
|
||||||
v-if="conversationInProgress == false"
|
v-if="conversationInProgress == false"
|
||||||
>
|
>
|
||||||
@ -254,6 +254,10 @@ const onSend = async (event) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onSendBtn = async () => {
|
||||||
|
await doSend(prompt.value?.trim() as string)
|
||||||
|
}
|
||||||
|
|
||||||
const doSend = async (content: string) => {
|
const doSend = async (content: string) => {
|
||||||
if (content.length < 2) {
|
if (content.length < 2) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
@ -303,6 +307,10 @@ const doSendStream = async (userMessage: ChatMessageVO) => {
|
|||||||
content: '思考中...',
|
content: '思考中...',
|
||||||
createTime: new Date()
|
createTime: new Date()
|
||||||
} as ChatMessageVO)
|
} as ChatMessageVO)
|
||||||
|
// 滚动到最下面
|
||||||
|
nextTick(async () => {
|
||||||
|
await scrollToBottom()
|
||||||
|
})
|
||||||
// 开始滚动
|
// 开始滚动
|
||||||
textRoll()
|
textRoll()
|
||||||
// 发送 event stream
|
// 发送 event stream
|
||||||
|
Loading…
Reference in New Issue
Block a user