细节优化

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-link-attributes": "^3.0.1",
"@types/node": "^18.14.6",
"@vicons/ionicons5": "^0.12.0",
"@vitejs/plugin-vue": "^4.0.0",
"autoprefixer": "^10.4.13",
"axios": "^1.3.4",

@ -61,7 +61,7 @@ const currentListUuid=ref('')
const deleteSession =async () => {
const res=await postRequest('/chat/del', {listUuid:currentListUuid.value})
if (res.code === 0) {
getDataList()
//getDataList()
}
}
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 {computed, onMounted, onUnmounted, ref, watch} from 'vue'
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 html2canvas from 'html2canvas'
import {Message} from './components'
import {useScroll} from './hooks/useScroll'
import { FlashOutline } from '@vicons/ionicons5'
import {useChat} from './hooks/useChat'
import {useUsingContext} from './hooks/useUsingContext'
import HeaderComponent from './components/Header/index.vue'
@ -71,6 +72,7 @@ function handleSubmit() {
if (loading.value){
handleStop()
}else {
loading.value = true
dataSources.value.push({
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
text: prompt.value?.trim(),
@ -512,7 +514,7 @@ const customRequest = async (file) => {
</main>
<footer :class="footerClass">
<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">
<template #content>
<div class="clearfix">
@ -570,32 +572,47 @@ const customRequest = async (file) => {
<SvgIcon icon="ri:delete-bin-line" />
</span>
</HoverButton>-->
<HoverButton v-if="!isMobile" @click="handleExport">
<!-- <HoverButton v-if="!isMobile" @click="handleExport">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ri:download-2-line"/>
</span>
</HoverButton>
</HoverButton>-->
<!-- <HoverButton @click="toggleUsingContext">
<span class="text-xl" :class="{ 'text-[#4b9e5f]': usingContext, 'text-[#a8071a]': !usingContext }">
<SvgIcon icon="ri:chat-history-line" />
</span>
</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 }">
<NInput
</template>
</NAutoComplete>-->
<!-- <NInput
ref="inputRef"
v-model:value="prompt"
type="textarea"
size="large"
:placeholder="placeholder"
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 8 }"
@input="handleInput"
@focus="handleFocus"
@blur="handleBlur"
@keypress="handleEnter"
/>
</template>
</NAutoComplete>
<NButton color="#8a2be2" type="primary" :disabled="buttonDisabled" @click="handleSubmit">
/> -->
<NInput
style="width:75%"
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>
<span class="dark:text-black" v-if="!loading">
<SvgIcon icon="ri:send-plane-fill"/>

@ -1,8 +1,8 @@
<script setup >
import {storeToRefs} from "pinia";
import {computed, ref} from 'vue'
import {computed, ref,nextTick} from 'vue'
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 { useAppStore, useChatStore } from '@/store'
import { useBasicLayout } from '@/hooks/useBasicLayout'
@ -26,9 +26,16 @@ function handleEdit({ listUuid }) {
})
item.isEdit=true
}
const handleDeleteDebounce = ()=>{
sessionDetailData.deleteSession()
const handleDeleteDebounce = (item)=>{
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=[]
},200)
}
function handleEnter({ listUuid }, isEdit, event) {
event?.stopPropagation()
@ -38,12 +45,12 @@ function handleEnter({ listUuid }, isEdit, event) {
function isActive(listUuid) {
return currentListUuid.value === listUuid
}
const show=ref(false)
</script>
<template>
<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">
<div class="flex flex-col items-center mt-4 text-center text-neutral-300">
<SvgIcon icon="ri:inbox-line" class="mb-2 text-3xl" />
@ -75,16 +82,21 @@ function isActive(listUuid) {
</button>
</template>
<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>
<button class="p-1">
<SvgIcon icon="ri:delete-bin-line" />
</button>
</template>
<template #action>
<NButton size="small" @click="show = false">
取消
</NButton>
<NButton size="small" type="primary" @click="handleDeleteDebounce(item)">
确认
</NButton>
</template>
是否删除此记录
</NPopconfirm>
</template>

@ -136,7 +136,7 @@ watch(
<n-select v-model:value="gptMode" :options="options()"/>
</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/>
</div>
<!-- <div class="flex items-center p-4 space-x-4">

Loading…
Cancel
Save