Skip to content

refactor: route audio models through wrappers - #20387

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
buua436:go090
Sep 29, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
buua436:go090

Conversation

@buua436

@buua436 buua436 commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Introduce ASRModel and TTSModel wrappers and route audio transcription and speech synthesis through them.

This unifies synchronous and streaming ASR/TTS calls and removes direct driver calls from service, handler, pipeline, and media dispatch code.

Type of change

  • Refactor (no functional change)

@buua436
buua436 requested a review from wangq8 September 29, 2026 09:53
@buua436 buua436 added the ci Continue Integration label Sep 29, 2026
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 2a91e9f5-d504-43ac-a6ce-015dff3d6ff3

📥 Commits

Reviewing files that changed from the base of the PR and between 02569ae and 67276fc.

📒 Files selected for processing (6)
  • internal/entity/models/types.go
  • internal/handler/chat_audio.go
  • internal/ingestion/component/media_dispatch.go
  • internal/service/chat_pipeline.go
  • internal/service/model_call.go
  • internal/service/model_service.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change adds ASR and TTS model wrappers that forward requests to ModelDriver. Audio handlers, ingestion, chat services, and model verification now use these wrappers for transcription and speech synthesis.

Changes

ASR and TTS call routing

Layer / File(s) Summary
ASR and TTS wrappers
internal/entity/models/types.go
Adds constructors and synchronous and sender-based methods that forward model configuration, request data, and usage to the driver.
Audio call integration
internal/handler/chat_audio.go, internal/ingestion/component/media_dispatch.go, internal/service/model_call.go, internal/service/chat_pipeline.go
Routes transcription and speech synthesis through the wrappers. The chat pipeline uses TTSModel for model resolution and synthesis.
Model verification
internal/service/model_service.go
Uses the wrapper methods for ASR and TTS verification. Existing error and nil-response handling remains unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Refactor

Suggested reviewers: jinhai-cn

Merge Risk: ⚪ Minimal · up to 67276

The audio calls appear to retain their existing behavior through the new wrappers. No issue identified here prevents merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 67276

Audio requests now pass through shared interfaces, but the reviewed paths retain their existing access checks and provider choices. Some integration coverage remains uncertain.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The affected exposure spans uploaded audio, requested speech, ingested media, chat synthesis, and provider verification. Reviewed wrapper calls continue to use the provider target selected by their caller; no new provider-selection path was found in the wrappers.

Trust Boundaries and Controls

  • observed — The tenant-specific speech path resolves its target using the supplied tenant before delegation; the changed HTTP paths retain user-based resolution and upload controls.

Resilience and Maintainability Implications

  • observed — Streaming transcription forwards the existing sender and context to the driver; handler completion and error-event behavior remains outside the wrapper.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: routing audio models through ASRModel and TTSModel wrappers.
Description check ✅ Passed The description explains the problem, the wrapper-based refactor, the affected call paths, and the no-functional-change classification. It does not use the template heading "### Summary", but it provi…
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the speech model’s tune,
Then sends a transcript beneath the moon.
Two wrappers hop where direct calls ran,
They pass each config as drivers scan.
Softly, the audio flows anew.

Comment @coderabbitai help to get the list of available commands.

@wangq8
wangq8 merged commit 2dac3d5 into infiniflow:main Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants