Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ In **Settings → General**, click the shortcut, then press your new key combina

1. Open ClearFlow. In Settings → General, allow Microphone and Accessibility through the normal macOS prompts.
2. Select an editable field in another app. Press **Option–Shift–Space** to start; the compact meter follows microphone input.
3. Speak, then press the shortcut again. Keep the selected field and cursor unchanged while transcription runs.
4. If insertion cannot be verified or the destination changed, ClearFlow keeps the transcript on the clipboard for manual paste. Check the app’s status for details.
3. Speak, then press the shortcut again. The transcript is pasted at the cursor in that app when it is ready, even if you moved the cursor or kept typing meanwhile.
4. If you switched to another app, the focused control is not editable, or it is a password field, ClearFlow puts the transcript on the clipboard for manual paste instead. If a paste cannot be confirmed through Accessibility, the transcript also stays on the clipboard. Check the app’s status for details.

Transcripts are cleaned up before insertion: hesitations such as “um” and “uh”, stutters and stray spacing are removed, a standalone “new line” or “new paragraph” becomes a line break, and spacing and capitalization follow the text at the cursor. Wording is not rewritten. Turn this off under Settings → General → Clean up transcripts.

There is no elapsed-time cutoff: recording continues until you finish or cancel. After you finish, longer recordings are transcribed sequentially in parts of at most four minutes and combined into one result. Nothing is uploaded or inserted while you are recording. A word spanning a part boundary may be less accurate. Device interruptions or disk errors can still stop capture. A persistent warning appears and ClearFlow attempts to transcribe the available audio into Recent Dictations without pasting at a stale cursor. Low disk space triggers an advance warning; a sudden hardware failure cannot always be predicted. Quitting during capture or transcription asks for confirmation and retains audio.

Expand All @@ -81,7 +83,7 @@ Deploy the supplied Worker in **your own account**, generate your own secret, an
- The only bundled endpoint is loopback. Audio and vocabulary go only to the address you explicitly configure. No automatic provider fallback.
- Local Whisper holds request audio in memory and does not log audio or transcripts. Setup downloads dependencies/model weights; runtime uses the local model with Hugging Face offline mode.
- Audio is stored in ~/Library/Application Support/ClearFlow/Recordings with private file permissions. It is deleted after successful transcription (and history persistence when enabled) or explicit discard. Failed, interrupted or paused requests retain audio across new recordings and app restarts. Review or delete these files under Saved Recordings; no automatic expiry. Existing temporary files from older versions are not imported.
- Field content is read locally to guard insertion and is not uploaded. Known secure fields are rejected.
- Field content is read locally to confirm insertion and is not uploaded. Known secure fields are rejected.
- Transcript history is saved on this Mac by default, without automatic pruning, in ~/Library/Application Support/ClearFlow/history.json. Existing explicit history-off preferences are respected. Disable it in Settings → Data & privacy and save to remove stored history; ordinary completed dictations then stay in memory only. Interrupted audio remains recoverable until discarded. Clear recent history removes transcripts, not unfinished audio. Clipboard fallback leaves text available until replaced.
- Your endpoint is stored in macOS preferences; the token is stored in Keychain. Keep credentials, recordings, personal endpoints and runtime data out of Git.

Expand Down
2 changes: 1 addition & 1 deletion Sources/ClearFlow/ClearFlowApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import ClearFlowCore
do {
let reply = try await TranscriptionClient.transcribe(file: URL(fileURLWithPath: path), id: UUID(), endpoint: endpoint,
token: token, language: "en", vocabulary: "")
print(reply.text); exit(0)
print(AppSettings.cleanUp ? TranscriptCleanup.clean(reply.text) : reply.text); exit(0)
} catch { fputs("\(error.localizedDescription)\n", stderr); exit(1) }
}
dispatchMain()
Expand Down
9 changes: 6 additions & 3 deletions Sources/ClearFlow/DictationModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import ClearFlowCore
@Published var language = AppSettings.language
@Published var vocabulary = AppSettings.vocabulary
@Published var saveHistory = AppSettings.saveHistory
@Published var cleanUp = AppSettings.cleanUp
@Published var settingsMessage = ""
@Published var hasAccessibility = AXIsProcessTrusted()
@Published var microphoneGranted = AVCaptureDevice.authorizationStatus(for: .audio) == .authorized
Expand Down Expand Up @@ -239,6 +240,7 @@ import ClearFlowCore
mode = .transcribing; status = "Turning speech into text…"; level = 0
let endpoint = AppSettings.endpoint, token = transcribeRecording == nil ? TokenStore.read() : ""
let language = AppSettings.language, vocabulary = AppSettings.vocabulary
let cleanUp = AppSettings.cleanUp
requestTask = Task {
do {
let reply: TranscriptionReply
Expand All @@ -249,7 +251,8 @@ import ClearFlowCore
await self?.transcriptionProgress(part: part, count: count, id: id)
}) }
guard !Task.isCancelled, gate.acceptResult(id) else { return }
let text = reply.text.trimmingCharacters(in: .whitespacesAndNewlines)
let raw = reply.text.trimmingCharacters(in: .whitespacesAndNewlines)
let text = cleanUp ? TranscriptCleanup.clean(raw) : raw
guard !text.isEmpty else {
mode = .error; status = "No speech was detected. Audio saved for recovery."
recordingNotice = status; refreshRecoveries(); return
Expand All @@ -273,7 +276,7 @@ import ClearFlowCore
let outcome: String
if interrupted { outcome = saveHistory ? "Recovered transcript saved in Recent Dictations." : "Recovered transcript is available for this session; audio retained." }
else if let insertTranscript { outcome = await insertTranscript(text) }
else { outcome = await TextInsertion.insert(text, target: target, captureIssue: captureIssue) }
else { outcome = await TextInsertion.insert(text, target: target, captureIssue: captureIssue, fitToCursor: cleanUp) }
guard !Task.isCancelled, currentID == id else { return }
status = outcome; mode = .ready
// History-off is an explicit privacy choice; retain interrupted audio until discarded.
Expand Down Expand Up @@ -362,7 +365,7 @@ import ClearFlowCore
guard !TokenStore.read().isEmpty else { settingsMessage = "Enter your private service token."; return }
AppSettings.endpoint = url.absoluteString; endpoint = url.absoluteString
AppSettings.language = lang; language = lang
AppSettings.vocabulary = vocabulary; AppSettings.saveHistory = saveHistory
AppSettings.vocabulary = vocabulary; AppSettings.saveHistory = saveHistory; AppSettings.cleanUp = cleanUp
if saveHistory { try HistoryStore.save(history) } else { try HistoryStore.clear() }
hasToken = true; settingsMessage = "Saved. Your access token is in macOS Keychain."
} catch { settingsMessage = error.localizedDescription }
Expand Down
4 changes: 4 additions & 0 deletions Sources/ClearFlow/SettingsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ struct AppSettings {
get { defaults.string(forKey: "language") ?? "" }
set { defaults.set(newValue, forKey: "language") }
}
static var cleanUp: Bool {
get { defaults.object(forKey: "cleanUpTranscripts") as? Bool ?? true }
set { defaults.set(newValue, forKey: "cleanUpTranscripts") }
}
static var saveHistory: Bool {
get { defaults.object(forKey: "saveHistory") as? Bool ?? true }
set { defaults.set(newValue, forKey: "saveHistory") }
Expand Down
Loading
Loading