File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 22using System . IO ;
33using System . Threading ;
44using System . Threading . Tasks ;
5+ using FluentAssertions ;
56using Mochineko . Relent . UncertainResult ;
67using NUnit . Framework ;
78using UnityEngine ;
@@ -29,7 +30,7 @@ public async Task Transcribe()
2930
3031 using var httpClient = new System . Net . Http . HttpClient ( ) ;
3132
32- var result = await TranscriptionAPI
33+ var apiResult = await TranscriptionAPI
3334 . TranscribeFromFileAsync (
3435 apiKey ,
3536 httpClient ,
@@ -38,11 +39,12 @@ public async Task Transcribe()
3839 file : filePath ,
3940 Model . Whisper1 ) ,
4041 CancellationToken . None ) ;
41- switch ( result )
42+ switch ( apiResult )
4243 {
4344 case IUncertainSuccessResult < string > success :
44- var json = TranscriptionResponseBody . FromJson ( success . Result ) ;
45- Debug . Log ( $ "Result:\n { json ? . Text } ") ;
45+ var result = TranscriptionResponseBody . FromJson ( success . Result ) ? . Text ;
46+ Debug . Log ( $ "[Whisper_API.Tests] Result: { result } .") ;
47+ result ? . Should ( ) . Be ( "とりあえず店の前、掃除しといてくれ。 内水も頼む。" ) ;
4648 break ;
4749
4850 case IUncertainRetryableResult < string > retryable :
@@ -54,7 +56,7 @@ public async Task Transcribe()
5456 break ;
5557
5658 default :
57- throw new UncertainResultPatternMatchException ( nameof ( result ) ) ;
59+ throw new UncertainResultPatternMatchException ( nameof ( apiResult ) ) ;
5860 }
5961 }
6062 }
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public static async UniTask<IUncertainResult<string>> TranscribeAsync(
4949
5050 if ( cancellationToken . IsCancellationRequested )
5151 {
52- return UncertainResults . RetryWithTrace < string > ( $ "Already canceled .") ;
52+ return UncertainResults . RetryWithTrace < string > ( $ "Already cancelled .") ;
5353 }
5454
5555 // Create request
You can’t perform that action at this time.
0 commit comments