细节优化

main
Phoenix 7 months ago
parent 7e1a207810
commit c41d8cd625

2848
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -56,6 +56,7 @@
"@types/markdown-it": "^12.2.3", "@types/markdown-it": "^12.2.3",
"@types/markdown-it-link-attributes": "^3.0.1", "@types/markdown-it-link-attributes": "^3.0.1",
"@types/node": "^18.14.6", "@types/node": "^18.14.6",
"@vicons/ionicons5": "^0.12.0",
"@vitejs/plugin-vue": "^4.0.0", "@vitejs/plugin-vue": "^4.0.0",
"autoprefixer": "^10.4.13", "autoprefixer": "^10.4.13",
"axios": "^1.3.4", "axios": "^1.3.4",

@ -61,7 +61,7 @@ const currentListUuid=ref('')
const deleteSession =async () => { const deleteSession =async () => {
const res=await postRequest('/chat/del', {listUuid:currentListUuid.value}) const res=await postRequest('/chat/del', {listUuid:currentListUuid.value})
if (res.code === 0) { if (res.code === 0) {
getDataList() //getDataList()
} }
} }
return { sessionDetail,currentListUuid ,gptMode,getDataList,dataList,getSessionDetail,createSessionStore,deleteSession,isStop,isGPT4,loading}; return { sessionDetail,currentListUuid ,gptMode,getDataList,dataList,getSessionDetail,createSessionStore,deleteSession,isStop,isGPT4,loading};

@ -4,11 +4,12 @@ import {Local} from "@/utils/storage/storage";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {computed, onMounted, onUnmounted, ref, watch} from 'vue' import {computed, onMounted, onUnmounted, ref, watch} from 'vue'
import {useRoute} from 'vue-router' import {useRoute} from 'vue-router'
import {NAutoComplete, NButton, NInput, useDialog, useMessage, NBackTop} from 'naive-ui' import {NAutoComplete, NButton, NInput, useDialog, useMessage, NBackTop,NIcon} from 'naive-ui'
import {AreaChartOutlined, PlusOutlined} from '@ant-design/icons-vue'; import {AreaChartOutlined, PlusOutlined} from '@ant-design/icons-vue';
import html2canvas from 'html2canvas' import html2canvas from 'html2canvas'
import {Message} from './components' import {Message} from './components'
import {useScroll} from './hooks/useScroll' import {useScroll} from './hooks/useScroll'
import { FlashOutline } from '@vicons/ionicons5'
import {useChat} from './hooks/useChat' import {useChat} from './hooks/useChat'
import {useUsingContext} from './hooks/useUsingContext' import {useUsingContext} from './hooks/useUsingContext'
import HeaderComponent from './components/Header/index.vue' import HeaderComponent from './components/Header/index.vue'
@ -71,6 +72,7 @@ function handleSubmit() {
if (loading.value){ if (loading.value){
handleStop() handleStop()
}else { }else {
loading.value = true
dataSources.value.push({ dataSources.value.push({
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'), dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
text: prompt.value?.trim(), text: prompt.value?.trim(),
@ -512,7 +514,7 @@ const customRequest = async (file) => {
</main> </main>
<footer :class="footerClass"> <footer :class="footerClass">
<div class="w-full max-w-screen-xl m-auto"> <div class="w-full max-w-screen-xl m-auto">
<div class="flex items-center justify-between space-x-2" style="flex-wrap: initial"> <div class="flex items-center justify-center space-x-2" style="flex-wrap: initial">
<a-popover :open="visible1" trigger="click"> <a-popover :open="visible1" trigger="click">
<template #content> <template #content>
<div class="clearfix"> <div class="clearfix">
@ -570,32 +572,47 @@ const customRequest = async (file) => {
<SvgIcon icon="ri:delete-bin-line" /> <SvgIcon icon="ri:delete-bin-line" />
</span> </span>
</HoverButton>--> </HoverButton>-->
<HoverButton v-if="!isMobile" @click="handleExport"> <!-- <HoverButton v-if="!isMobile" @click="handleExport">
<span class="text-xl text-[#4f555e] dark:text-white"> <span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ri:download-2-line"/> <SvgIcon icon="ri:download-2-line"/>
</span> </span>
</HoverButton> </HoverButton>-->
<!-- <HoverButton @click="toggleUsingContext"> <!-- <HoverButton @click="toggleUsingContext">
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }"> <span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
<SvgIcon icon="ri:chat-history-line" /> <SvgIcon icon="ri:chat-history-line" />
</span> </span>
</HoverButton>--> </HoverButton>-->
<NAutoComplete v-model:value="prompt" :options="searchOptions" :render-label="renderOption"> <!-- <NAutoComplete v-model:value="prompt" :options="searchOptions" :render-label="renderOption">
<template #default="{ handleInput, handleBlur, handleFocus }"> <template #default="{ handleInput, handleBlur, handleFocus }">
<NInput
</template>
</NAutoComplete>-->
<!-- <NInput
ref="inputRef" ref="inputRef"
v-model:value="prompt" v-model:value="prompt"
type="textarea" type="textarea"
size="large"
:placeholder="placeholder" :placeholder="placeholder"
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }" :autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
@input="handleInput" @input="handleInput"
@focus="handleFocus" @focus="handleFocus"
@blur="handleBlur" @blur="handleBlur"
@keypress="handleEnter" @keypress="handleEnter"
/> /> -->
</template> <NInput
</NAutoComplete> style="width:75%"
<NButton color="#8a2be2" type="primary" :disabled="buttonDisabled" @click="handleSubmit"> ref="inputRef"
v-model:value="prompt"
type="textarea"
size="large"
:placeholder="placeholder"
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
@keypress="handleEnter"
>
</NInput>
<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">
<SvgIcon icon="ri:send-plane-fill"/> <SvgIcon icon="ri:send-plane-fill"/>

@ -1,8 +1,8 @@
<script setup > <script setup >
import {storeToRefs} from "pinia"; import {storeToRefs} from "pinia";
import {computed, ref} from 'vue' import {computed, ref,nextTick} from 'vue'
import dayjs from "dayjs"; import dayjs from "dayjs";
import { NInput, NPopconfirm, NScrollbar } from 'naive-ui' import { NInput, NPopconfirm, NScrollbar,NButton } from 'naive-ui'
import { SvgIcon } from '@/components/common' import { SvgIcon } from '@/components/common'
import { useAppStore, useChatStore } from '@/store' import { useAppStore, useChatStore } from '@/store'
import { useBasicLayout } from '@/hooks/useBasicLayout' import { useBasicLayout } from '@/hooks/useBasicLayout'
@ -26,9 +26,16 @@ function handleEdit({ listUuid }) {
}) })
item.isEdit=true item.isEdit=true
} }
const handleDeleteDebounce = ()=>{ const handleDeleteDebounce = (item)=>{
sessionDetailData.deleteSession() show.value=false
setTimeout(async ()=>{
await sessionDetailData.deleteSession()
const index= dataList.value.findIndex((x) => x.listUuid === item.listUuid)
if (index!==-1){
dataList.value.splice(index, 1)
}
sessionDetail.value=[] sessionDetail.value=[]
},200)
} }
function handleEnter({ listUuid }, isEdit, event) { function handleEnter({ listUuid }, isEdit, event) {
event?.stopPropagation() event?.stopPropagation()
@ -38,12 +45,12 @@ function handleEnter({ listUuid }, isEdit, event) {
function isActive(listUuid) { function isActive(listUuid) {
return currentListUuid.value === listUuid return currentListUuid.value === listUuid
} }
const show=ref(false)
</script> </script>
<template> <template>
<NScrollbar class="px-4"> <NScrollbar class="px-4">
<div class="flex flex-col gap-2 text-sm"> <div class="flex flex-col gap-2 text-sm mb-1">
<template v-if="!dataList.length"> <template v-if="!dataList.length">
<div class="flex flex-col items-center mt-4 text-center text-neutral-300"> <div class="flex flex-col items-center mt-4 text-center text-neutral-300">
<SvgIcon icon="ri:inbox-line" class="mb-2 text-3xl" /> <SvgIcon icon="ri:inbox-line" class="mb-2 text-3xl" />
@ -75,16 +82,21 @@ function isActive(listUuid) {
</button> </button>
</template> </template>
<template v-else> <template v-else>
<!-- <button class="p-1">
<SvgIcon icon="ri:edit-line" @click.stop="handleEdit(item, true, $event)" />
</button>-->
<NPopconfirm placement="bottom" @positive-click.stop="handleDeleteDebounce(index, $event)"> <NPopconfirm v-model:show="show">
<template #trigger> <template #trigger>
<button class="p-1"> <button class="p-1">
<SvgIcon icon="ri:delete-bin-line" /> <SvgIcon icon="ri:delete-bin-line" />
</button> </button>
</template> </template>
<template #action>
<NButton size="small" @click="show = false">
取消
</NButton>
<NButton size="small" type="primary" @click="handleDeleteDebounce(item)">
确认
</NButton>
</template>
是否删除此记录 是否删除此记录
</NPopconfirm> </NPopconfirm>
</template> </template>

@ -136,7 +136,7 @@ watch(
<n-select v-model:value="gptMode" :options="options()"/> <n-select v-model:value="gptMode" :options="options()"/>
</div> </div>
</div> </div>
<div class="flex-1 min-h-0 pb-4 overflow-hidden"> <div class="flex-1 min-h-0 pb-3 overflow-hidden">
<List/> <List/>
</div> </div>
<!-- <div class="flex items-center p-4 space-x-4"> <!-- <div class="flex items-center p-4 space-x-4">

Loading…
Cancel
Save