Skip to content

Go: implement TTS for fishaudio, openrouter and asr for fishaudio - #14926

Merged
JinHai-CN merged 3 commits into
infiniflow:mainfrom
Haruko386:main
May 14, 2026
Merged

JinHai-CN merged 3 commits into
infiniflow:mainfrom
Haruko386:main

Conversation

@Haruko386

@Haruko386 Haruko386 commented May 14, 2026 •

Copy link
Copy Markdown
Member

What problem does this PR solve?

This PR implement TTS for FishAudio and MiniMax provider and ASR for FishAudio

The following functionalities are now supported:

FishAudio:

  • Text To Speech
  • Stream Text To Speech
  • Audio To Text

OpenRouter:

  • Text To Speech

Verified examples from the CLI:


**FishAudio**

RAGFlow(user)> tts with 's1@test@fishaudio' text 'He who desires but acts not, breeds pestilence.' play format 'wav' save './internal' param '{"reference_id": "90e65eaaf50e4470b8e6d43ee6afd7d5", "temperature": 0.7, "top_p": 0.7, "prosody": {"speed": 1, "volume": 0, "normalize_loudness": true}, "chunk_length": 300, "normalize": true, "sample_rate": 44100, "mp3_bitrate": 128, "latency": "normal", "max_new_tokens": 1024, "repetition_penalty": 1.2, "min_chunk_length": 50, "condition_on_previous_chunks": true, "early_stop_threshold": 1}'
Saved to directory: /home/infiniflow/Documents/development/ragflow/internal/s1_output.wav
SUCCESS

RAGFlow(user)> stream tts with 's1@test@fishaudio' text 'He who desires but acts not, breeds pestilence.' play format 'wav' save './internal' param '{"reference_id": "90e65eaaf50e4470b8e6d43ee6afd7d5", "temperature": 0.7, "top_p": 0.7, "prosody": {"speed": 1, "volume": 0, "normalize_loudness": true}, "chunk_length": 300, "normalize": true, "sample_rate": 44100, "mp3_bitrate": 128, "latency": "normal", "max_new_tokens": 1024, "repetition_penalty": 1.2, "min_chunk_length": 50, "condition_on_previous_chunks": true, "early_stop_threshold": 1}'
Saved to directory: /home/infiniflow/Documents/development/ragflow/internal/s1_output.wav
SUCCESS

RAGFlow(user)> asr with 'transcribe-1@test@fishaudio' audio './internal/test.wav' param '{"language": "en", "ignore_timestamps": true}'
+----------------------------------------------------------------------------------------------------------------------+
| text                                                                                                                 |
+----------------------------------------------------------------------------------------------------------------------+
| The examination and testimony of the experts enabled the commission to conclude that five shots may have been fired. |
+----------------------------------------------------------------------------------------------------------------------+

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Refactoring

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 14, 2026
@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR implements complete ASR (automatic speech recognition) and TTS (text-to-speech) audio provider support for FishAudio and OpenRouter. It introduces type contracts with JSON serialization, configuration mappings for audio endpoints, enhanced CLI command parsing and execution, HTTP handler integration, and full provider-specific implementations including streaming response parsing.

Changes

Audio Provider Integration

Layer / File(s) Summary
Type Contracts & JSON Serialization
internal/entity/models/types.go
ASRResponse.Text, URLSuffix.ASR, ASRConfig.Params, and TTSConfig.Format fields are added/tagged with JSON serialization keys to support type-safe parameter passing across CLI, handler, and provider boundaries.
Model Configuration & Endpoints
conf/models/fishaudio.json, conf/models/openrouter.json
FishAudio defines URL suffixes for balance, tts, asr with three model entries (s2-pro, s1, transcribe-1). OpenRouter adds TTS endpoint and openai/gpt-audio-mini model for audio synthesis.
CLI Command Parsing for ASR
internal/cli/user_parser.go
parseASRCommand enhanced to parse required audio file argument, then iterate through optional param tokens until semicolon/EOF, collecting dynamic ASR configuration parameters.
CLI Command Execution & Response Handling
internal/cli/user_command.go
TTSUserCommand defaults format to mp3; ASRUserCommand enforces required audio_file, sends it as "file" key with optional asr_config, and extracts response text from unmarshalled rawResult structure.
HTTP Handler Request/Response Integration
internal/handler/providers.go
TranscribeAudioRequest struct gains optional asr_config field; handler conditionally applies request-provided ASR configuration before passing to transcription service methods.
FishAudio Provider Implementation
internal/entity/models/fishaudio.go
TranscribeAudio builds multipart/form-data POST with audio file and optional dynamic parameters; AudioSpeech sends JSON POST with optional format/params; AudioSpeechWithSender streams responses, parsing server-sent audio_base64 events and forwarding base64-decoded chunks via sender callback.
OpenRouter & MiniMax TTS Updates
internal/entity/models/openrouter.go, internal/entity/models/minimax.go
OpenRouter implements previously-stubbed AudioSpeech with API validation and TTS request construction. MiniMax updates both AudioSpeech and AudioSpeechWithSender to conditionally include audio_setting.format in request payloads when format is specified.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • infiniflow/ragflow#14790: Continues FishAudio integration by expanding fishaudio.go from stubbed functions into full TranscribeAudio/AudioSpeech implementations and updating conf/models/fishaudio.json with endpoint mappings.
  • infiniflow/ragflow#14836: Related scaffolding PR that adds ASR/TTS/OCR CLI and handler baseline; this PR refines request parsing and implements the actual provider driver methods.
  • infiniflow/ragflow#14652: Overlapping OpenRouter provider setup—both PRs update conf/models/openrouter.json and implement TTS support in openrouter.go.

Suggested labels

💞 feature, 🎯 audio, size:XL

Poem

🐰 Hop along this audio trail,
Speech to text and text to speech—no fail!
FishAudio swims, OpenRouter takes flight,
Your sound transforms from dark to light!
Parameters flow, streaming echoes ring,
What a chorus this config shall bring! 🎵

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: implementing TTS for FishAudio and OpenRouter, and ASR for FishAudio, which aligns with the changeset content.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description check ✅ Passed PR description includes problem statement, feature list, and verified CLI examples, but lacks explicit type-of-change checkboxes and detailed rationale.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

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

@Haruko386 Haruko386 added the ci Continue Integration label May 14, 2026
@Haruko386
Haruko386 marked this pull request as draft May 14, 2026 08:59
@Haruko386
Haruko386 marked this pull request as ready for review May 14, 2026 08:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 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/cli/user_command.go`:
- Around line 2183-2199: The assignment to result.Message uses an unsafe type
assertion rawResult.Data["text"].(string) which can panic if the "text" key is
missing or not a string; in the function handling the ASR response, replace that
with a safe two-value assertion (v, ok := rawResult.Data["text"].(string)),
check ok (and presence), and handle the failure path by returning a clear error
(e.g., fmt.Errorf("ASR document invalid: missing or non-string text field")) or
assigning a sensible default before setting result.Message on the CommonResponse
variable.

In `@internal/entity/models/fishaudio.go`:
- Around line 224-227: Guard the modelName pointer before dereferencing: check
if modelName == nil or *modelName == "" before calling req.Header.Set("model",
*modelName) (and the other occurrence around lines 286-289), and either skip
setting the "model" header or use a safe default; ensure the Authorization
header still uses apiConfig.ApiKey safely (validate apiConfig.ApiKey != nil) and
update the request-building code where req.Header.Set is called so no nil
pointer is dereferenced.
- Around line 88-89: The code constructs provider URLs using f.BaseURL[region]
(e.g., url := fmt.Sprintf("%s/%s", f.BaseURL[region], f.URLSuffix.ASR)) without
validating that region exists; add a region fallback lookup before any URL
construction: determine regionKey := apiConfig.Region (or computed region) and
if f.BaseURL[regionKey] is missing, fall back to f.BaseURL["default"] (or
another configured fallback) and return a clear config error if no fallback
exists; apply the same guard/fallback logic to the other occurrences that build
URLs (the lines using f.BaseURL at the other sites referenced around 199-200 and
260) so URL construction is never attempted with a missing map key.

In `@internal/entity/models/minimax.go`:
- Around line 491-495: The current code unconditionally replaces
reqBody["audio_setting"] with a new map when asrConfig.Format is set, dropping
any existing fields injected via ttsConfig/asrConfig.Params; instead detect
whether reqBody["audio_setting"] already exists and is a map[string]interface{}
and then merge/assign the "format" key into that map (e.g., retrieve
reqBody["audio_setting"], type-assert to map[string]interface{} and set
m["format"]=asrConfig.Format) otherwise create the map as before; apply the same
merge logic to the other occurrence handling audio_setting (the block around the
later lines 589-593) so existing voice/speed/sample-rate fields are preserved.

In `@internal/entity/models/openrouter.go`:
- Around line 563-566: The code builds reqBody with "model": modelName without
validating modelName, which can serialize nil to null; before constructing
reqBody (in the function that assembles reqBody using modelName and audioContent
in openrouter.go), check that modelName is non-nil and non-empty (if it's a
*string check for nil then dereference; if string check for ""), and return a
clear error if invalid; only include "model" in reqBody when valid so the
serialized payload never contains null and upstream errors are avoided.
- Around line 555-561: The code picks region from apiConfig.Region into the
local variable region and then indexes o.BaseURL[region] without handling
unknown keys, which can yield an empty string; update the logic where region is
computed and URL is built (referencing region, apiConfig.Region, o.BaseURL, and
o.URLSuffix.TTS) to check whether o.BaseURL contains the chosen region key and,
if not, fall back to "default" (or return a clear config error). Ensure the
final url uses the resolved/fallback region key when formatting
fmt.Sprintf("%s/%s", ...) so requests never use an empty base URL.
🪄 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

Run ID: 95b5b454-7834-4887-a3c5-d1598310c650

📥 Commits

Reviewing files that changed from the base of the PR and between a98994f and eeb71eb.

📒 Files selected for processing (9)
  • conf/models/fishaudio.json
  • conf/models/openrouter.json
  • internal/cli/user_command.go
  • internal/cli/user_parser.go
  • internal/entity/models/fishaudio.go
  • internal/entity/models/minimax.go
  • internal/entity/models/openrouter.go
  • internal/entity/models/types.go
  • internal/handler/providers.go

Comment on lines +2183 to +2199
var rawResult struct {
Code int `json:"code"`
Message string `json:"message"`
Data map[string]interface{} `json:"data"`
}

if err = json.Unmarshal(resp.Body, &rawResult); err != nil {
return nil, fmt.Errorf("ASR document failed: invalid JSON (%w)", err)
}
if result.Code != 0 {
return nil, fmt.Errorf("%s", result.Message)

if rawResult.Code != 0 {
return nil, fmt.Errorf("%s", rawResult.Message)
}

var result CommonResponse
result.Code = rawResult.Code
result.Message = rawResult.Data["text"].(string) // TODO

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing type-assertion safety guard.

Line 2199 performs an unsafe type assertion rawResult.Data["text"].(string) that will panic if the "text" key is missing or holds a non-string value. Add a safe two-value assertion to handle unexpected response formats gracefully.

🛡️ Proposed fix
 	var rawResult struct {
 		Code    int                    `json:"code"`
 		Message string                 `json:"message"`
 		Data    map[string]interface{} `json:"data"`
 	}
 
 	if err = json.Unmarshal(resp.Body, &rawResult); err != nil {
 		return nil, fmt.Errorf("ASR document failed: invalid JSON (%w)", err)
 	}
 
 	if rawResult.Code != 0 {
 		return nil, fmt.Errorf("%s", rawResult.Message)
 	}
 
 	var result CommonResponse
 	result.Code = rawResult.Code
-	result.Message = rawResult.Data["text"].(string) // TODO
+	text, ok := rawResult.Data["text"].(string)
+	if !ok {
+		return nil, fmt.Errorf("ASR response missing or invalid 'text' field")
+	}
+	result.Message = text
 	result.Duration = resp.Duration
 
 	return &result, nil
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var rawResult struct {
Code int `json:"code"`
Message string `json:"message"`
Data map[string]interface{} `json:"data"`
}
if err = json.Unmarshal(resp.Body, &rawResult); err != nil {
return nil, fmt.Errorf("ASR document failed: invalid JSON (%w)", err)
}
if result.Code != 0 {
return nil, fmt.Errorf("%s", result.Message)
if rawResult.Code != 0 {
return nil, fmt.Errorf("%s", rawResult.Message)
}
var result CommonResponse
result.Code = rawResult.Code
result.Message = rawResult.Data["text"].(string) // TODO
var rawResult struct {
Code int `json:"code"`
Message string `json:"message"`
Data map[string]interface{} `json:"data"`
}
if err = json.Unmarshal(resp.Body, &rawResult); err != nil {
return nil, fmt.Errorf("ASR document failed: invalid JSON (%w)", err)
}
if rawResult.Code != 0 {
return nil, fmt.Errorf("%s", rawResult.Message)
}
var result CommonResponse
result.Code = rawResult.Code
text, ok := rawResult.Data["text"].(string)
if !ok {
return nil, fmt.Errorf("ASR response missing or invalid 'text' field")
}
result.Message = text
🤖 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 `@internal/cli/user_command.go` around lines 2183 - 2199, The assignment to
result.Message uses an unsafe type assertion rawResult.Data["text"].(string)
which can panic if the "text" key is missing or not a string; in the function
handling the ASR response, replace that with a safe two-value assertion (v, ok
:= rawResult.Data["text"].(string)), check ok (and presence), and handle the
failure path by returning a clear error (e.g., fmt.Errorf("ASR document invalid:
missing or non-string text field")) or assigning a sensible default before
setting result.Message on the CommonResponse variable.

Comment on lines +88 to +89
url := fmt.Sprintf("%s/%s", f.BaseURL[region], f.URLSuffix.ASR)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add region fallback before building provider URLs.

These new paths use f.BaseURL[region] directly. If apiConfig.Region is set to an unknown key, URL construction becomes invalid and requests fail with transport errors instead of clean config errors/fallback.

Proposed fix
-	url := fmt.Sprintf("%s/%s", f.BaseURL[region], f.URLSuffix.ASR)
+	baseURL := f.BaseURL[region]
+	if baseURL == "" {
+		baseURL = f.BaseURL["default"]
+	}
+	url := fmt.Sprintf("%s/%s", baseURL, f.URLSuffix.ASR)

Also applies to: 199-200, 260-260

🤖 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 `@internal/entity/models/fishaudio.go` around lines 88 - 89, The code
constructs provider URLs using f.BaseURL[region] (e.g., url :=
fmt.Sprintf("%s/%s", f.BaseURL[region], f.URLSuffix.ASR)) without validating
that region exists; add a region fallback lookup before any URL construction:
determine regionKey := apiConfig.Region (or computed region) and if
f.BaseURL[regionKey] is missing, fall back to f.BaseURL["default"] (or another
configured fallback) and return a clear config error if no fallback exists;
apply the same guard/fallback logic to the other occurrences that build URLs
(the lines using f.BaseURL at the other sites referenced around 199-200 and 260)
so URL construction is never attempted with a missing map key.

Comment on lines +224 to +227
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", *apiConfig.ApiKey))
req.Header.Set("model", *modelName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Guard modelName before dereferencing to avoid panic.

Line 226 and Line 288 dereference *modelName without nil/empty validation. A nil modelName will panic before any API error handling.

Proposed fix
 func (f *FishAudioModel) AudioSpeech(modelName *string, audioContent *string, apiConfig *APIConfig, asrConfig *TTSConfig) (*TTSResponse, error) {
+	if modelName == nil || *modelName == "" {
+		return nil, fmt.Errorf("model name is missing")
+	}
 	if apiConfig == nil || apiConfig.ApiKey == nil || *apiConfig.ApiKey == "" {
 		return nil, fmt.Errorf("FishAudio API key is missing")
 	}
@@
 func (f *FishAudioModel) AudioSpeechWithSender(modelName *string, audioContent *string, apiConfig *APIConfig, asrConfig *TTSConfig, sender func(*string, *string) error) error {
+	if modelName == nil || *modelName == "" {
+		return fmt.Errorf("model name is missing")
+	}
 	if apiConfig == nil || apiConfig.ApiKey == nil || *apiConfig.ApiKey == "" {
 		return fmt.Errorf("FishAudio API key is missing")
 	}

Also applies to: 286-289

🤖 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 `@internal/entity/models/fishaudio.go` around lines 224 - 227, Guard the
modelName pointer before dereferencing: check if modelName == nil or *modelName
== "" before calling req.Header.Set("model", *modelName) (and the other
occurrence around lines 286-289), and either skip setting the "model" header or
use a safe default; ensure the Authorization header still uses apiConfig.ApiKey
safely (validate apiConfig.ApiKey != nil) and update the request-building code
where req.Header.Set is called so no nil pointer is dereferenced.

Comment on lines +491 to +495
if asrConfig != nil && asrConfig.Format != "" {
reqBody["audio_setting"] = map[string]interface{}{
"format": asrConfig.Format,
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid overwriting audio_setting from caller params.

The new audio_setting assignment replaces any existing audio_setting object injected via ttsConfig/asrConfig.Params, which can drop fields (voice, speed, sample rate, etc.). Merge format into an existing map instead of replacing it.

Proposed fix
 if asrConfig != nil && asrConfig.Format != "" {
-	reqBody["audio_setting"] = map[string]interface{}{
-		"format": asrConfig.Format,
-	}
+	audioSetting, _ := reqBody["audio_setting"].(map[string]interface{})
+	if audioSetting == nil {
+		audioSetting = map[string]interface{}{}
+	}
+	audioSetting["format"] = asrConfig.Format
+	reqBody["audio_setting"] = audioSetting
 }

Also applies to: 589-593

🤖 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 `@internal/entity/models/minimax.go` around lines 491 - 495, The current code
unconditionally replaces reqBody["audio_setting"] with a new map when
asrConfig.Format is set, dropping any existing fields injected via
ttsConfig/asrConfig.Params; instead detect whether reqBody["audio_setting"]
already exists and is a map[string]interface{} and then merge/assign the
"format" key into that map (e.g., retrieve reqBody["audio_setting"], type-assert
to map[string]interface{} and set m["format"]=asrConfig.Format) otherwise create
the map as before; apply the same merge logic to the other occurrence handling
audio_setting (the block around the later lines 589-593) so existing
voice/speed/sample-rate fields are preserved.

Comment on lines +555 to +561
var region = "default"
if apiConfig.Region != nil && *apiConfig.Region != "" {
region = *apiConfig.Region
}

url := fmt.Sprintf("%s/%s", o.BaseURL[region], o.URLSuffix.TTS)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add base URL fallback for unknown region keys.

If a non-existent region key is provided, o.BaseURL[region] is empty and the request fails before reaching OpenRouter. Falling back to default (or returning explicit config error) makes this path robust.

🤖 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 `@internal/entity/models/openrouter.go` around lines 555 - 561, The code picks
region from apiConfig.Region into the local variable region and then indexes
o.BaseURL[region] without handling unknown keys, which can yield an empty
string; update the logic where region is computed and URL is built (referencing
region, apiConfig.Region, o.BaseURL, and o.URLSuffix.TTS) to check whether
o.BaseURL contains the chosen region key and, if not, fall back to "default" (or
return a clear config error). Ensure the final url uses the resolved/fallback
region key when formatting fmt.Sprintf("%s/%s", ...) so requests never use an
empty base URL.

Comment on lines +563 to +566
reqBody := map[string]interface{}{
"model": modelName,
"input": audioContent,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Validate modelName before request serialization.

modelName is not validated in this method. A nil pointer serializes to null, causing avoidable upstream errors and harder debugging.

🤖 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 `@internal/entity/models/openrouter.go` around lines 563 - 566, The code builds
reqBody with "model": modelName without validating modelName, which can
serialize nil to null; before constructing reqBody (in the function that
assembles reqBody using modelName and audioContent in openrouter.go), check that
modelName is non-nil and non-empty (if it's a *string check for nil then
dereference; if string check for ""), and return a clear error if invalid; only
include "model" in reqBody when valid so the serialized payload never contains
null and upstream errors are avoided.

@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.16%. Comparing base (63df01f) to head (eeb71eb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14926   +/-   ##
=======================================
  Coverage   94.16%   94.16%           
=======================================
  Files          10       10           
  Lines         703      703           
  Branches      112      112           
=======================================
  Hits          662      662           
  Misses         25       25           
  Partials       16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JinHai-CN
JinHai-CN merged commit 106f4b7 into infiniflow:main May 14, 2026
1 check passed
tmimmanuel pushed a commit to tmimmanuel/ragflow that referenced this pull request May 14, 2026
…finiflow#14926)

### What problem does this PR solve?

This PR implement TTS for FishAudio and MiniMax provider and ASR for
FishAudio

**The following functionalities are now supported:**

**FishAudio:**
- [x] Text To Speech
- [x] Stream Text To Speech
- [x] Audio To Text

**OpenRouter:**

- [x] Text To Speech

**Verified examples from the CLI:**
```plaintext

**FishAudio**

RAGFlow(user)> tts with 's1@test@fishaudio' text 'He who desires but acts not, breeds pestilence.' play format 'wav' save './internal' param '{"reference_id": "90e65eaaf50e4470b8e6d43ee6afd7d5", "temperature": 0.7, "top_p": 0.7, "prosody": {"speed": 1, "volume": 0, "normalize_loudness": true}, "chunk_length": 300, "normalize": true, "sample_rate": 44100, "mp3_bitrate": 128, "latency": "normal", "max_new_tokens": 1024, "repetition_penalty": 1.2, "min_chunk_length": 50, "condition_on_previous_chunks": true, "early_stop_threshold": 1}'
Saved to directory: /home/infiniflow/Documents/development/ragflow/internal/s1_output.wav
SUCCESS

RAGFlow(user)> stream tts with 's1@test@fishaudio' text 'He who desires but acts not, breeds pestilence.' play format 'wav' save './internal' param '{"reference_id": "90e65eaaf50e4470b8e6d43ee6afd7d5", "temperature": 0.7, "top_p": 0.7, "prosody": {"speed": 1, "volume": 0, "normalize_loudness": true}, "chunk_length": 300, "normalize": true, "sample_rate": 44100, "mp3_bitrate": 128, "latency": "normal", "max_new_tokens": 1024, "repetition_penalty": 1.2, "min_chunk_length": 50, "condition_on_previous_chunks": true, "early_stop_threshold": 1}'
Saved to directory: /home/infiniflow/Documents/development/ragflow/internal/s1_output.wav
SUCCESS

RAGFlow(user)> asr with 'transcribe-1@test@fishaudio' audio './internal/test.wav' param '{"language": "en", "ignore_timestamps": true}'
+----------------------------------------------------------------------------------------------------------------------+
| text                                                                                                                 |
+----------------------------------------------------------------------------------------------------------------------+
| The examination and testimony of the experts enabled the commission to conclude that five shots may have been fired. |
+----------------------------------------------------------------------------------------------------------------------+

```

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [x] Refactoring
@coderabbitai coderabbitai Bot mentioned this pull request May 27, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants