Generate personalized UI to guide your users with Lopus AI
Install lopus-ai
in your React project:
Currently, the SDK requires you to setup shadcn/ui
separately in order to render the generated components (we internally use these components for clean default styling). If you prefer installation guidelines given by the shadcn/ui
website, head on to the Installation instructions.
If you’re using a framework like Next.js, Gatsby, Remix or Astro, you can use the shadcn/ui
CLI to set this up. If you’re using plain React.js, head on to the Manual Installation Guide.
Install and initialize shadcn/ui in your React-based project:
During initialization, answer the questions as you want.
Add the Lopus AI components to your tailwind.config.ts
content array:
Make sure to add the highlighted line to your Tailwind config to properly style the Lopus AI components.
useLopusChat
HookImport and initialize the useLopusChat
hook in your React component:
Replace your_api_key_here
with your actual Lopus AI API key. You can find
your API key in the dashboard.
The useLopusChat
hook provides:
messages
: An array of chat messages
sendQuery
: A function to send new messages
isLoading
: A boolean indicating if a response is being generated
You should see a confirmation that you are authenticated:
Authentication confirmation from Lopus AI
Create 3 necessary components for Messages, Message List, and Chat Input. Each component includes error handling, type checking, and styling.
Make sure to update your ChatComponent.tsx
to use the components:
Lopus Chat Component
For a complete implementation with advanced features like error handling and component rendering, see our example app:
Learn how to Render Markdown Messages
Learn about different Message Types supported by Lopus AI
Generate personalized UI to guide your users with Lopus AI
Install lopus-ai
in your React project:
Currently, the SDK requires you to setup shadcn/ui
separately in order to render the generated components (we internally use these components for clean default styling). If you prefer installation guidelines given by the shadcn/ui
website, head on to the Installation instructions.
If you’re using a framework like Next.js, Gatsby, Remix or Astro, you can use the shadcn/ui
CLI to set this up. If you’re using plain React.js, head on to the Manual Installation Guide.
Install and initialize shadcn/ui in your React-based project:
During initialization, answer the questions as you want.
Add the Lopus AI components to your tailwind.config.ts
content array:
Make sure to add the highlighted line to your Tailwind config to properly style the Lopus AI components.
useLopusChat
HookImport and initialize the useLopusChat
hook in your React component:
Replace your_api_key_here
with your actual Lopus AI API key. You can find
your API key in the dashboard.
The useLopusChat
hook provides:
messages
: An array of chat messages
sendQuery
: A function to send new messages
isLoading
: A boolean indicating if a response is being generated
You should see a confirmation that you are authenticated:
Authentication confirmation from Lopus AI
Create 3 necessary components for Messages, Message List, and Chat Input. Each component includes error handling, type checking, and styling.
Make sure to update your ChatComponent.tsx
to use the components:
Lopus Chat Component
For a complete implementation with advanced features like error handling and component rendering, see our example app:
Learn how to Render Markdown Messages
Learn about different Message Types supported by Lopus AI