|
1 |
| -# React + TypeScript + Vite |
| 1 | +# Vapi Integration Starter Template |
2 | 2 |
|
3 |
| -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. |
| 3 | +This starter template is designed to help you quickly integrate Vapi into your project. It showcases a bot that assists authors in defining characters for their stories, demonstrating the ease of integrating Vapi to manipulate the frontend, display backend results, and leverage other capabilities. |
4 | 4 |
|
5 |
| -Currently, two official plugins are available: |
| 5 | +## Features |
6 | 6 |
|
7 |
| -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh |
8 |
| -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
| 7 | +- **Real-time Interaction**: Interact with the bot in real-time to refine character traits and details. |
| 8 | +- **Message Handling**: Send and receive messages to and from the bot, handling different message types. |
| 9 | +- **Audio Level Visualization**: Visual feedback on the audio level during bot interaction. |
| 10 | +- **Event Handling**: Start, stop, and toggle bot calls with proper event management. |
9 | 11 |
|
10 |
| -## Expanding the ESLint configuration |
| 12 | +## Getting Started |
11 | 13 |
|
12 |
| -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: |
| 14 | +1. Clone the repository. |
| 15 | +2. Install dependencies with `npm install`. |
| 16 | +3. Set up your `.env` file with the required Vapi tokens. |
| 17 | +4. Run the development server with `npm run dev`. |
13 | 18 |
|
14 |
| -- Configure the top-level `parserOptions` property like this: |
| 19 | +## Integration Points |
15 | 20 |
|
16 |
| -```js |
17 |
| -export default { |
18 |
| - // other rules... |
19 |
| - parserOptions: { |
20 |
| - ecmaVersion: 'latest', |
21 |
| - sourceType: 'module', |
22 |
| - project: ['./tsconfig.json', './tsconfig.node.json'], |
23 |
| - tsconfigRootDir: __dirname, |
24 |
| - }, |
25 |
| -} |
26 |
| -``` |
| 21 | +- **Vapi SDK**: Integrated via `vapi.sdk.ts` to manage the Vapi instance. |
| 22 | +- **React Hooks**: `useVapi.ts` to encapsulate Vapi logic within React components. |
| 23 | +- **Event Listeners**: Set up listeners for various Vapi events like speech start/end, call start/end, and message updates. |
| 24 | +- **Message Components**: Render messages and transcripts in real-time as they are received from the bot. |
| 25 | +- **Character Details**: Edit and save character details, which are then sent as messages to the bot for processing. |
27 | 26 |
|
28 |
| -- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` |
29 |
| -- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` |
30 |
| -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list |
| 27 | +## Project Structure |
| 28 | + |
| 29 | +- `src/`: Source files for the application. |
| 30 | +- `src/features/Assistant/`: Components and hooks related to Vapi integration. |
| 31 | +- `src/features/Character/`: Components for character details and manipulation. |
| 32 | +- `src/lib/`: Shared types and utility functions. |
| 33 | +- `src/components/ui/`: Reusable UI components. |
| 34 | + |
| 35 | +## Customization |
| 36 | + |
| 37 | +You can customize the bot's behavior and appearance by modifying the `character.assistant.ts` and the corresponding React components. |
0 commit comments