Integre o agente de Real-time Conversational AI em sua aplicação web.
Nota
Para testar rapidamente um agente de IA, consulte Integrar um agente de IA via trecho de código.
Código-fonte
Link para download
Baixe o código-fonte no GitHub.
Estrutura de diretórios
.
└── React
├── README.md
├── eslint.config.js
├── index.html // For PCs
├── mobile.html // For mobile phones
├── package.json
├── src
│ ├── Mobile // Mobile UI
│ ├── PC // PC UI
│ ├── common // Common method
│ ├── controller
│ ├── interface.ts
│ ├── runConfig.ts // Runtime configurations
│ ├── service
│ └── vite-env.d.ts
├── tsconfig.app.json
├── tsconfig.json
└── vite.config.ts
Antes de começar
Desenvolva as operações de API necessárias no seu AppServer ou implante o código-fonte do servidor fornecido. Para mais informações, consulte Implantar um projeto.
Executar a demonstração
Acesse o diretório React.
Execute
npm installpara instalar as dependências.No arquivo
src/runConfig.ts, defina o endereço do AppServer e o ID do agente.
// src/runConfig.ts
const runConfig: AICallRunConfig = {
// should be modified to region of your agent
region: 'cn-shanghai',
appServer: 'Your AppServer address',
voiceAgentId: 'Your voice agent ID',
avatarAgentId: 'Your avatar agent ID',
visionAgentId: 'Your vision agent ID',
// callTemplateConfig: callTemplateConfig,
};
|
Nome da região |
ID da região |
|
China (Hangzhou) |
cn-hangzhou |
|
China (Shanghai) |
cn-shanghai |
|
China (Beijing) |
cn-beijing |
|
China (Shenzhen) |
cn-shenzhen |
|
Singapore |
ap-southeast-1 |
Execute
npm run devpara iniciar o servidor de desenvolvimento.