I find that this eventsource received openai stream in wrong order . the
`
let eventSource = EventSource(request: urlRequest)
eventSource.maxRetryCount = 1
eventSource.connect()
Task{
for await event in eventSource.events {
switch event {
case .open:
print("Connection was opened.")
case .error(let error):
print("Received an error:", error.localizedDescription)
case .message(let message):
if (message.data != nil){
print("Received a message", message.data ?? "")
let res = json2Dict(jsonString: message.data!)
if res != nil {
completion(res!)
} else {
print("receieved res empty")
}
} else {
print("messaeg data empty")
}
case .closed:
print("Connection was closed.")
}
}
}
I find that this eventsource received openai stream in wrong order . the ` let eventSource = EventSource(request: urlRequest)
`
any thing wrong with the code?