Skip to content

Commit

Permalink
Merge pull request #1903 from nextcloud/finalize-summary-on-failure
Browse files Browse the repository at this point in the history
Remove summary tasks on AI failure/cancellation
  • Loading branch information
SystemKeeper authored Dec 2, 2024
2 parents 96ac7ca + a915dc0 commit cd64b30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions NextcloudTalk/AiSummaryController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class AiSummaryController {
task.outputs.append(output)
}

@discardableResult
public func finalizeSummaryTask(forRoomInternalId internalId: String) -> [String] {
let result = generateSummaryTasks[internalId]?.outputs ?? []
generateSummaryTasks.removeValue(forKey: internalId)
Expand Down
2 changes: 2 additions & 0 deletions NextcloudTalk/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1525,11 +1525,13 @@ import SwiftyAttributes
}

} else if status == .failed {
AiSummaryController.shared.finalizeSummaryTask(forRoomInternalId: self.room.internalId)
NotificationPresenter.shared().dismiss()
NotificationPresenter.shared().present(text: NSLocalizedString("Generating summary of unread messages failed", comment: ""), dismissAfterDelay: 7.0, includedStyle: .error)

return
} else if status == .cancelled {
AiSummaryController.shared.finalizeSummaryTask(forRoomInternalId: self.room.internalId)
NotificationPresenter.shared().dismiss()
return
}
Expand Down

0 comments on commit cd64b30

Please sign in to comment.