feat: 聊天页面未登录提示

This commit is contained in:
2024-04-03 16:04:26 +08:00
parent e02b0ffcc6
commit 200891c199

View File

@@ -13,6 +13,7 @@ import {useHistory} from "~/composables/useHistory";
import {uuidv4} from "@uniiem/uuid"; import {uuidv4} from "@uniiem/uuid";
import {useLLM} from "~/composables/useLLM"; import {useLLM} from "~/composables/useLLM";
import {trimObject} from "@uniiem/object-trim"; import {trimObject} from "@uniiem/object-trim";
import ModalAuthentication from "~/components/ModalAuthentication.vue";
useHead({ useHead({
title: '聊天 | XSH AI' title: '聊天 | XSH AI'
@@ -20,6 +21,8 @@ useHead({
const dayjs = useDayjs() const dayjs = useDayjs()
const toast = useToast() const toast = useToast()
const modal = useModal()
const loginState = useLoginState()
const historyStore = useHistory() const historyStore = useHistory()
const {chatSessions} = storeToRefs(historyStore) const {chatSessions} = storeToRefs(historyStore)
const {setChatSessions} = historyStore const {setChatSessions} = historyStore
@@ -107,6 +110,10 @@ const handleClickCreateSession = () => {
* @param event * @param event
*/ */
const handleClickSend = (event: any) => { const handleClickSend = (event: any) => {
if (!loginState.is_logged_in) {
modal.open(ModalAuthentication)
return;
}
if (event.ctrlKey) { if (event.ctrlKey) {
return; return;
} }
@@ -299,7 +306,7 @@ onMounted(() => {
</div> </div>
<!-- Modals --> <!-- Modals -->
<UModal v-model="modals.modelSelect"> <UModal prevent-close v-model="modals.modelSelect">
<UCard> <UCard>
<template #header> <template #header>
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white"> <h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">