File tree Expand file tree Collapse file tree
ChatPlugins/ShortcutChatPlugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,13 +90,17 @@ public actor ShortcutInputChatPlugin: ChatPlugin {
9090 if let text = String ( data: data, encoding: . utf8) {
9191 if text. isEmpty { return }
9292 let stream = try await chatGPTService. send ( content: text, summary: nil )
93- for try await _ in stream { }
93+ do {
94+ for try await _ in stream { }
95+ } catch { }
9496 } else {
9597 let text = """
9698 [View File]( \( temporaryOutputFileURL) )
9799 """
98100 let stream = try await chatGPTService. send ( content: text, summary: nil )
99- for try await _ in stream { }
101+ do {
102+ for try await _ in stream { }
103+ } catch { }
100104 }
101105
102106 return
Original file line number Diff line number Diff line change @@ -40,8 +40,12 @@ public final class ChatService: ObservableObject {
4040
4141 let stream = try await chatGPTService. send ( content: content, summary: nil )
4242 isReceivingMessage = true
43- for try await _ in stream { }
44- isReceivingMessage = false
43+ do {
44+ for try await _ in stream { }
45+ isReceivingMessage = false
46+ } catch {
47+ isReceivingMessage = false
48+ }
4549 }
4650
4751 public func stopReceivingMessage( ) async {
You can’t perform that action at this time.
0 commit comments