Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
add transcription feedback reporting
altic-dev45912940770e
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex af37da4a..9dd9a87a 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -1931,6 +1931,7 @@ struct ContentView: View {var finalText: Stringvar aiFallbackReason: String?+ var postProcessingModel: String?let appInfo = self.recordingAppInfo ?? self.getCurrentAppInfo()let shouldUseAI = activeDictationSlot.map {@@ -1941,6 +1942,7 @@ struct ContentView: View {if shouldUseAI {DebugLogger.shared.debug("Routing transcription through AI post-processing", source: "ContentView")let postProcessingModelInfo = self.currentDictationAIModelInfo()+ postProcessingModel = postProcessingModelInfo.modellet postProcessingInputChars = transcribedText.countlet postProcessingStart = Date()@@ -2057,6 +2059,7 @@ struct ContentView: View {processedText: finalText,appName: appInfo.name,windowTitle: appInfo.windowTitle,+ processingModel: postProcessingModel,aiProcessingError: aiFallbackReason)self.persistDictationAudioIfNeeded(@@ -2350,9 +2353,11 @@ struct ContentView: View {var finalText = transcribedTextvar aiFallbackReason: String?+ var postProcessingModel: String?let appInfo = self.getCurrentAppInfo()let shouldUseAI = DictationAIPostProcessingGate.isConfigured(for: .primary, appBundleID: appInfo.bundleId)if shouldUseAI {+ postProcessingModel = self.currentDictationAIModelInfo().modeldo {finalText = try await self.processTextWithAI(transcribedText,@@ -2380,6 +2385,7 @@ struct ContentView: View {processedText: finalText,appName: appInfo.name,windowTitle: appInfo.windowTitle,+ processingModel: postProcessingModel,aiProcessingError: aiFallbackReason)}diff --git a/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift b/Sources/Fluid/Persistence/TranscriptionHistoryStore.swiftindex be68446d..21cedb5e 100644--- a/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift+++ b/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift@@ -19,6 +19,7 @@ struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {let windowTitle: Stringlet characterCount: Intlet wasAIProcessed: Bool+ let processingModel: String?/// Non-nil when AI post-processing was configured but failed and we fell/// back to typing the raw transcription. The string carries the error/// message for display / debugging.@@ -32,6 +33,7 @@ struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {processedText: String,appName: String,windowTitle: String,+ processingModel: String? = nil,aiProcessingError: String? = nil,audio: DictationAudioMetadata? = nil) {@@ -43,6 +45,7 @@ struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {self.windowTitle = windowTitleself.characterCount = processedText.countself.wasAIProcessed = rawText != processedText+ self.processingModel = processingModelself.aiProcessingError = aiProcessingErrorself.audio = audio}@@ -56,6 +59,7 @@ struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {windowTitle: String,characterCount: Int,wasAIProcessed: Bool,+ processingModel: String?,aiProcessingError: String?,audio: DictationAudioMetadata?) {@@ -67,6 +71,7 @@ struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {self.windowTitle = windowTitleself.characterCount = characterCountself.wasAIProcessed = wasAIProcessed+ self.processingModel = processingModelself.aiProcessingError = aiProcessingErrorself.audio = audio}@@ -81,13 +86,14 @@ struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {self.windowTitle = try container.decode(String.self, forKey: .windowTitle)self.characterCount = try container.decode(Int.self, forKey: .characterCount)self.wasAIProcessed = try container.decode(Bool.self, forKey: .wasAIProcessed)+ self.processingModel = try container.decodeIfPresent(String.self, forKey: .processingModel)self.aiProcessingError = try container.decodeIfPresent(String.self, forKey: .aiProcessingError)self.audio = try container.decodeIfPresent(DictationAudioMetadata.self, forKey: .audio)}private enum CodingKeys: String, CodingKey {case id, timestamp, rawText, processedText, appName, windowTitle- case characterCount, wasAIProcessed, aiProcessingError, audio+ case characterCount, wasAIProcessed, processingModel, aiProcessingError, audio}/// Preview text for list display (first 80 chars)@@ -128,6 +134,7 @@ struct TranscriptionHistoryEntry: Codable, Identifiable, Equatable {windowTitle: self.windowTitle,characterCount: self.characterCount,wasAIProcessed: self.wasAIProcessed,+ processingModel: self.processingModel,aiProcessingError: self.aiProcessingError,audio: audio)@@ -169,6 +176,7 @@ final class TranscriptionHistoryStore: ObservableObject {processedText: String,appName: String,windowTitle: String,+ processingModel: String? = nil,aiProcessingError: String? = nil,audio: DictationAudioMetadata? = nil) {@@ -182,6 +190,7 @@ final class TranscriptionHistoryStore: ObservableObject {processedText: processedText,appName: appName,windowTitle: windowTitle,+ processingModel: processingModel,aiProcessingError: aiProcessingError,audio: audio)diff --git a/Sources/Fluid/Services/TranscriptionFeedbackReporter.swift b/Sources/Fluid/Services/TranscriptionFeedbackReporter.swiftnew file mode 100644index 00000000..0a46fa45--- /dev/null+++ b/Sources/Fluid/Services/TranscriptionFeedbackReporter.swift@@ -0,0 +1,49 @@+import Foundation++enum TranscriptionFeedbackReporter {+ struct Payload: Encodable {+ let rawText: String+ let processedText: String+ let processingModel: String+ let comments: String+ }++ enum ReporterError: LocalizedError {+ case invalidURL+ case invalidResponse+ case httpError(Int)++ var errorDescription: String? {+ switch self {+ case .invalidURL:+ return "Invalid report endpoint."+ case .invalidResponse:+ return "Invalid report response."+ case let .httpError(statusCode):+ return "Report failed with HTTP \(statusCode)."+ }+ }+ }++ private static let endpoint = "https://altic.dev/api/fluid/examples"++ static func submit(_ payload: Payload) async throws {+ guard let url = URL(string: self.endpoint) else {+ throw ReporterError.invalidURL+ }++ var request = URLRequest(url: url)+ request.httpMethod = "POST"+ request.timeoutInterval = 12+ request.setValue("application/json", forHTTPHeaderField: "Content-Type")+ request.httpBody = try JSONEncoder().encode(payload)++ let (_, response) = try await URLSession.shared.data(for: request)+ guard let httpResponse = response as? HTTPURLResponse else {+ throw ReporterError.invalidResponse+ }+ guard (200...299).contains(httpResponse.statusCode) else {+ throw ReporterError.httpError(httpResponse.statusCode)+ }+ }+}diff --git a/Sources/Fluid/UI/TranscriptionHistoryView.swift b/Sources/Fluid/UI/TranscriptionHistoryView.swiftindex d1e66f7b..eca48cfc 100644--- a/Sources/Fluid/UI/TranscriptionHistoryView.swift+++ b/Sources/Fluid/UI/TranscriptionHistoryView.swift@@ -8,8 +8,8 @@ struct TranscriptionHistoryView: View {@State private var searchQuery: String = ""@State private var showClearConfirmation: Bool = false- @State private var showFeedbackPlaceholder: Bool = false- @State private var selectedFeedbackEntry: TranscriptionHistoryEntry?+ @State private var showReportConfirmation: Bool = false+ @State private var selectedReportEntry: TranscriptionHistoryEntry?@State private var selectedEntryID: UUID?private var filteredEntries: [TranscriptionHistoryEntry] {@@ -72,15 +72,15 @@ struct TranscriptionHistoryView: View {} message: {Text("This will permanently delete all \(self.historyStore.entries.count) transcription entries. This action cannot be undone.")}- .alert("Feedback placeholder", isPresented: self.$showFeedbackPlaceholder) {+ .alert("Report Sent", isPresented: self.$showReportConfirmation) {Button("OK", role: .cancel) {}} message: {- Text("Nothing was sent. This is reserved for opt-in bad result reporting with review and redaction before upload.")+ Text("Thank you for helping improve FluidVoice dictation.")}- .sheet(item: self.$selectedFeedbackEntry) { entry in- TranscriptionFeedbackPlaceholderSheet(entry: entry) {- self.selectedFeedbackEntry = nil- self.showFeedbackPlaceholder = true+ .sheet(item: self.$selectedReportEntry) { entry in+ TranscriptionFeedbackReportSheet(entry: entry) {+ self.selectedReportEntry = nil+ self.showReportConfirmation = true}.environment(\.theme, self.theme)}@@ -237,7 +237,7 @@ struct TranscriptionHistoryView: View {Divider()Button {- self.openFeedbackPlaceholder(for: entry)+ self.openFeedbackReport(for: entry)} label: {Label("Report Bad Result...", systemImage: "hand.thumbsup.slash")}@@ -362,14 +362,14 @@ struct TranscriptionHistoryView: View {}Button {- self.openFeedbackPlaceholder(for: entry)+ self.openFeedbackReport(for: entry)} label: {Label("Report", systemImage: "hand.thumbsup.slash").font(.system(size: 12, weight: .medium))}.buttonStyle(.bordered).controlSize(.small)- .help("Placeholder only. Nothing is sent.")+ .help("Review and send this example to FluidVoice")if entry.wasAIProcessed {Button {@@ -564,8 +564,8 @@ struct TranscriptionHistoryView: View {NSPasteboard.general.setString(text, forType: .string)}- private func openFeedbackPlaceholder(for entry: TranscriptionHistoryEntry) {- self.selectedFeedbackEntry = entry+ private func openFeedbackReport(for entry: TranscriptionHistoryEntry) {+ self.selectedReportEntry = entry}private func combinedText(for entry: TranscriptionHistoryEntry) -> String {@@ -629,21 +629,25 @@ struct TranscriptionHistoryView: View {}}-private struct TranscriptionFeedbackPlaceholderSheet: View {+private struct TranscriptionFeedbackReportSheet: View {@Environment(\.dismiss) private var dismiss@Environment(\.theme) private var theme@State private var inputText: String@State private var outputText: String+ @State private var processingModel: String@State private var comment: String+ @State private var isSending: Bool = false+ @State private var errorMessage: String?- let onSend: () -> Void+ let onSent: () -> Void- init(entry: TranscriptionHistoryEntry, onSend: @escaping () -> Void) {+ init(entry: TranscriptionHistoryEntry, onSent: @escaping () -> Void) {_inputText = State(initialValue: entry.rawText)_outputText = State(initialValue: entry.processedText)+ _processingModel = State(initialValue: Self.reportModel(for: entry))_comment = State(initialValue: "")- self.onSend = onSend+ self.onSent = onSent}var body: some View {@@ -656,24 +660,43 @@ private struct TranscriptionFeedbackPlaceholderSheet: View {.foregroundStyle(.secondary)}- self.feedbackField(title: "Input", text: self.$inputText, height: 88)- self.feedbackField(title: "Output", text: self.$outputText, height: 88)+ self.feedbackField(title: "Raw Text", text: self.$inputText, height: 88)+ self.feedbackField(title: "Processed Text", text: self.$outputText, height: 88)+ self.feedbackField(title: "Processing Model", text: self.$processingModel, height: 40)self.feedbackField(title: "Comment optional", text: self.$comment, height: 72)+ if let errorMessage {+ Text(errorMessage)+ .font(.system(size: 12, weight: .medium))+ .foregroundStyle(.red)+ .fixedSize(horizontal: false, vertical: true)+ }+HStack {Spacer()Button("Cancel") {self.dismiss()}.keyboardShortcut(.cancelAction)+ .disabled(self.isSending)- Button("Send") {- self.onSend()+ Button {+ Task {+ await self.sendReport()+ }+ } label: {+ HStack(spacing: 8) {+ if self.isSending {+ ProgressView()+ .controlSize(.small)+ .fixedSize()+ }+ Text(self.isSending ? "Sending..." : "Send")+ }}.keyboardShortcut(.defaultAction).buttonStyle(.borderedProminent)- .disabled(self.inputText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty- && self.outputText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)+ .disabled(self.isSendDisabled)}}.padding(20)@@ -681,6 +704,33 @@ private struct TranscriptionFeedbackPlaceholderSheet: View {.background(self.theme.palette.contentBackground)}+ private var isSendDisabled: Bool {+ self.isSending ||+ (self.inputText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty &&+ self.outputText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty) ||+ self.processingModel.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty+ }++ private func sendReport() async {+ let payload = TranscriptionFeedbackReporter.Payload(+ rawText: self.inputText.trimmingCharacters(in: .whitespacesAndNewlines),+ processedText: self.outputText.trimmingCharacters(in: .whitespacesAndNewlines),+ processingModel: self.processingModel.trimmingCharacters(in: .whitespacesAndNewlines),+ comments: self.comment.trimmingCharacters(in: .whitespacesAndNewlines)+ )++ self.isSending = true+ self.errorMessage = nil+ do {+ try await TranscriptionFeedbackReporter.submit(payload)+ self.isSending = false+ self.onSent()+ } catch {+ self.errorMessage = error.localizedDescription+ self.isSending = false+ }+ }+private func feedbackField(title: String, text: Binding<String>, height: CGFloat) -> some View {VStack(alignment: .leading, spacing: 6) {Text(title)@@ -703,6 +753,11 @@ private struct TranscriptionFeedbackPlaceholderSheet: View {)}}++ private static func reportModel(for entry: TranscriptionHistoryEntry) -> String {+ let model = entry.processingModel?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""+ return model.isEmpty ? "unknown" : model+ }}#Preview {