diff --git a/README.md b/README.md index be8f251..2a5165d 100644 --- a/README.md +++ b/README.md @@ -98,14 +98,14 @@ public func respond(to input: String, with makeOutputFrom: @escaping (AsyncStrea open func respond(to input: String) async { await respond(to: input) { [self] response in - await setOutput(to: "") + output = "" for await responseDelta in response { update(responseDelta) - await setOutput(to: output + responseDelta) + output += responseDelta } update(nil) let trimmedOutput = output.trimmingCharacters(in: .whitespacesAndNewlines) - await setOutput(to: trimmedOutput.isEmpty ? "..." : trimmedOutput) + output = trimmedOutput.isEmpty ? "..." : trimmedOutput return output } }