LOT 1 - Optimizare script build -Instalare mono comanda
This commit is contained in:
parent
5380c3fc63
commit
42ff22bf85
127 changed files with 16163 additions and 532 deletions
|
|
@ -8,9 +8,8 @@ OpenAI-compatible speech-to-text transcription API using faster-whisper.
|
|||
{BASE_URL}
|
||||
```
|
||||
|
||||
- **Local development:** `http://localhost:8200`
|
||||
- **Docker (internal):** `http://audio-api:8200`
|
||||
- **Direct:** `http://localhost:54300`
|
||||
- **Local development:** `http://localhost:54300`
|
||||
- **Docker (internal):** `http://audio-api:54300`
|
||||
- **Production:** Use your configured hostname
|
||||
|
||||
## Authentication
|
||||
|
|
@ -34,7 +33,7 @@ Check API health status.
|
|||
|
||||
**Example:**
|
||||
```bash
|
||||
curl http://localhost:8200/health
|
||||
curl http://localhost:54300/health
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -62,7 +61,20 @@ List available Whisper models (OpenAI-compatible).
|
|||
|
||||
**Example:**
|
||||
```bash
|
||||
curl http://localhost:8200/v1/models
|
||||
curl http://localhost:54300/v1/models
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Service Info
|
||||
|
||||
Return service catalog metadata (resources, models, functions). Consumed by the DIDI `catalog-api`.
|
||||
|
||||
**Endpoint:** `GET /v1/info`
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
curl http://localhost:54300/v1/info
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -79,13 +91,16 @@ Transcribe audio file to text (OpenAI-compatible endpoint).
|
|||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| `file` | file | Yes | - | Audio file to transcribe (MP3, WAV, M4A, etc.) |
|
||||
| `file` | file | Yes* | - | Audio file to transcribe (MP3, WAV, M4A, etc.). Provide either `file` or `url` (XOR). |
|
||||
| `url` | string | Yes* | - | URL to download the audio from (DIDI extension over OpenAI). Provide either `file` or `url` (XOR). |
|
||||
| `model` | string | No | `large-v3-turbo` | Model to use (currently ignored, uses configured model) |
|
||||
| `language` | string | No | `null` | Language code (ISO-639-1). Auto-detected if not specified. |
|
||||
| `prompt` | string | No | `null` | Optional text to guide the model's style |
|
||||
| `response_format` | string | No | `json` | Format: `json`, `text`, or `verbose_json` |
|
||||
| `temperature` | float | No | `0.0` | Sampling temperature (0.0-1.0). Use 0.0 for deterministic output. |
|
||||
|
||||
\* `file` and `url` are mutually exclusive — supply exactly one.
|
||||
|
||||
**Supported Languages (ISO-639-1 codes):**
|
||||
`en`, `es`, `fr`, `de`, `it`, `pt`, `nl`, `pl`, `tr`, `ru`, `ja`, `ko`, `zh`, `ar`, `hi`, and 90+ more languages.
|
||||
|
||||
|
|
@ -132,14 +147,21 @@ Full transcription text
|
|||
|
||||
**Basic transcription (JSON):**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "response_format=json"
|
||||
```
|
||||
|
||||
**From a URL (instead of file upload):**
|
||||
```bash
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "url=https://example.com/audio.mp3" \
|
||||
-F "response_format=json"
|
||||
```
|
||||
|
||||
**With language specification:**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "language=en" \
|
||||
-F "response_format=json"
|
||||
|
|
@ -147,21 +169,21 @@ curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
|||
|
||||
**Text format:**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "response_format=text"
|
||||
```
|
||||
|
||||
**Verbose JSON with segments:**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "response_format=verbose_json"
|
||||
```
|
||||
|
||||
**With initial prompt (to guide style):**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "prompt=This is a technical discussion about machine learning." \
|
||||
-F "response_format=json"
|
||||
|
|
@ -171,7 +193,7 @@ curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
|||
```python
|
||||
import requests
|
||||
|
||||
url = "http://localhost:8200/v1/audio/transcriptions"
|
||||
url = "http://localhost:54300/v1/audio/transcriptions"
|
||||
|
||||
with open("audio.mp3", "rb") as f:
|
||||
files = {"file": f}
|
||||
|
|
@ -196,7 +218,7 @@ formData.append('file', audioFile);
|
|||
formData.append('model', 'large-v3-turbo');
|
||||
formData.append('response_format', 'json');
|
||||
|
||||
const response = await fetch('http://localhost:8200/v1/audio/transcriptions', {
|
||||
const response = await fetch('http://localhost:54300/v1/audio/transcriptions', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
|
@ -247,7 +269,7 @@ limit_req_zone $binary_remote_addr zone=audio_limit:10m rate=10r/m;
|
|||
|
||||
location / {
|
||||
limit_req zone=audio_limit burst=5;
|
||||
proxy_pass http://audio-api:8200;
|
||||
proxy_pass http://audio-api:54300;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -330,7 +352,7 @@ from openai import OpenAI
|
|||
# Point to local API
|
||||
client = OpenAI(
|
||||
api_key="not-needed", # No auth required
|
||||
base_url="http://localhost:8200/v1"
|
||||
base_url="http://localhost:54300/v1"
|
||||
)
|
||||
|
||||
with open("audio.mp3", "rb") as f:
|
||||
|
|
@ -351,7 +373,7 @@ import fs from 'fs';
|
|||
|
||||
const openai = new OpenAI({
|
||||
apiKey: 'not-needed',
|
||||
baseURL: 'http://localhost:8200/v1'
|
||||
baseURL: 'http://localhost:54300/v1'
|
||||
});
|
||||
|
||||
const transcription = await openai.audio.transcriptions.create({
|
||||
|
|
@ -391,7 +413,7 @@ Configurable via `AUDIO_BEAM_SIZE` (default: 5). Higher values = better accuracy
|
|||
|
||||
```bash
|
||||
# Check if API is ready
|
||||
curl http://localhost:8200/health
|
||||
curl http://localhost:54300/health
|
||||
|
||||
# Expected response
|
||||
{"status": "ok"}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Audio transcription service for DIDI media analysis. Whisper-based (M17-Whisper,
|
|||
- Default model: `large-v3-turbo` (809M params, ~6GB VRAM int8)
|
||||
- GPU: CUDA (shared GPU 0 with Qwen3.5-35B-A3B)
|
||||
- URL (Dev): `http://10.11.10.17:54300/v1/audio/transcriptions`
|
||||
- Container: `didiAI-audio-api` (GPU host)
|
||||
- Container: `didiAI-audio` (GPU host)
|
||||
- Auth: none on the service itself; agent-v3 uses bearer token via `M17_WHISPER_TOKEN` (enforced by gateway/nginx if configured)
|
||||
|
||||
## Ce face
|
||||
|
|
@ -92,8 +92,8 @@ cp ../.env.example .env # edit values
|
|||
docker compose restart audio-api # quick restart
|
||||
```
|
||||
|
||||
- Container name: `didiAI-audio-api`
|
||||
- Image: `didiai-audio-api`
|
||||
- Container name: `didiAI-audio`
|
||||
- Image: `didiai-audio:audit`
|
||||
- Network: `didi-network` (external, shared with other AI modules)
|
||||
- GPU reservation: NVIDIA driver, device `0`
|
||||
- Healthcheck: HTTP `GET /health` every 30s, 60s start period (model load)
|
||||
|
|
@ -111,7 +111,7 @@ docker compose restart audio-api # quick restart
|
|||
modules/audio/
|
||||
├── deploy/
|
||||
│ ├── deploy.sh # CLI wrapper
|
||||
│ ├── docker-compose.yml # didiAI-audio-api service
|
||||
│ ├── docker-compose.yml # didiAI-audio service
|
||||
│ ├── Dockerfile # CUDA + faster-whisper image
|
||||
│ └── .env # runtime config
|
||||
├── src/audio/
|
||||
|
|
|
|||
|
|
@ -61,22 +61,23 @@ cp ../.env.example .env
|
|||
| `/health` | GET | Health check |
|
||||
| `/v1/models` | GET | List available models |
|
||||
| `/v1/audio/transcriptions` | POST | Transcribe audio (OpenAI-compatible) |
|
||||
| `/v1/info` | GET | Service catalog metadata (used by catalog-api) |
|
||||
|
||||
### Example API Request
|
||||
|
||||
```bash
|
||||
# Health check
|
||||
curl http://localhost:8200/health
|
||||
curl http://localhost:54300/health
|
||||
|
||||
# Transcribe audio file
|
||||
AUDIO="/path/to/audio.mp3"
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@${AUDIO}" \
|
||||
-F "model=large-v3-turbo" \
|
||||
-F "response_format=json"
|
||||
|
||||
# With language specification and verbose output
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@${AUDIO}" \
|
||||
-F "language=en" \
|
||||
-F "response_format=verbose_json"
|
||||
|
|
@ -193,8 +194,8 @@ docker compose logs -f audio-api
|
|||
|
||||
| Port | Service |
|
||||
|------|---------|
|
||||
| `8200` | Audio API |
|
||||
| `54300` | Audio API (Dev + AI + Audio) |
|
||||
| `54300` | Audio API (Dev + AI + Audio) — primary |
|
||||
| `8200` | Audio API (legacy default) |
|
||||
|
||||
## Development
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
# Naming Convention: didiAI-{module}-{service}
|
||||
#
|
||||
# Network:
|
||||
# Uses deploy_default network (shared with other modules)
|
||||
# Uses the external didi-network bridge (shared with other AI modules)
|
||||
|
||||
networks:
|
||||
deploy_default:
|
||||
didi-network:
|
||||
external: true
|
||||
|
||||
services:
|
||||
|
|
@ -30,8 +30,8 @@ services:
|
|||
# Audio Transcription API Server
|
||||
# ==========================================================================
|
||||
audio-api:
|
||||
container_name: didiAI-audio-api
|
||||
image: didiai-audio-api
|
||||
container_name: didiAI-audio
|
||||
image: didiai-audio:audit
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: deploy/Dockerfile
|
||||
|
|
@ -39,7 +39,7 @@ services:
|
|||
ports:
|
||||
- "54300:54300"
|
||||
networks:
|
||||
- deploy_default
|
||||
- didi-network
|
||||
|
||||
environment:
|
||||
# GPU configuration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue