feat: integrate Sherpa-ONNX local offline speech recognition engine
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'sherpa_stt_service.dart';
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
|
||||
@@ -118,6 +119,12 @@ class AiService {
|
||||
required String endpoint,
|
||||
required String model,
|
||||
}) async {
|
||||
if (filePath.toLowerCase().endsWith('.wav')) {
|
||||
final localText = await SherpaSttService.instance.transcribeWav(filePath);
|
||||
if (localText != null && localText.trim().isNotEmpty) {
|
||||
return localText.trim();
|
||||
}
|
||||
}
|
||||
if (provider == AiProviderType.mock) return null;
|
||||
final file = File(filePath);
|
||||
if (!await file.exists()) return null;
|
||||
|
||||
Reference in New Issue
Block a user