解决流式输出的时候input不能输入的问题

main
Phoenix 5 months ago
parent cdafe30d33
commit 73a46b08dc

@ -93,7 +93,9 @@ function handleSubmit() {
} }
} */ } */
watch(prompt,()=>{
console.log(prompt.value,'prompt.value')
})
const API_URL = `${import.meta.env.VITE_APP_API_BASE_URL}/chat/completion`; const API_URL = `${import.meta.env.VITE_APP_API_BASE_URL}/chat/completion`;
const createParams = () => { const createParams = () => {
const messages = dataSources.value.map((x) => { const messages = dataSources.value.map((x) => {
@ -425,6 +427,7 @@ watch(dataSources,()=>{
loading.value=false loading.value=false
scrollToBottom('auto') scrollToBottom('auto')
}) })
const inputKey=ref(1)
const customRequest = async (file) => { const customRequest = async (file) => {
console.log(file,'file') console.log(file,'file')
const res = await uploadImg({ const res = await uploadImg({
@ -469,7 +472,7 @@ const customRequest = async (file) => {
</div> </div>
</transition> </transition>
<div id="scrollRef" ref="scrollRef" class="h-full overflow-hidden overflow-y-auto"> <div id="scrollRef" ref="scrollRef" class="h-full overflow-hidden overflow-y-auto">
<div <div
id="image-wrapper" id="image-wrapper"
class="w-full max-w-screen-xl m-auto dark:bg-[#101014]" class="w-full max-w-screen-xl m-auto dark:bg-[#101014]"
@ -485,8 +488,9 @@ const customRequest = async (file) => {
<template v-else> <template v-else>
<div> <div>
<Message <Message
v-for="(item, index) of dataSources" v-for="(item, index) of dataSources"
:key="index" :key="item.dateTime"
:date-time="item.dateTime" :date-time="item.dateTime"
:text="item.text" :text="item.text"
:fileList="item.fileList" :fileList="item.fileList"
@ -615,17 +619,21 @@ const customRequest = async (file) => {
@keypress="handleEnter" @keypress="handleEnter"
/> --> /> -->
<NInput <NInput
style="width:75%" v-memo="[prompt]"
ref="inputRef" style="width:75%"
v-model:value="prompt" :key="inputKey"
type="textarea" ref="inputRef"
size="large" v-model:value="prompt"
:placeholder="placeholder" type="textarea"
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }" size="large"
@keypress="handleEnter" :placeholder="placeholder"
> :autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
</NInput> @keypress="handleEnter"
>
</NInput>
<NButton color="#8a2be2" type="primary" size="large" :disabled="buttonDisabled" @click="handleSubmit"> <NButton color="#8a2be2" type="primary" size="large" :disabled="buttonDisabled" @click="handleSubmit">
<template #icon> <template #icon>
<span class="dark:text-black" v-if="!loading"> <span class="dark:text-black" v-if="!loading">

Loading…
Cancel
Save