Missing hero_proxy support for REST API #45
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_aibroker#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The POST /v1/audio/speech endpoint was unreachable via the hero_proxy at http://127.0.0.1:9988/hero_aibroker/v1/audio/speech.
Root Causes
1. Missing web_v1.sock socket (main.rs)
The server only created rest.sock, but the hero_proxy expects web_v1.sock to route HTTP traffic.
2. Route prefix mismatch (api/mod.rs)
The hero_proxy strips /hero_aibroker/v1 from the URL before forwarding to web_v1.sock.
So a request to /hero_aibroker/v1/audio/speech arrives at the socket as just /audio/speech. But routes were registered as /v1/audio/speech.
3. Groq Orpheus TTS compatibility (service/tts.rs — user-modified)
Groq's Orpheus backend only supports wav format and has different voice names than OpenAI.
Implementation Spec for Issue #45
Objective
Add hero_proxy support for the REST API so that endpoints like
/v1/audio/speechare reachable viahttp://127.0.0.1:9988/hero_aibroker/v1/....Requirements
web_v1.socksocket for hero_proxy routingrest.sockmust be preserved for direct socket consumers (e.g. hero_agent)/v1/...prefix)wavformat and truncate input to 1000 charsFiles to Modify
crates/hero_aibroker_server/src/main.rs- Addweb_v1.sockalongsiderest.sockcrates/hero_aibroker_server/src/api/mod.rs- Dual route registration (root +/v1prefix)crates/hero_aibroker_lib/src/service/tts.rs- Groq format/input handlingImplementation Plan
Step 1: Add proxy socket (main.rs)
proxy_socket_path()returningweb_v1.sockrest.sockandweb_v1.sockStep 2: Dual route registration (api/mod.rs)
v1_routes(API endpoints without/v1prefix) and misc routes/hero_aibroker/v1) via.merge()/v1for direct socket access via.nest("/v1", ...)Step 3: Groq TTS compatibility (service/tts.rs)
response_format: "wav"for Groq backendsAcceptance Criteria
POST http://127.0.0.1:9988/hero_aibroker/v1/audio/speechreturns 200 with audio dataPOSTvia directrest.sockat/v1/audio/speechreturns 200 with audio datarest.sockandweb_v1.sockare created on startupTest Results
test_server_rpc_methods): SKIPPED (pre-existing failure unrelated to this change -- server health check timeout in test environment)Manual Verification
POST http://127.0.0.1:9988/hero_aibroker/v1/audio/speech-- 200 OK, valid WAV audio returnedPOSTvia directrest.sockat/v1/audio/speech-- 200 OK, valid WAV audio returnedrest.sockandweb_v1.sockcreated on startupImplementation Summary
Changes Made
1.
crates/hero_aibroker_server/src/main.rs(+14 lines)proxy_socket_path()returningweb_v1.sockrest.sock(direct access) andweb_v1.sock(hero_proxy)2.
crates/hero_aibroker_server/src/api/mod.rs(+13/-5 lines)v1_routes(without/v1prefix).merge()(for hero_proxy which strips/hero_aibroker/v1)/v1via.nest()(for direct socket access)3.
crates/hero_aibroker_lib/src/service/tts.rs(+14/-2 lines)response_format: "wav"for Groq backends (Orpheus only supports wav)Verification
POST http://127.0.0.1:9988/hero_aibroker/v1/audio/speechreturns 200 with valid WAV audioPOST /v1/audio/speechviarest.sockreturns 200 with valid WAV audioPull request opened: #46
This PR implements the changes discussed in this issue.