Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
eastriverlee authored Jan 27, 2024
1 parent fbd8c35 commit 1a88f4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 1a88f4f

Please sign in to comment.