Skip to content

Commit 080372b

Browse files
committed
Make each word from ChatGPT wait for a few milliseconds
Azure OpenAI is incredibly quick in generating each part of its response, but there is a substantial delay between each section of the reply. This delay can make it seem like the streaming is malfunctioning.
1 parent 69d6682 commit 080372b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Core/Sources/OpenAIService/ChatGPTService.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ public actor ChatGPTService: ChatGPTServiceType {
187187
if let content = delta.content {
188188
continuation.yield(content)
189189
}
190+
191+
try await Task.sleep(nanoseconds: 10_000_000)
190192
}
191193

192194
continuation.finish()

0 commit comments

Comments
 (0)