diff --git a/README.md b/README.md index bfa2dd4..0ab9f4e 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ interface ChatRequestBody { clientId: string; messages: TreeNode[]; history?: TreeNode[]; - id: string; + chatId: string; forkOf?: string; parent?: string | null; } @@ -104,9 +104,9 @@ interface ChatRequestBody { const ably = new Ably.Realtime({ key: process.env.ABLY_API_KEY }); export async function POST(req: Request) { - const { messages, history, id, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody; + const { messages, history, chatId, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody; - const channel = ably.channels.get(id); + const channel = ably.channels.get(chatId); const transport = createServerTransport({ channel }); const turn = transport.newTurn({ turnId, clientId, parent, forkOf }); diff --git a/demo/vercel/react/use-chat/src/app/api/chat/route.ts b/demo/vercel/react/use-chat/src/app/api/chat/route.ts index 26213ef..2d084e4 100644 --- a/demo/vercel/react/use-chat/src/app/api/chat/route.ts +++ b/demo/vercel/react/use-chat/src/app/api/chat/route.ts @@ -21,7 +21,7 @@ interface ChatRequestBody { clientId: string; messages: MessageNode[]; history?: MessageNode[]; - id: string; + chatId: string; forkOf?: string; parent?: string; } @@ -30,8 +30,8 @@ interface ChatRequestBody { const ably = new Ably.Realtime({ key: process.env.ABLY_API_KEY! }); export async function POST(req: Request) { - const { messages, history, id, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody; - const channel = ably.channels.get(id); + const { messages, history, chatId, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody; + const channel = ably.channels.get(chatId); const transport = createServerTransport({ channel }); const turn = transport.newTurn({ turnId, clientId, parent, forkOf, signal: req.signal }); diff --git a/docs/get-started/vercel-use-chat.md b/docs/get-started/vercel-use-chat.md index aec72f3..f69a403 100644 --- a/docs/get-started/vercel-use-chat.md +++ b/docs/get-started/vercel-use-chat.md @@ -101,7 +101,7 @@ interface ChatRequestBody { clientId: string; messages: MessageNode[]; history?: MessageNode[]; - id: string; + chatId: string; forkOf?: string; parent?: string | null; } @@ -109,8 +109,8 @@ interface ChatRequestBody { const ably = new Ably.Realtime({ key: process.env.ABLY_API_KEY! }); export async function POST(req: Request) { - const { messages, history, id, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody; - const channel = ably.channels.get(id); + const { messages, history, chatId, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody; + const channel = ably.channels.get(chatId); const transport = createServerTransport({ channel }); const turn = transport.newTurn({ turnId, clientId, parent, forkOf });