Repository navigation
feat(stt): add FunASR / SenseVoice provider - #16473
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds FunASR as a local speech-to-text provider in backend and frontend configuration. Separately updates Markdown fenced-code parsing to accept tilde fences, enforce opening/closing fence matching, and refine block boundary detection. ChangesFunASR Provider Integration
Markdown Parser CommonMark Fence Fixes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
deepdoc/parser/markdown_parser.py (2)
467-496: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRedundant
_get_fence_marker()call; recomputesfence_char/length below.Line 470 unpacks
fence_char, fence_lenvia_get_fence_marker(), but both are immediately recomputed at Lines 481-492 andfence_lenis never used. You can drop the Line 470 call (or reuse its result) to avoid the duplicate parse.♻️ Proposed cleanup
def _extract_code_block(self, start_pos): end_pos = start_pos content_lines = [self.lines[start_pos]] - fence_char, fence_len = self._get_fence_marker(self.lines[start_pos])🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deepdoc/parser/markdown_parser.py` around lines 467 - 496, The _extract_code_block method in markdown_parser has a redundant _get_fence_marker() call whose results are immediately recomputed and the fence_len value is never used. Remove the unused unpacking at the start of _extract_code_block, or reuse the returned fence_char/fence_len consistently when building the closing-fence regex, so the fence parsing logic is defined in one place only.
301-339: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove
_atomic_region_ranges()or wire it into_protected_ranges()
deepdoc/parser/markdown_parser.py:301-339— this helper isn’t referenced anywhere;_protected_ranges()still uses_fenced_code_ranges(), which already handles the same fenced-code boundaries. If the new helper is meant to harden delimiter extraction, swap it in; otherwise drop it as dead code.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deepdoc/parser/markdown_parser.py` around lines 301 - 339, The new _atomic_region_ranges() helper is currently unused, while _protected_ranges() still relies on _fenced_code_ranges() for fenced-code exclusion. Either update _protected_ranges() in markdown_parser.py to call _atomic_region_ranges() if this is the intended hardened range detector, or remove _atomic_region_ranges() entirely and keep the existing fenced-code path consistent. Use the _protected_ranges, _fenced_code_ranges, and _atomic_region_ranges symbols to locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@deepdoc/parser/markdown_parser.py`:
- Around line 467-496: The _extract_code_block method in markdown_parser has a
redundant _get_fence_marker() call whose results are immediately recomputed and
the fence_len value is never used. Remove the unused unpacking at the start of
_extract_code_block, or reuse the returned fence_char/fence_len consistently
when building the closing-fence regex, so the fence parsing logic is defined in
one place only.
- Around line 301-339: The new _atomic_region_ranges() helper is currently
unused, while _protected_ranges() still relies on _fenced_code_ranges() for
fenced-code exclusion. Either update _protected_ranges() in markdown_parser.py
to call _atomic_region_ranges() if this is the intended hardened range detector,
or remove _atomic_region_ranges() entirely and keep the existing fenced-code
path consistent. Use the _protected_ranges, _fenced_code_ranges, and
_atomic_region_ranges symbols to locate the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7ac76a78-6c05-43ff-a546-77e48180c0a3
📒 Files selected for processing (6)
conf/llm_factories.jsondeepdoc/parser/markdown_parser.pyrag/llm/sequence2txt_model.pytest/unit_test/deepdoc/parser/test_markdown_parser.pyweb/src/constants/llm.tsweb/src/pages/user-setting/constants.tsx
|
Current head I rechecked the CodeRabbit nitpicks against the latest branch: the redundant Validation rerun locally: The PR is still mergeable, with CodeRabbit reporting success. |
|
Fresh FunASR/SenseVoice-side validation recheck (2026-07-07 UTC):
Caveat: the plain repo-level pytest command is not a useful signal in my bare validation environment because it imports the global unit-test |
818a295 to
173f886
Compare
|
Refreshed this FunASR/SenseVoice integration onto current Verification after the rebase:
The repository workflow jobs are skipped for this fork head rather than failing. @coderabbitai review |
|
✅ Action performedReview finished.
|
|
✅ Action performedReview finished.
|
Add the OpenAI-compatible transcription adapter, dynamic model discovery, current provider-schema wiring, documentation, and focused tests. Based on the provider proposal in infiniflow#15526 by @Rene0422. Signed-off-by: LauraGPT <[email protected]>
173f886 to
7aa7512
Compare
|
Replaced the branch with one focused FunASR provider commit ( Fresh validation on current
The implementation and PR description retain attribution to the original #15526 contribution by @Rene0422. @coderabbitai review |
|
✅ Action performedReview finished.
|
|
@Lynn-Inf, when you have a chance, could you please review this focused FunASR/SenseVoice provider addition? The PR is now a single commit covering 11 provider/model-registration files, with the unrelated parser changes removed; GitHub reports it clean and mergeable. Focused backend tests (7 passed), frontend tests (2 passed), Ruff, ESLint, Prettier, JSON validation, and |
|
Backend LGTM. @dcc123456 will review the frontend part. |
|
@yuzhichang, this PR now has backend LGTM from @Lynn-Inf and frontend approval from @dcc123456. The current head Could you add the |
|
The CI matrix has completed on head The subsequent test steps were skipped, so this is a shared-runner port collision rather than a FunASR provider failure. I attempted to rerun only the failed job, but GitHub requires repository admin rights for that action. @yuzhichang, could you rerun the failed job when convenient? |
Signed-off-by: LauraGPT <[email protected]>
|
The clean CI rerun has completed successfully on head
The rerun commit is tree-identical to the reviewed |
Summary
Adds FunASR as a self-hosted speech-to-text provider through its OpenAI-compatible
/v1/audio/transcriptionsendpoint.This is a focused replacement for #15526 by @Rene0422 and relates to #15448. The unrelated Markdown parser changes from the previous branch are intentionally removed so this PR contains only the FunASR provider integration.
SPEECH2TEXTfactory;FunASRSeq2txtwithsensevoiceandhttp://localhost:8000/v1defaults, an optional API key, URL normalization, and inherited transcription handling;/v1/modelsdynamically and expose every returned model as speech-to-text in the model picker;funasrasset;Validation
7 passedfunasr-server+ RAGFlow provider smoke test -> discoveredfun-asr-nano,sensevoice, andparaformer; transcribed a real WAV as我现在在录一段测试音频(10tokens,0.504s)ruff checkandruff format --checkon the changed Python filespython3 -m py_compileon the provider and its testSPEECH2TEXTfactory2 passednpm run build-> production build succeeded (14,181modules transformed)git diff --checkDeployment
Run FunASR separately and point the RAGFlow provider at it:
The API key remains optional because the stock local server does not require authentication. A key can still be supplied when the endpoint is protected by a gateway.