RageAgainstThePixel / com.rest.elevenlabs

A non-official Eleven Labs voice synthesis client for Unity (UPM)
https://elevenlabs.io/?from=partnerbrown9849
MIT License
74 stars 9 forks source link

Small bug with error out when Stability is 0 #26

Closed dclipca closed 10 months ago

dclipca commented 1 year ago

In the Dashboard, when attempting to save a voice and setting Stability to 0, it will error out.

Utilities.WebRequestRest.RestException: [422] https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM Failed!
[Headers]
date: Mon, 17 Jul 2023 16:49:46 GMT
server: uvicorn
content-length: 137
content-type: application/json
access-control-allow-origin: *
access-control-allow-headers: *
access-control-allow-methods: POST, OPTIONS, DELETE, GET
Via: 1.1 google
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
[Data] 137 bytes
[Body]
{"detail":[{"loc":["body","voice_settings"],"msg":"__init__() missing 1 required positional argument: 'stability'","type":"type_error"}]}
[Errors]
HTTP/1.1 422 Unprocessable Entity

  at Utilities.WebRequestRest.Rest.Validate (Utilities.WebRequestRest.Response response, System.Boolean debug, System.String methodName) [0x00020] in D:\projectvr\project\Library\PackageCache\com.utilities.rest@2.1.0\Runtime\Rest.cs:1145 
  at ElevenLabs.TextToSpeech.TextToSpeechEndpoint.TextToSpeechAsync (System.String text, ElevenLabs.Voices.Voice voice, ElevenLabs.Voices.VoiceSettings voiceSettings, ElevenLabs.Models.Model model, System.Nullable`1[T] optimizeStreamingLatency, System.String saveDirectory, System.Boolean deleteCachedFile, System.Threading.CancellationToken cancellationToken) [0x003de] in D:\projectvr\project\Library\PackageCache\com.rest.elevenlabs@2.0.5\Runtime\TextToSpeech\TextToSpeechEndpoint.cs:113 
  at ElevenLabs.Editor.ElevenLabsEditorWindow.GenerateSynthesizedText () [0x000cf] in D:\projectvr\project\Library\PackageCache\com.rest.elevenlabs@2.0.5\Editor\ElevenLabsEditorWindow.cs:1029 
UnityEngine.Debug:LogError (object)
ElevenLabs.Editor.ElevenLabsEditorWindow/<GenerateSynthesizedText>d__93:MoveNext () (at Library/PackageCache/com.rest.elevenlabs@2.0.5/Editor/ElevenLabsEditorWindow.cs:1053)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Tuple`2<string, UnityEngine.AudioClip>>:SetException (System.Exception)
ElevenLabs.TextToSpeech.TextToSpeechEndpoint/<TextToSpeechAsync>d__3:MoveNext () (at Library/PackageCache/com.rest.elevenlabs@2.0.5/Runtime/TextToSpeech/TextToSpeechEndpoint.cs:146)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Utilities.WebRequestRest.Response>:SetResult (Utilities.WebRequestRest.Response)
Utilities.WebRequestRest.Rest/<PostAsync>d__10:MoveNext () (at Library/PackageCache/com.utilities.rest@2.1.0/Runtime/Rest.cs:154)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Utilities.WebRequestRest.Response>:SetResult (Utilities.WebRequestRest.Response)
Utilities.WebR

Of course, this suggests client doesn't send the parameter to the API at all. Thank you for this wrapper by the way. It's excellent.

StephenHodgson commented 1 year ago

I think I have a json serialization option to exclude default values, I'll have to take a look and see if I can disable it for certain parameters.