mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 07:30:05 +08:00
Ship lighter isolated runtimes, richer Books and Mastery flows, Reading/session polish, and explicit model API capabilities. Release notes: assets/releases/ver1-6-4.md
23 lines
659 B
TypeScript
23 lines
659 B
TypeScript
"use client";
|
|
|
|
import { createContext, useContext, type ReactNode } from "react";
|
|
|
|
import { ChatStateAdapterProvider } from "./ChatStateAdapter";
|
|
|
|
const ChatRuntimeContext = createContext(false);
|
|
|
|
export function ChatRuntimeProvider({ children }: { children: ReactNode }) {
|
|
const parent = useContext(ChatRuntimeContext);
|
|
if (parent && process.env.NODE_ENV !== "production") {
|
|
throw new Error(
|
|
"ChatRuntimeProvider cannot be nested; scope one runtime per route subtree",
|
|
);
|
|
}
|
|
|
|
return (
|
|
<ChatRuntimeContext.Provider value>
|
|
<ChatStateAdapterProvider>{children}</ChatStateAdapterProvider>
|
|
</ChatRuntimeContext.Provider>
|
|
);
|
|
}
|