Repository navigation
fix: allow local FunASR without API key - #17388
Conversation
📝 WalkthroughWalkthroughFunASR now permits API-key-free requests, validates and trims transcription model names, and conditionally sets authorization headers. New tests cover transcription, model listing, missing credentials, authentication, multipart fields, and response handling. ChangesFunASR request handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@internal/entity/models/funasr_test.go`:
- Around line 55-58: Add test cases around TranscribeAudio in newFunASRForTest
covering a whitespace-only model name that returns “model name is missing” and a
model name with surrounding spaces that serializes as “fun-asr-nano”, alongside
the existing nil and trimmed-name cases.
- Line 46: Update the multipart form parsing error path in the server handler to
call t.Errorf instead of t.Fatalf, then return immediately so the handler
goroutine stops safely while the test records the failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a7d6237c-f689-46dc-ab76-1e477b92976b
📒 Files selected for processing (2)
internal/entity/models/funasr.gointernal/entity/models/funasr_test.go
|
@JinHai-CN, could you review this small follow-up to the FunASR provider from #17171 when convenient? It fixes the default local deployment path: an empty API key is now accepted, the Authorization header is omitted unless configured, and a missing model name returns an error instead of being dereferenced. The current head is mergeable/CLEAN with no unresolved review threads or failed/pending checks. Focused and package-level Go tests pass, and CodeRabbit's two test findings were addressed with regression coverage. |
Summary
The FunASR provider added in #17171 defaults to a local
http://localhost:8000/v1server, but it still inherited the global API-key requirement and unconditionally built an Authorization header. This prevented the default unauthenticated self-hosted deployment from working. The transcription path also dereferenced a missing model name while building its multipart request.This change:
User impact
Users can connect RAGFlow to the default local FunASR server without inventing a placeholder API key. Authenticated compatible endpoints continue to receive a standard Bearer header.
Tests
go test ./internal/entity/models -run '^TestFunASR' -count=1 -vgo test ./internal/entity/models -count=1git diff --check