@simpli-nikola/simpli-ai-assistant-chat-ui
v1.0.0
Published
Reusable React component for embedding a Simpli AI assistant chat panel.
Maintainers
Readme
simpli-ai-assistant-chat
Reusable React component for embedding a Simpli AI assistant chat panel.
Installation
npm install simpli-ai-assistant-chat-uiUsage
Import the component and use it in your React app:
import { useState } from 'react';
import { SimpliAIAssistantChat } from 'simpli-ai-assistant-chat-ui';
import { Message, QuickReply } from 'simpli-ai-assistant-chat-ui/dist/types/chat';
import 'simpli-ai-assistant-chat-ui/dist/index.css';
function App() {
// Example: set up your initial messages and quick replies
const [messages, setMessages] = useState<Message[]>([]);
const [quickReplies, setQuickReplies] = useState<QuickReply[]>([]);
return (
<SimpliAIAssistantChat
token="your_api_token_here" // Required
applicationType="knowledgeagent" // or "policyagent", "clientportal"
quickReplies={quickReplies}
showSearchType={false}
initialMessages={messages}
/>
);
}Props
| Prop | Type | Description |
|---------------------|-------------|-----------------------------------------------------------------------------|
| token | string | Required. API token for authentication |
| applicationType | string | Chat type: "policyagent", "knowledgeagent", or "clientportal" |
| quickReplies | QuickReply[]| Array of quick reply objects |
| initialMessages | Message[] | Array of initial message objects |
| showSearchType | boolean | Show search type selector (default: true) |
| showResponseMode | boolean | Show response mode selector (default: true) |
| showVoice | boolean | Show voice input button (default: false) |
| className | string | Additional CSS class names for the root container (optional) |
Note: You must provide your own state management for messages and quick replies as shown in the example. The
tokenprop is required for API access.
Environment Variables
Create a .env file in the project root with the following variables:
VITE_ASSISTANT_API_BASE_URL=https://ai-assistant.simpliautomation.com/api/v1/assistant/
VITE_ASSISTANT_API_TOKEN=your_api_token_hereReplace your_api_token_here with your actual API token.
