Bläddra i källkod

Defer notes popup until generation finishes.

Hold the AI Companion notes popup until generated notes are ready, and standardize the in-progress status to "Preparing notes, please wait..." so users see one consistent message instead of staged transcript/GPT phrasing.

Co-authored-by: Cursor <cursoragent@cursor.com>
huzaifahayat12 2 månader sedan
förälder
incheckning
cb2ac94502
1 ändrade filer med 16 tillägg och 7 borttagningar
  1. 16 7
      meetings_app/ViewController.swift

+ 16 - 7
meetings_app/ViewController.swift

@@ -1727,7 +1727,7 @@ private extension ViewController {
             if let progress = aiCompanionNotesProgressByMeetingId[recording.id], progress.isEmpty == false {
                 return progress
             }
-            return "Notes processing..."
+            return "Preparing notes, please wait..."
         case .ready:
             return "Notes ready"
         case .failed:
@@ -3985,21 +3985,26 @@ private extension ViewController {
             return
         }
 
-        aiCompanionNotesStatusLabelByView[senderId]?.stringValue = "Notes processing..."
+        aiCompanionNotesStatusLabelByView[senderId]?.stringValue = "Preparing notes, please wait..."
         let requestId = UUID()
         aiCompanionNotesCurrentRequestId = requestId
-        aiCompanionPresentNotesWindow(meetingTitle: recording.title, initialText: "Generating notes...")
-        aiCompanionStartNotesProcessing(forMeetingID: meetingId, requestId: requestId)
+        // Do NOT open the notes popup yet. It will be opened automatically
+        // once the notes are ready (or stay closed if generation fails).
+        aiCompanionStartNotesProcessing(forMeetingID: meetingId, requestId: requestId, autoPresentOnReady: true)
     }
 
-    private func aiCompanionStartNotesProcessing(forMeetingID meetingId: String, requestId: UUID?) {
+    private func aiCompanionStartNotesProcessing(
+        forMeetingID meetingId: String,
+        requestId: UUID?,
+        autoPresentOnReady: Bool = false
+    ) {
         aiCompanionNotesTaskByMeetingId[meetingId]?.cancel()
         _ = aiCompanionUpdateRecording(meetingId: meetingId) { recording in
             recording.notesStatusRaw = MeetingNotesStatus.processing.rawValue
             recording.notesErrorMessage = nil
             recording.notesText = nil
         }
-        aiCompanionNotesProgressByMeetingId[meetingId] = "Preparing transcript..."
+        aiCompanionNotesProgressByMeetingId[meetingId] = "Preparing notes, please wait..."
         aiCompanionRefreshNotesStatusLabels(forMeetingID: meetingId)
         if selectedSidebarPage == .aiCompanion {
             pageCache[.aiCompanion] = nil
@@ -4027,6 +4032,10 @@ private extension ViewController {
                         self.pageCache[.aiCompanion] = nil
                         self.showSidebarPage(.aiCompanion)
                     }
+                    if autoPresentOnReady {
+                        let title = self.aiCompanionLocalRecordings.first(where: { $0.id == meetingId })?.title ?? "Meeting"
+                        self.aiCompanionPresentNotesWindow(meetingTitle: title, initialText: notes)
+                    }
                 }
             } catch {
                 await MainActor.run {
@@ -4074,7 +4083,7 @@ private extension ViewController {
         }
 
         await MainActor.run {
-            self.aiCompanionNotesProgressByMeetingId[meetingId] = "Generating notes with GPT..."
+            self.aiCompanionNotesProgressByMeetingId[meetingId] = "Preparing notes, please wait..."
             self.aiCompanionRefreshNotesStatusLabels(forMeetingID: meetingId)
         }
         let defaults = UserDefaults.standard