Update examples and improve stability (#271)

This commit is contained in:
Jeremy 2024-03-19 01:35:03 +03:00 committed by GitHub
parent 25e4128e25
commit 70ed5c4f47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 118 additions and 101 deletions

View file

@ -1,17 +1,37 @@
import { Separator } from '@/components/ui/separator'
import { UIState } from '@/lib/chat/actions'
import { Session } from '@/lib/types'
import Link from 'next/link'
export interface ChatList {
messages: UIState
session?: Session
isShared: boolean
}
export function ChatList({ messages }: ChatList) {
export function ChatList({ messages, session, isShared }: ChatList) {
if (!messages.length) {
return null
}
return (
<div className="relative mx-auto max-w-2xl px-4">
{!isShared && !session ? (
<div className="mb-8 rounded-lg border bg-white p-4 dark:bg-zinc-950">
<p className="text-muted-foreground leading-normal">
Please{' '}
<Link href="/login" className="underline">
log in
</Link>{' '}
or{' '}
<Link href="/signup" className="underline">
sign up
</Link>{' '}
to save and revisit your chat history!
</p>
</div>
) : null}
{messages.map((message, index) => (
<div key={message.id}>
{message.display}