Skip to content

Commit af3ab69

Browse files
committed
Fix chatgpt request cancellation
1 parent be57514 commit af3ab69

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Core/Sources/OpenAIService/ChatGPTService.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ public actor ChatGPTService: ChatGPTServiceType {
128128
Task {
129129
do {
130130
let (trunks, cancel) = try await api()
131+
guard isReceivingMessage else {
132+
continuation.finish()
133+
return
134+
}
131135
cancelTask = cancel
132136
for try await trunk in trunks {
133137
guard let delta = trunk.choices.first?.delta else { continue }

0 commit comments

Comments
 (0)