Installation & Quick Start
Get up and running with @termix-it/react-tool in just a few minutes.Prerequisites
Before installing the library, make sure you have:- React 16.9.0 or later
- Node.js 14 or later
- A Termix project with AI configuration set up
Installation
Install the library using your preferred package manager:- ✅ ChatInterface component with AI chat capabilities
- ✅ ChatWidget component for floating chat button
- ✅ Built-in styles (no separate CSS import needed)
- ✅ Built-in UI components (Lucide icons, Markdown rendering)
- ✅ TypeScript support with full type definitions
- ✅ Automatic knowledge base integration
- ✅ Function calling (REST APIs & smart contracts)
- ✅ Real-time streaming support
- ✅ Tree-shaking optimized (only bundles what you use)
Peer Dependencies
This library requires the following peer dependencies to be installed in your project:UI dependencies (
lucide-react, react-markdown, remark-breaks, remark-gfm) are now bundled with the library and support tree-shaking to minimize bundle size. Only the icons and markdown features you use will be included in your final build.Ethers.js Version Compatibility
This library supports both ethers v5 and ethers v6 through an internal compatibility layer. You can use either version in your project:- ethers v5:
npm install ethers@^5.7.0 - ethers v6:
npm install ethers@^6.15.0
Styles
Styles are now automatically bundled with the components - no separate CSS import needed! All styles are scoped with.termix- prefix to prevent conflicts.
Basic Setup
Minimal Setup
The absolute minimum code needed to get started:App.tsx
Basic Usage with Common Options
Here’s a more complete setup with commonly used options:App.tsx
Alternative Setups
ChatWidget for Floating Interface
For a non-intrusive floating chat widget, use theChatWidget component:
FloatingChat.tsx
Streaming Mode Setup
Enable real-time streaming responses for a more dynamic experience:StreamingChat.tsx
Configuration Parameters
You’ll need these essential parameters to get started:Your Termix project identifier. You can find this in your Termix dashboard.
AI configuration identifier that defines the model and behavior settings.
Authorization header value, typically a Bearer token for authentication (optional but recommended).
Streaming Mode Requirements: If you enable
enableStreamingMode={true}, your proxy endpoint must support Server-Sent Events (SSE). See the Streaming Mode guide for detailed implementation instructions.Testing Your Setup
Once you have the basic setup complete, you should see:- Chat interface rendered on your page
- Welcome message displayed in the chat
- Input field ready for user messages
- Send button to submit messages
Testing Streaming Mode
If you enabled streaming mode, you should see:- Characters appearing one by one as the AI responds
- No loading spinner during responses
- Real-time typing effect
Common Issues
Styles not loading correctly
Styles not loading correctly
Styles are now bundled with components. If you experience issues, check for CSS conflicts with your global styles.
API connection errors
API connection errors
The SDK connects to
https://dashboard.termix.ai by default. Verify your authorization token is valid.Authentication failures
Authentication failures
Check that your
authorization token is valid and properly formatted (usually Bearer your-token).TypeScript errors
TypeScript errors
If using TypeScript, make sure you have the latest version of the library installed, which includes comprehensive type definitions.
Next Steps
Now that you have the basic setup working, you can:Explore Configuration
Learn about all available props and customization options
ChatWidget Component
Create floating chat widgets for customer support and help functionality
Streaming Mode
Enable real-time streaming responses with Server-Sent Events
Advanced Features
Set up function calling, smart contracts, and knowledge base integration
TypeScript Guide
Learn about type definitions and TypeScript-specific features