diff --git a/packages/chat/src/ui/chat/Message.tsx b/packages/chat/src/ui/chat/Message.tsx index 932dd36..a22fc86 100644 --- a/packages/chat/src/ui/chat/Message.tsx +++ b/packages/chat/src/ui/chat/Message.tsx @@ -3,9 +3,9 @@ import type {Message} from './types' export const MessageElement = ({ message }: { message: Message }) => { return ( -
-
- {message.message} +
+
+ {message.text}
) diff --git a/packages/chat/src/ui/chat/index.tsx b/packages/chat/src/ui/chat/index.tsx index 7569de8..6e5fe61 100644 --- a/packages/chat/src/ui/chat/index.tsx +++ b/packages/chat/src/ui/chat/index.tsx @@ -10,15 +10,21 @@ interface ChatProps { export const ChatUI = ({ chat }: ChatProps) => { const messages = React.use(chat) - + console.log(messages) return ( -
-
+
+
{messages?.messages?.map((message) => ( ))}
-
+
+
+ + + +
+
) } diff --git a/packages/chat/src/ui/chat/types.ts b/packages/chat/src/ui/chat/types.ts index b04c002..7c71943 100644 --- a/packages/chat/src/ui/chat/types.ts +++ b/packages/chat/src/ui/chat/types.ts @@ -1,4 +1,4 @@ export interface Message { role: 'assistant' | 'user' - message: string + text: string } \ No newline at end of file diff --git a/packages/chat/src/ui/page/ChatView.tsx b/packages/chat/src/ui/page/ChatView.tsx index 8aecb48..ef34573 100644 --- a/packages/chat/src/ui/page/ChatView.tsx +++ b/packages/chat/src/ui/page/ChatView.tsx @@ -10,7 +10,7 @@ import {redirect} from 'next/navigation' import {ChatUI} from '../chat' import {ConversationsList} from './ConversationsList' - const ChatView: React.FC = ({ +const ChatView: React.FC = ({ initPageResult, params, searchParams, @@ -43,7 +43,7 @@ import {ConversationsList} from './ConversationsList' })) }).catch(console.error) - const chatId = params?.chat + const chatId = 1 const chat = chatId ? payload .find({ @@ -51,7 +51,10 @@ import {ConversationsList} from './ConversationsList' where: { id: { equals: chatId } }, }) .then((chats) => { + console.log(chats) const chat = chats.docs[0] + console.log(chat) + if (!chat) return { messages: [] } return { ...chat, messages: chat.messages } }).catch(console.error) @@ -59,25 +62,25 @@ import {ConversationsList} from './ConversationsList' return ( <> - {/*