Skip to content

feat: OmniVoice TTS từ xa + tạo/xoá Flow project trên batchexecute - #43

Open
hieuh0 wants to merge 6 commits into
crisng95:mainfrom
hieuh0:feat/remote-omnivoice-tts
Open

feat: OmniVoice TTS từ xa + tạo/xoá Flow project trên batchexecute#43
hieuh0 wants to merge 6 commits into
crisng95:mainfrom
hieuh0:feat/remote-omnivoice-tts

Conversation

@hieuh0

@hieuh0 hieuh0 commented Sep 9, 2026

Copy link
Copy Markdown

Tóm tắt

PR này bổ sung backend OmniVoice TTS từ xa và hoàn thiện luồng tạo/xoá Flow project trên đường batchexecute, kèm một bản vá idempotent cho route tạo project. Tổng cộng 18 file, +1051/-75.

Vì sao cần thay đổi

  • TTS trước đây phụ thuộc backend cục bộ; nay cần gọi được OmniVoice chạy từ xa để sinh giọng đọc mà không ràng buộc vào máy có model.
  • Đường batchexecute của Flow chưa tự tạo/xoá project, nên phải thao tác tay trên UI. PR đưa 2 RPC bắt được từ Flow UI (jHPbke tạo, QI2zvc xoá) vào client.
  • Route tạo project ném lỗi 500 (UNIQUE constraint failed: project.id) khi id đã tồn tại cục bộ (project được pin hoặc client gửi lên) — cần trả về row sẵn có thay vì INSERT lại.

Nội dung thay đổi

1. Backend OmniVoice TTS từ xa (feat(tts))

  • agent/omnivoice_api.py (mới, 224 dòng): client gọi OmniVoice từ xa.
  • agent/services/tts.py, agent/api/tts.py, agent/config.py: nối backend từ xa vào pipeline TTS, thêm cấu hình.
  • run-omnivoice-api.sh, requirements.txt: script chạy và dependency.
  • skills/fk-gen-narrator.md, skills/fk-gen-tts-template.md, skills/fk-import-voice.md: ghi chú dùng backend OmniVoice từ xa.

2. Tạo/xoá Flow project trên batchexecute (feat(flow))

  • agent/services/flow_batch.py: builder request cho RPC_CREATE_PROJECT/RPC_DELETE_PROJECTread_created_project_id (đọc slot 0, khớp UUID đầy đủ, ném lỗi nếu không hợp lệ).
  • agent/services/flow_client.py: create_project mint project qua jHPbke khi chưa pin (vẫn ưu tiên tái dùng project đã pin); delete_project qua QI2zvc.
  • agent/api/projects.py (route DELETE): preflight get_project (trả 404 trước khi gọi RPC), xoá remote-first mọi project trừ project pinned/shared, giữ lại row cục bộ khi xoá remote thất bại.

3. Vá idempotent route tạo project (fix(api))

  • agent/api/projects.py: khi id đã được theo dõi cục bộ, trả về row hiện có thay vì INSERT lại (tránh 500 do vi phạm primary key). Id mới sinh không bao giờ trùng nên không ảnh hưởng đường tạo mới.

Kiểm thử

  • 100+ unit test: tests/unit/test_flow_batch.py, test_flow_client_batch.py, test_projects_route.py, test_tts.py.
  • Đã chạy round trip create/delete thực tế trên Flow.

hieuh0 added 6 commits August 28, 2026 12:05
Port the jHPbke (create) and QI2zvc (delete) RPCs captured off the Flow UI:
- flow_batch: RPC_CREATE_PROJECT/RPC_DELETE_PROJECT, request builders, and
  read_created_project_id (slot 0, uuid fullmatch, raises otherwise).
- flow_client.create_project mints a project via jHPbke when unpinned (pin still
  reused first); rejects non-default tool_name on batch; delete_project via QI2zvc.
- projects DELETE route: preflight get_project (404 before any RPC), remote-first
  delete of every project except the pinned/shared one, local row kept on failure.
Verified: 100 unit tests + a live create/delete round trip on Flow.
A pinned or request-supplied Flow project id may already have a local
row; the bare INSERT then raised UNIQUE constraint failed and surfaced
as a 500. Return the existing row when the id is already tracked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant