Merge pull request #934 from yileicn/master
optimize input audio transcription
This commit is contained in:
commit
d835ff95b2
|
|
@ -72,4 +72,10 @@ public class InputAudioTranscription
|
|||
{
|
||||
[JsonPropertyName("model")]
|
||||
public string Model { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("language")]
|
||||
public string Language { get; set; } = "en";
|
||||
|
||||
[JsonPropertyName("prompt")]
|
||||
public string Prompt { get; set; }
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
|
|||
{
|
||||
result = await _webSocket.ReceiveAsync(
|
||||
new ArraySegment<byte>(buffer), CancellationToken.None);
|
||||
|
||||
|
||||
// Convert received data to text/audio (Twilio sends Base64-encoded audio)
|
||||
string receivedText = Encoding.UTF8.GetString(buffer, 0, result.Count);
|
||||
if (string.IsNullOrEmpty(receivedText))
|
||||
|
|
@ -319,6 +319,7 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
|
|||
InputAudioTranscription = new InputAudioTranscription
|
||||
{
|
||||
Model = "whisper-1",
|
||||
Language = "en",
|
||||
},
|
||||
Voice = "alloy",
|
||||
Instructions = instruction,
|
||||
|
|
@ -329,7 +330,7 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
|
|||
MaxResponseOutputTokens = 512,
|
||||
TurnDetection = new RealtimeSessionTurnDetection
|
||||
{
|
||||
Threshold = 0.8f,
|
||||
Threshold = 0.9f,
|
||||
PrefixPadding = 300,
|
||||
SilenceDuration = 800
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue