Root component that initializes the AINative runtime.
interface AIAppProps {
config: AppConfig;
children: (state: AIState, app: AIApp) => React.ReactNode;
}
interface AppConfig {
apiUrl: string;
streamMethod?: 'SSE' | 'WS' | 'AUTO';
initialState?: Partial<AIState>;
reconnect?: boolean;
debug?: boolean;
}<AIAppComponent config={{ apiUrl: 'http://localhost:3001' }}>
{(state, app) => <YourComponent state={state} app={app} />}
</AIAppComponent>Enhanced input component with multimodal support.
interface AIInputProps {
onSubmit: (message: string, attachments?: any[]) => void;
placeholder?: string;
disabled?: boolean;
multiline?: boolean;
enableAudio?: boolean;
enableImage?: boolean;
enableFile?: boolean;
className?: string;
}<AIInput
onSubmit={(msg, attachments) => app.sendMessage(msg)}
placeholder="Type your message..."
enableAudio={true}
enableImage={true}
/>Displays individual streaming messages.
interface AIStreamProps {
message: Message;
showMetadata?: boolean;
className?: string;
renderContent?: (content: string) => React.ReactNode;
}<AIStream
message={message}
showMetadata={true}
renderContent={(content) => <ReactMarkdown>{content}</ReactMarkdown>}
/>Displays a list of streaming messages.
interface AIStreamListProps {
messages: Message[];
showMetadata?: boolean;
className?: string;
renderContent?: (content: string) => React.ReactNode;
}<AIStreamList
messages={state.messages}
showMetadata={false}
/>Complete chat interface with header, messages, and input.
interface AIPaneProps {
state: AIState;
onSendMessage: (message: string, attachments?: any[]) => void;
title?: string;
subtitle?: string;
showMetadata?: boolean;
enableAudio?: boolean;
enableImage?: boolean;
enableFile?: boolean;
className?: string;
renderHeader?: () => React.ReactNode;
renderFooter?: () => React.ReactNode;
}<AIPane
state={state}
onSendMessage={(msg) => app.sendMessage(msg)}
title="My AI Assistant"
subtitle="Powered by GPT-4"
enableAudio={true}
renderFooter={() => <div>Custom footer</div>}
/>Access AI state directly:
const { state, setState } = useAIState();Hook into streaming events:
const { isStreaming, tokens } = useAIStream();All components accept className props for custom styling. Default classes:
.ai-pane- Main container.ai-pane-header- Header section.ai-pane-content- Message list area.ai-stream-message- Individual message.ai-input-container- Input wrapper.ai-input-field- Text input.ai-input-submit- Send button