UNPKG

@assistant-ui/react

Version:

TypeScript/React library for AI Chat

19 lines (18 loc) 662 B
"use client"; // src/legacy-runtime/hooks/ComposerContext.ts import { useAssistantApi } from "../../context/react/index.js"; import { createStateHookForRuntime } from "../../context/react/utils/createStateHookForRuntime.js"; function useComposerRuntime(options) { const api = useAssistantApi(); const runtime = api.composer.source ? api.composer().__internal_getRuntime() : null; if (!runtime && !options?.optional) { throw new Error("ComposerRuntime is not available"); } return runtime; } var useComposer = createStateHookForRuntime(useComposerRuntime); export { useComposer, useComposerRuntime }; //# sourceMappingURL=ComposerContext.js.map