mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/JiboExperiments.git
synced 2026-06-17 01:56:26 +00:00
version 18 fixes
This commit is contained in:
@@ -53,6 +53,30 @@ public sealed class LocalWhisperCppBufferedAudioSttStrategyTests
|
||||
Assert.False(strategy.CanHandle(turn));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanHandle_ReturnsFalse_WhenBufferedAudioHasNoOpusIdentificationHeader()
|
||||
{
|
||||
var strategy = new LocalWhisperCppBufferedAudioSttStrategy(
|
||||
new BufferedAudioSttOptions
|
||||
{
|
||||
EnableLocalWhisperCpp = true,
|
||||
FfmpegPath = "ffmpeg",
|
||||
WhisperCliPath = "whisper-cli",
|
||||
WhisperModelPath = "model.bin"
|
||||
},
|
||||
new FakeExternalProcessRunner());
|
||||
|
||||
var turn = new TurnContext
|
||||
{
|
||||
Attributes = new Dictionary<string, object?>
|
||||
{
|
||||
["bufferedAudioFrames"] = new[] { BuildMinimalOggPageWithoutOpusHead() }
|
||||
}
|
||||
};
|
||||
|
||||
Assert.False(strategy.CanHandle(turn));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TranscribeAsync_UsesFfmpegAndWhisperCpp_WhenConfigured()
|
||||
{
|
||||
@@ -119,6 +143,13 @@ public sealed class LocalWhisperCppBufferedAudioSttStrategyTests
|
||||
];
|
||||
}
|
||||
|
||||
private static byte[] BuildMinimalOggPageWithoutOpusHead()
|
||||
{
|
||||
var page = BuildMinimalOggPage();
|
||||
"NotAudio"u8.CopyTo(page.AsSpan(28, 8));
|
||||
return page;
|
||||
}
|
||||
|
||||
private sealed class FakeExternalProcessRunner : IExternalProcessRunner
|
||||
{
|
||||
public List<(string FileName, IReadOnlyList<string> Arguments)> Calls { get; } = [];
|
||||
|
||||
Reference in New Issue
Block a user