Skip to content

Commit 16a454a

Browse files
committed
Fix that the plugin ends too early
1 parent c49c524 commit 16a454a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Core/Sources/ChatPlugins/ShortcutChatPlugin/ShortcutInputChatPlugin.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public actor ShortcutInputChatPlugin: ChatPlugin {
5656
// if no input detected, use the previous message as input
5757
input = await chatGPTService.history.last?.content ?? ""
5858
}
59-
59+
6060
do {
6161
if isCancelled { throw CancellationError() }
6262

@@ -89,12 +89,14 @@ public actor ShortcutInputChatPlugin: ChatPlugin {
8989
let data = try Data(contentsOf: temporaryOutputFileURL)
9090
if let text = String(data: data, encoding: .utf8) {
9191
if text.isEmpty { return }
92-
_ = try await chatGPTService.send(content: text, summary: nil)
92+
let stream = try await chatGPTService.send(content: text, summary: nil)
93+
for try await _ in stream {}
9394
} else {
9495
let text = """
9596
[View File](\(temporaryOutputFileURL))
9697
"""
97-
_ = try await chatGPTService.send(content: text, summary: nil)
98+
let stream = try await chatGPTService.send(content: text, summary: nil)
99+
for try await _ in stream {}
98100
}
99101

100102
return

0 commit comments

Comments
 (0)