| | |
| | | import img2 from '@/assets/images/u69.png' |
| | | import img3 from '@/assets/images/u74.png'; |
| | | import AddSession from './components/addSession.vue' |
| | | import { ref, onMounted, computed, reactive, nextTick } from 'vue'; |
| | | import { ref, onMounted, computed, reactive, nextTick,watch } from 'vue'; |
| | | import { useUserStore,useAppStore } from '@/store'; |
| | | import { sessionListApi, deleteSessionApi,getSessionDetailsApi,chatApi }from '@/api/session'; |
| | | import { Message } from '@arco-design/web-vue'; |
| | |
| | | sessionDetailList.value=res.data.message.map((item,index)=>{ |
| | | if(index===res.data.message.length-1){ |
| | | item.role='last'; |
| | | displayedText.value=''; |
| | | currIndex.value=0; |
| | | streamStr.value=item.content; |
| | | startDisplayStr(); |
| | | } |
| | |
| | | onMounted(()=>{ |
| | | initData(); |
| | | }); |
| | | //文字一个一个输出 |
| | | //文字动态输出 |
| | | const startDisplayStr = () => { |
| | | if (timer) { |
| | | clearTimeout(timer!); |
| | |
| | | timer = null |
| | | } |
| | | } |
| | | |
| | | watch(() => scrollbar.value, (newScroll, oldScroll) => { |
| | | if (newScroll) { |
| | | // 获取a-scroll的高度 |
| | | const height = newScroll.$el.offsetHeight; |
| | | console.log('a-scroll height changed to:', height); |
| | | } |
| | | },{deep:true}) |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | avatar="https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/9eeb1800d9b78349b24682c3518ac4a3.png~tplv-uwbnlip3yd-webp.webp" |
| | | > |
| | | <template #content> |
| | | <a-card class="chat-item-answer" style="background-color: rgba(63, 64, 79, 1);"> |
| | | <div :class="{light:theme==='light'}"> {{displayedText}}</div> |
| | | </a-card> |
| | | <a-textarea readonly auto-size v-model="displayedText" class="chat-item-answer" style="background-color: rgba(63, 64, 79, 1);"> |
| | | </a-textarea> |
| | | </template> |
| | | </a-comment> |
| | | </div> |
| | | </a-scrollbar> |
| | | <div class="bottom"> |
| | | <div class="input"> |
| | | <a-input v-model="inputMsg"> |
| | | <a-input v-model="inputMsg" @keydown.enter="sendMessage"> |
| | | <template #suffix> |
| | | <icon-send style="cursor: pointer" @click="sendMessage"/> |
| | | </template> |