You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also had that error, I managed to modify the source code to solve it, I changed the stop logic of the cycle that received the streams, I attach the modified code fragment of the OpenAIApi.cs that is inside Runtime so that you can add it and test it. I have already generated the pr to be added to the source code.
Script :
/// <summary>/// Dispatches an HTTP request to the specified path with the specified method and optional payload./// </summary>/// <param name="path">The path to send the request to.</param>/// <param name="method">The HTTP method to use for the request.</param>/// <param name="onResponse">A callback function to be called when a response is updated.</param>/// <param name="onComplete">A callback function to be called when the request is complete.</param>/// <param name="token">A cancellation token to cancel the request.</param>/// <param name="payload">An optional byte array of json payload to include in the request.</param>privateasyncvoidDispatchRequest<T>(stringpath,stringmethod,Action<List<T>>onResponse,ActiononComplete,CancellationTokenSourcetoken,byte[]payload=null)whereT:IResponse{using(varrequest=UnityWebRequest.Put(path,payload)){request.method=method;request.SetHeaders(Configuration,ContentType.ApplicationJson);request.SendWebRequest();boolisDone=false;do{List<T>dataList=newList<T>();string[]lines=request.downloadHandler.text.Split('\n').Where(line =>line!="").ToArray();foreach(stringlineinlines){varvalue=line.Replace("data: ","");if(value.Contains("stop")){isDone=true;break;}vardata=JsonConvert.DeserializeObject<T>(value,jsonSerializerSettings);if(data?.Error!=null){ApiErrorerror=data.Error;Debug.LogError($"Error Message: {error.Message}\nError Type: {error.Type}\n");}else{dataList.Add(data);}}onResponse?.Invoke(dataList);awaitTask.Yield();}while(!isDone);onComplete?.Invoke();}}
Activity
SebastianBlandon commentedon Oct 27, 2023
I also had that error, I managed to modify the source code to solve it, I changed the stop logic of the cycle that received the streams, I attach the modified code fragment of the OpenAIApi.cs that is inside Runtime so that you can add it and test it. I have already generated the pr to be added to the source code.
Script :