Compare commits

...

6 Commits
app ... main

Author SHA1 Message Date
Phoenix
8abb0439f6 123 2024-05-22 11:26:44 +08:00
Phoenix
50501a73cd 解决流式输出的时候input不能输入的问题 2024-04-16 10:46:08 +08:00
Phoenix
73a46b08dc 解决流式输出的时候input不能输入的问题 2024-04-16 10:44:53 +08:00
Phoenix
cdafe30d33 s 2024-03-05 16:19:33 +08:00
Phoenix
2e0cb8a084 s 2024-03-05 10:44:01 +08:00
Phoenix
ef0d0af2e4 s 2024-03-04 14:05:54 +08:00
8 changed files with 40 additions and 27 deletions

View File

@ -12,6 +12,7 @@
], ],
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"prod": "vite --mode prod",
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"build-prod": "vite build --mode prod", "build-prod": "vite build --mode prod",

View File

@ -17,11 +17,11 @@ import {Local} from './utils/storage/storage.js'
} *!/ */ } *!/ */
const themeOverrides = { const themeOverrides = {
common: { common: {
primaryColorHover:'#764CF6', primaryColorHover:Local.get('setting-info')?.themeColor?.split("@")?.[1]??'#764CF6',
primaryColor:'#764CF6' primaryColor:Local.get('setting-info')?.themeColor?.split("@")?.[1]??'#764CF6',
}, },
Button: { Button: {
textColor: '#764CF6' textColor: Local.get('setting-info')?.themeColor?.split("@")?.[1]??'#764CF6',
} }
} }
</script> </script>

View File

@ -11,6 +11,7 @@ const currentListUuid=ref('')
const isStop = ref(false); const isStop = ref(false);
const isGPT4 = ref(false); const isGPT4 = ref(false);
const loading=ref(false) const loading=ref(false)
const show=ref(false)
const getDataList = async () => { const getDataList = async () => {
const data = { const data = {
page: 1, page: 1,
@ -18,7 +19,7 @@ const currentListUuid=ref('')
} }
const res=await getSessionList(data) const res=await getSessionList(data)
if (res.code===0){ if (res.code===0){
dataList.value=res.data.data dataList.value=res.data.data??[]
} }
} }
const detailData=ref([]) const detailData=ref([])
@ -45,7 +46,7 @@ const currentListUuid=ref('')
conversationOpt:null, conversationOpt:null,
} }
}) })
detailData.value=res.data detailData.value=res.data??[]
} }
} }
const createSessionStore=async ()=>{ const createSessionStore=async ()=>{
@ -64,5 +65,5 @@ const currentListUuid=ref('')
//getDataList() //getDataList()
} }
} }
return { sessionDetail,currentListUuid ,gptMode,getDataList,dataList,getSessionDetail,createSessionStore,deleteSession,isStop,isGPT4,loading}; return {show, sessionDetail,currentListUuid ,gptMode,getDataList,dataList,getSessionDetail,createSessionStore,deleteSession,isStop,isGPT4,loading};
}); });

View File

@ -4,7 +4,7 @@ import { ElLoading } from 'element-plus'
import {Local} from '@/utils/storage/storage.js' import {Local} from '@/utils/storage/storage.js'
const request = axios.create({ const request = axios.create({
baseURL:import.meta.env.VITE_APP_API_BASE_URL, baseURL:import.meta.env.VITE_APP_API_BASE_URL,
timeout:5000 timeout:60000
}); });
let loading let loading
request.interceptors.request.use((config)=>{ request.interceptors.request.use((config)=>{

View File

@ -1,16 +1,12 @@
<script setup> <script setup>
import {ref} from 'vue' import {ref} from 'vue'
import { NAvatar } from 'naive-ui' import { NAvatar } from 'naive-ui'
const defaultAvatar=ref(JSON.parse(localStorage.getItem('userInfo')).Avatar) const defaultAvatar=ref(JSON.parse(localStorage.getItem('userInfo')).Avatar)
defineProps({ defineProps({
image: Boolean image: Boolean
}) })
</script> </script>
<template> <template>
<template v-if="image"> <template v-if="image">
<NAvatar :src="defaultAvatar" :fallback-src="defaultAvatar" /> <NAvatar :src="defaultAvatar" :fallback-src="defaultAvatar" />

View File

@ -93,7 +93,6 @@ function handleSubmit() {
} }
} */ } */
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) => {
@ -336,7 +335,7 @@ const footerClass = computed(() => {
const isShowBottom=ref(false) const isShowBottom=ref(false)
onMounted(() => { onMounted(() => {
scrollRef.value.addEventListener('scroll', function() { scrollRef.value.addEventListener('scroll', function() {
if (scrollRef.value.scrollTop + scrollRef.value.clientHeight +100>= scrollRef.value.scrollHeight) { if (scrollRef.value.scrollTop + scrollRef.value.clientHeight>= scrollRef.value.scrollHeight) {
isShowBottom.value=false isShowBottom.value=false
}else { }else {
isShowBottom.value=true isShowBottom.value=true
@ -425,6 +424,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({
@ -486,7 +486,7 @@ const customRequest = async (file) => {
<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"
@ -616,7 +616,9 @@ const customRequest = async (file) => {
/> --> /> -->
<NInput <NInput
v-memo="[prompt]"
style="width:75%" style="width:75%"
:key="inputKey"
ref="inputRef" ref="inputRef"
v-model:value="prompt" v-model:value="prompt"
type="textarea" type="textarea"
@ -626,6 +628,8 @@ const customRequest = async (file) => {
@keypress="handleEnter" @keypress="handleEnter"
> >
</NInput> </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">

View File

@ -81,7 +81,7 @@ const options = () => {
}, },
{ {
label: 'GPT-4.0', label: 'GPT-4.0',
value: 'gpt-4-1106-preview', value: 'gpt-4o',
permission: 'gpt-4-btn' permission: 'gpt-4-btn'
}, },
{ {

11
src/views/chat/test.vue Normal file
View File

@ -0,0 +1,11 @@
<script setup lang="ts">
</script>
<template>
</template>
<style scoped>
</style>