mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-17 04:44:40 +08:00
- DashScope paraformer-realtime-v2 WebSocket streaming - Language-aware provider routing: Whisper for English, Paraformer for Chinese - PCM WAV recording replaces WebM (provider filename bug + diagnostics) - TalkMode push-to-talk fixes (audio drop, WS connecting race) - Vite dev proxy WebSocket upgrade fix - WebSocket binary buffer 8KB → 8MB (Tomcat default truncated voice clips) - Audio chunk pacing at 100ms (DashScope returned 0 chars otherwise) - Resolved language hint propagation + raw frame logging - V46 seed idempotency fix on UI-toggled STT row - Diagnostic cleanup after debugging session
46 lines
1.7 KiB
Java
46 lines
1.7 KiB
Java
package vip.mate.stt;
|
|
|
|
import vip.mate.system.model.SystemSettingsDTO;
|
|
|
|
/**
|
|
* STT 语音识别提供商接口.
|
|
*
|
|
* <p>Auto-detect ordering uses ascending priority (low number = preferred).
|
|
* Most providers can use the default {@link #autoDetectOrder()} value, but
|
|
* providers with strong language bias should override
|
|
* {@link #autoDetectOrder(String)} so the registry picks the right primary
|
|
* for the user's locale: OpenAI Whisper is the canonical English path,
|
|
* DashScope Paraformer is the canonical Chinese path. Mixing them up at
|
|
* dispatch time costs accuracy AND latency (the wrong primary tends to
|
|
* produce garbage that the fallback can't easily compensate for).
|
|
*/
|
|
public interface SttProvider {
|
|
String id();
|
|
String label();
|
|
boolean requiresCredential();
|
|
int autoDetectOrder();
|
|
boolean isAvailable(SystemSettingsDTO config);
|
|
|
|
/**
|
|
* Per-language priority hook. Default implementation returns the
|
|
* language-agnostic {@link #autoDetectOrder()} value, so existing
|
|
* providers stay backwards-compatible. Override when the provider has
|
|
* a known language strength — e.g. OpenAI Whisper returns a smaller
|
|
* number for {@code "en"} than for {@code "zh"} to win the auto-pick
|
|
* for English users.
|
|
*
|
|
* @param language IETF / ISO-639 language hint, possibly {@code null}.
|
|
* Implementations should match conservatively (prefix
|
|
* match on {@code zh}, {@code en}, etc.) and gracefully
|
|
* fall back to {@link #autoDetectOrder()} on unknown.
|
|
*/
|
|
default int autoDetectOrder(String language) {
|
|
return autoDetectOrder();
|
|
}
|
|
|
|
/**
|
|
* 转写音频
|
|
*/
|
|
SttResult transcribe(SttRequest request, SystemSettingsDTO config);
|
|
}
|