mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-15 12:50:42 -07:00
- Created a new .npmrc file to enforce bun usage. - Bumped version numbers for multiple packages to 0.1.9 in bun.lock. - Added react-sound-visualizer dependency to enhance audio visualization features. - Introduced convert:assets script in package.json for asset optimization. - Updated CONTRIBUTING.md with instructions for converting assets to web formats. - Added documentation files for API endpoints and developer guidelines in the docs directory.
150 lines
2.0 KiB
Plaintext
150 lines
2.0 KiB
Plaintext
---
|
|
title: "Voice Profiles API"
|
|
description: "Manage voice profiles programmatically"
|
|
---
|
|
|
|
## Endpoints
|
|
|
|
### List Profiles
|
|
|
|
```http
|
|
GET /profiles
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"profiles": [
|
|
{
|
|
"id": "abc123",
|
|
"name": "John Smith",
|
|
"language": "en",
|
|
"description": "Professional narrator",
|
|
"created_at": "2024-01-29T12:00:00Z",
|
|
"sample_count": 2
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Get Profile
|
|
|
|
```http
|
|
GET /profiles/{id}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "abc123",
|
|
"name": "John Smith",
|
|
"language": "en",
|
|
"description": "Professional narrator",
|
|
"created_at": "2024-01-29T12:00:00Z",
|
|
"samples": [
|
|
{
|
|
"id": "sample123",
|
|
"duration": 15.5,
|
|
"created_at": "2024-01-29T12:00:00Z"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Create Profile
|
|
|
|
```http
|
|
POST /profiles
|
|
```
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
"name": "John Smith",
|
|
"language": "en",
|
|
"description": "Professional narrator"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"id": "abc123",
|
|
"name": "John Smith",
|
|
"language": "en",
|
|
"description": "Professional narrator",
|
|
"created_at": "2024-01-29T12:00:00Z"
|
|
}
|
|
```
|
|
|
|
### Update Profile
|
|
|
|
```http
|
|
PUT /profiles/{id}
|
|
```
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
"name": "Updated Name",
|
|
"description": "Updated description"
|
|
}
|
|
```
|
|
|
|
### Delete Profile
|
|
|
|
```http
|
|
DELETE /profiles/{id}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"success": true
|
|
}
|
|
```
|
|
|
|
### Add Voice Sample
|
|
|
|
```http
|
|
POST /profiles/{id}/samples
|
|
```
|
|
|
|
**Request:** (multipart/form-data)
|
|
```
|
|
audio: <file>
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"sample_id": "sample123",
|
|
"duration": 15.5
|
|
}
|
|
```
|
|
|
|
## TypeScript Example
|
|
|
|
```typescript
|
|
import { VoiceboxClient } from '@/lib/api'
|
|
|
|
const client = new VoiceboxClient({
|
|
baseUrl: 'http://localhost:17493'
|
|
})
|
|
|
|
// Create profile
|
|
const profile = await client.createProfile({
|
|
name: 'John Smith',
|
|
language: 'en',
|
|
description: 'Professional narrator'
|
|
})
|
|
|
|
// Add sample
|
|
await client.addSample(profile.id, audioFile)
|
|
|
|
// List all profiles
|
|
const profiles = await client.listProfiles()
|
|
```
|
|
|
|
For full API documentation, visit `http://localhost:17493/docs` when the server is running.
|