logged out chat modal, call to action
This commit is contained in:
@@ -5,15 +5,9 @@ import ChatInterface from '~/app/chat/_components/ChatInterface'
|
||||
import { useMessages } from '~/app/_providers/MessagesProvider';
|
||||
import { Spinner } from '~/components/ui/spinner';
|
||||
|
||||
type DBMessage = {
|
||||
id: string
|
||||
role: 'user' | 'assistant'
|
||||
content: string
|
||||
}
|
||||
|
||||
export default function ChatModal() {
|
||||
const router = useRouter()
|
||||
const {messages,session,clearChat,clearingChat,isLoading,error,refetchMessages} = useMessages()
|
||||
const {messages,session,isLoading,error} = useMessages()
|
||||
return (
|
||||
<Dialog modal={true} open onOpenChange={() => router.back()}>
|
||||
<DialogContent className="w-full max-w-full rounded-none sm:max-w-full h-[100svh] lg:max-w-3xl lg:rounded-xl lg:h-[80vh] flex flex-col p-0 gap-0">
|
||||
@@ -21,8 +15,8 @@ export default function ChatModal() {
|
||||
<DialogTitle>Talk To My AI-Assistant</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="flex-1 overflow-hidden min-h-0">
|
||||
{messages && session?.id &&
|
||||
<ChatInterface sessionId={session.id} dbMessages={messages}/>
|
||||
{!isLoading &&
|
||||
<ChatInterface sessionId={session?.id} dbMessages={messages ?? []}/>
|
||||
}
|
||||
{isLoading &&
|
||||
<><Spinner/> Loading Messages...</>
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
'use client'
|
||||
import { Skeleton } from '~/components/ui/skeleton';
|
||||
import ChatModal from './_components/ChatModal'
|
||||
import { trpc } from '~/app/_trpc/Client'
|
||||
import { useTimeLine } from '~/app/_providers/GsapProvicer';
|
||||
|
||||
export default function AssistantModalPage() {
|
||||
const { data: session, error, isLoading } = trpc.chat.getSession.useQuery();
|
||||
return (
|
||||
<>
|
||||
<ChatModal/>
|
||||
{error && <div>{error.message}</div>}
|
||||
{isLoading && <Skeleton />}
|
||||
</>
|
||||
<ChatModal/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user