@llamaindex/ui
Version:
A comprehensive UI component library built with React, TypeScript, and Tailwind CSS for LlamaIndex applications
15 lines (11 loc) • 413 B
text/typescript
import { createContext, useContext } from "react";
import { type ChatContext } from "./chat.interface";
export const chatContext = createContext<ChatContext | null>(null);
export const ChatProvider = chatContext.Provider;
export const useChatUI = () => {
const context = useContext(chatContext);
if (!context) {
throw new Error("useChatUI must be used within a ChatProvider");
}
return context;
};