Skip to content

Commit ea9597f

Browse files
authored
Merge pull request #19 from gbfansheng/main
fix: correct stream completion detection in OpenAI response
2 parents b7cd129 + b8f2f74 commit ea9597f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Core/Sources/CodeCompletionService/API/OpenAIService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ extension OpenAIService {
170170
ChatCompletionsStreamDataChunk.self,
171171
from: text.data(using: .utf8) ?? Data()
172172
)
173-
return .init(chunk: chunk, done: chunk.choices?.first?.delta?.content != nil)
173+
return .init(chunk: chunk, done: chunk.choices?.first?.finish_reason != nil)
174174
} catch {
175175
print(error)
176176
throw error

0 commit comments

Comments
 (0)