Add canvas interface (#461)
This commit is contained in:
parent
1a74a5ca9a
commit
b3cb0ea755
44 changed files with 7454 additions and 4691 deletions
|
|
@ -2,11 +2,11 @@ import { CoreMessage } from 'ai';
|
|||
import { cookies } from 'next/headers';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import { DEFAULT_MODEL_NAME, models } from '@/ai/models';
|
||||
import { auth } from '@/app/(auth)/auth';
|
||||
import { Chat as PreviewChat } from '@/components/custom/chat';
|
||||
import { getChatById } from '@/db/queries';
|
||||
import { Chat } from '@/db/schema';
|
||||
import { DEFAULT_MODEL_NAME, models } from '@/lib/model';
|
||||
import { convertToUIMessages } from '@/lib/utils';
|
||||
|
||||
export default async function Page(props: { params: Promise<any> }) {
|
||||
|
|
@ -35,15 +35,16 @@ export default async function Page(props: { params: Promise<any> }) {
|
|||
}
|
||||
|
||||
const cookieStore = await cookies();
|
||||
const value = cookieStore.get('model')?.value;
|
||||
const selectedModelName =
|
||||
models.find((m) => m.name === value)?.name || DEFAULT_MODEL_NAME;
|
||||
const modelIdFromCookie = cookieStore.get('model-id')?.value;
|
||||
const selectedModelId =
|
||||
models.find((model) => model.id === modelIdFromCookie)?.id ||
|
||||
DEFAULT_MODEL_NAME;
|
||||
|
||||
return (
|
||||
<PreviewChat
|
||||
id={chat.id}
|
||||
initialMessages={chat.messages}
|
||||
selectedModelName={selectedModelName}
|
||||
selectedModelId={selectedModelId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue