feat: chat login
This commit is contained in:
@@ -10,10 +10,10 @@ import {
|
||||
llmModels,
|
||||
type ModelTag,
|
||||
} from '~/typings/llm'
|
||||
import {useHistory} from '~/composables/useHistory'
|
||||
import {uuidv4} from '@uniiem/uuid'
|
||||
import {useLLM} from '~/composables/useLLM'
|
||||
import {trimObject} from '@uniiem/object-trim'
|
||||
import { useHistory } from '~/composables/useHistory'
|
||||
import { uuidv4 } from '@uniiem/uuid'
|
||||
import { useLLM } from '~/composables/useLLM'
|
||||
import { trimObject } from '@uniiem/object-trim'
|
||||
import ModalAuthentication from '~/components/ModalAuthentication.vue'
|
||||
import NewSessionScreen from '~/components/aigc/chat/NewSessionScreen.vue'
|
||||
|
||||
@@ -26,8 +26,8 @@ const toast = useToast()
|
||||
const modal = useModal()
|
||||
const loginState = useLoginState()
|
||||
const historyStore = useHistory()
|
||||
const {chatSessions} = storeToRefs(historyStore)
|
||||
const {setChatSessions} = historyStore
|
||||
const { chatSessions } = storeToRefs(historyStore)
|
||||
const { setChatSessions } = historyStore
|
||||
|
||||
const currentSessionId = ref<ChatSessionId | null>(null)
|
||||
const messagesWrapperRef = ref<HTMLDivElement | null>(null)
|
||||
@@ -123,7 +123,7 @@ const createSession = (assistant: Assistant | null) => {
|
||||
insetMessage({
|
||||
id: uuidv4(),
|
||||
role: 'user',
|
||||
content: `${currentAssistant.value?.target},${currentAssistant.value?.demand}`,
|
||||
content: `${ currentAssistant.value?.target },${ currentAssistant.value?.demand }`,
|
||||
preset: true,
|
||||
})
|
||||
insetMessage({
|
||||
@@ -267,7 +267,7 @@ onMounted(() => {
|
||||
<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" />
|
||||
<Icon name="i-tabler-messages" class="text-2xl"/>
|
||||
<span>没有会话</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -302,8 +302,18 @@ onMounted(() => {
|
||||
<div class="h-[calc(100vh-4rem)] flex-1 bg-white dark:bg-neutral-900">
|
||||
|
||||
<Transition name="message" mode="out-in">
|
||||
<div v-if="!loginState.is_logged_in" class="w-full h-full">
|
||||
<div class="w-full h-full flex flex-col justify-center items-center gap-2 bg-neutral-100 dark:bg-neutral-900">
|
||||
<Icon name="i-tabler-user-circle" class="text-7xl text-neutral-300 dark:text-neutral-700"/>
|
||||
<p class="text-sm text-neutral-500 dark:text-neutral-400">请登录后使用</p>
|
||||
<UButton class="mt-2 font-bold" color="black" variant="solid" size="xs"
|
||||
@click="modal.open(ModalAuthentication)">
|
||||
登录
|
||||
</UButton>
|
||||
</div>
|
||||
</div>
|
||||
<NewSessionScreen
|
||||
v-if="modals.newSessionScreen || getSessionCopyById(currentSessionId!) === undefined"
|
||||
v-else-if="modals.newSessionScreen || getSessionCopyById(currentSessionId!) === undefined"
|
||||
:non-back="!getSessionCopyById(currentSessionId!)"
|
||||
@select="createSession"
|
||||
@cancel="modals.newSessionScreen = false"
|
||||
|
||||
Reference in New Issue
Block a user