Bug: read files fails silently #77
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_os#77
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?
Summary
Broken TTS (Read Aloud) API endpoint when embedded behind a proxy.
The voice TTS fetch URL is constructed as BASE_PATH '/../hero_agent/api/voice/tts', which produces incorrect paths when the app is embedded inside hero_os at /hero_books/ui/.
The relative /../ navigation doesn't resolve correctly in all proxy configurations, causing the Read Aloud feature to fail.
Steps to Reproduce
Implementation Spec for Issue #77
Objective
Fix the Read Aloud (TTS) feature in the hero_books page viewer so it works correctly when the application is embedded inside hero_os at
/hero_books/ui/. The bug has two parts: (1) the TTS fetch URL uses a broken relative path viaBASE_PATH + '/../hero_agent/api/voice/tts', and (2) a misplaced closing</div>tag causes the{% endblock %}directives to sit inside the wrong element.Requirements
BASE_PATH + '/../hero_agent/api/voice/tts'with the absolute path/hero_agent/ui/api/voice/ttsso the request resolves correctly regardless of proxy configuration or embedded path prefix.</div>for<div class="row">so it appears after closingcol-lg-9and before{% endblock %}, rather than after{% endblock %}at the very end of the file.if (!data.audio)block.Files to Modify
crates/hero_books_ui/templates/page.html</div>.Implementation Plan
Step 1: Fix the TTS fetch URL
Change
fetch(BASE_PATH + '/../hero_agent/api/voice/tts'tofetch('/hero_agent/ui/api/voice/tts'Step 2: Fix the
</div>placementAdd
</div>after closingcol-lg-9and before{% endblock %}. Remove the orphaned</div>from the end of the file.Step 3: Clean up spurious blank line
Remove the blank line between
if (!data.audio) {andresetReadAloudBtn();.Step 4: Ensure trailing newline
File must end with a newline character.
Acceptance Criteria
/hero_agent/ui/api/voice/tts(absolute, no BASE_PATH prefix)<div class="row">is closed within{% block content %}(before{% endblock %})</div>after the final{% endblock %}/hero_books/ui/Implementation Summary
Changes Made
File modified:
crates/hero_books_ui/templates/page.htmlFixed TTS fetch URL: Changed
fetch(BASE_PATH + '/../hero_agent/api/voice/tts', ...)tofetch('/hero_agent/ui/api/voice/tts', ...)so the Read Aloud button works correctly when hero_books is embedded behind a proxy at/hero_books/ui/.Fixed HTML structure: Moved the closing
</div>for<div class="row">to appear before{% endblock %}instead of after it, correcting the HTML nesting within the Jinja template blocks.Removed spurious blank line: Cleaned up an empty line inside the
if (!data.audio)error-handling block.Added trailing newline: Ensured the file ends with a POSIX-compliant newline character.
Test Results
cargo test --release -p hero_books_ui-- passed (compilation and test harness clean)Notes
/hero_agent/ui/api/voice/ttsinstead ofBASE_PATH-relative because the TTS endpoint is a cross-service call to hero_agent, not a hero_books-local endpoint.fetchcalls in the codebase correctly useBASE_PATHfor hero_books-local endpoints and are unaffected.Pull request opened: lhumina_code/hero_books#93
This PR implements the changes discussed in this issue.