diff --git a/components/chat-transport.ts b/components/chat-transport.ts index 1a5d7a3..9b9243c 100644 --- a/components/chat-transport.ts +++ b/components/chat-transport.ts @@ -21,7 +21,7 @@ * a future "server-ahead" heal in the poller). Rare path; self-heals. */ import { DefaultChatTransport } from "ai"; -import type { TeacherUIMessage } from "@/src/core/ui-message"; +import type { TeacherUIMessage } from "@/src/core"; /** How often to poll turnInFlight while the racing turn runs. */ const TURN_POLL_MS = 500; diff --git a/components/chat.tsx b/components/chat.tsx index 73779cb..6f089b8 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -2,7 +2,8 @@ import { createContext, Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; import { useChat } from "@ai-sdk/react"; -import { DefaultChatTransport, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls } from "ai"; +import { isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls } from "ai"; +import { createChatTransport } from "@/components/chat-transport"; import { useStickToBottomContext } from "use-stick-to-bottom"; import { Conversation, @@ -81,7 +82,7 @@ export function Chat({ useChat({ id: chatId, messages: initialMessages, - transport: new DefaultChatTransport({ api: "/api/chat", body: { chatId } }), + transport: createChatTransport(chatId), // After the learner answers (addToolOutput), automatically send the // continuation request so the teacher reacts to the answer. sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,