File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Foundation Lab/ViewModels Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -424,9 +424,7 @@ private extension RAGChatViewModel {
424424 )
425425 let task = Task { @MainActor [ streamingTextUseCase] in
426426 let result = try await streamingTextUseCase. execute ( request) { partialResponse in
427- await MainActor . run {
428- entry. content = partialResponse
429- }
427+ await updateStreamingEntry ( entry, with: partialResponse)
430428 }
431429 self . lastTokenCount = result. metadata. tokenCount
432430 }
@@ -441,4 +439,9 @@ private extension RAGChatViewModel {
441439 if entry. content. isEmpty { entry. content = " Failed: \( error. localizedDescription) " }
442440 }
443441 }
442+
443+ @MainActor
444+ private func updateStreamingEntry( _ entry: RAGChatEntry , with partialResponse: String ) {
445+ entry. content = partialResponse
446+ }
444447}
You can’t perform that action at this time.
0 commit comments