fix: empty session page

This commit is contained in:
2024-04-08 17:11:20 +08:00
parent 671755fa0d
commit 9c8c15bdfd
2 changed files with 17 additions and 2 deletions

View File

@@ -4,7 +4,13 @@ import {useLazyAsyncData} from '#app'
const loginState = useLoginState() const loginState = useLoginState()
const props = defineProps() const props = defineProps({
nonBack: {
type: Boolean,
default: false,
},
})
// noinspection JSUnusedLocalSymbols
const emit = defineEmits({ const emit = defineEmits({
select: (assistant: Assistant | null) => true, select: (assistant: Assistant | null) => true,
cancel: () => true, cancel: () => true,
@@ -58,6 +64,7 @@ const {
</Transition> </Transition>
<div class="w-full p-2"> <div class="w-full p-2">
<UButton <UButton
v-if="!nonBack"
variant="ghost" variant="ghost"
size="xs" size="xs"
@click="emit('cancel')" @click="emit('cancel')"
@@ -123,6 +130,7 @@ const {
</div> </div>
</template> </template>
<!--suppress CssUnusedSymbol -->
<style scoped> <style scoped>
.loading-screen-leave-active { .loading-screen-leave-active {
@apply transition duration-300; @apply transition duration-300;

View File

@@ -265,6 +265,12 @@ onMounted(() => {
<!-- ClientOnly avoids hydrate exception --> <!-- ClientOnly avoids hydrate exception -->
<ClientOnly> <ClientOnly>
<TransitionGroup name="chat-item"> <TransitionGroup name="chat-item">
<div v-if="chatSessions.length === 0">
<div class="text-center text-neutral-400 dark:text-neutral-500 py-4 flex flex-col items-center gap-2">
<Icon name="i-tabler-messages" class="text-2xl" />
<span>没有会话</span>
</div>
</div>
<ChatItem <ChatItem
v-for="session in chatSessions" v-for="session in chatSessions"
:chat-session="session" :key="session.id" :chat-session="session" :key="session.id"
@@ -297,7 +303,8 @@ onMounted(() => {
<Transition name="message" mode="out-in"> <Transition name="message" mode="out-in">
<NewSessionScreen <NewSessionScreen
v-if="modals.newSessionScreen" v-if="modals.newSessionScreen || getSessionCopyById(currentSessionId!) === undefined"
:non-back="getSessionCopyById(currentSessionId!) === undefined"
@select="createSession" @select="createSession"
@cancel="modals.newSessionScreen = false" @cancel="modals.newSessionScreen = false"
/> />