feat: add trim and fallback_on_empty options to PostProcessConfig#270
Open
KaiStarkk wants to merge 1 commit intopeteonrails:mainfrom
Open
feat: add trim and fallback_on_empty options to PostProcessConfig#270KaiStarkk wants to merge 1 commit intopeteonrails:mainfrom
KaiStarkk wants to merge 1 commit intopeteonrails:mainfrom
Conversation
Add two new boolean fields to PostProcessConfig that give post-process scripts control over whitespace handling and empty-output behavior: - trim (default: true): when false, only trailing newlines are stripped from command output, preserving intentional whitespace like trailing spaces after punctuation for dictation flow. - fallback_on_empty (default: true): when false, empty command output is returned as-is instead of falling back to the original transcription. This allows scripts to intentionally suppress output (e.g. filtering [BLANK_AUDIO] markers). Both fields default to true for full backward compatibility. Adds 4 new tests covering the new behavior; all 16 post_process tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new boolean fields to
PostProcessConfigthat give post-process scripts finer control over output handling:trim(default:true) — When set tofalse, only trailing newlines (shell artifacts) are stripped from command output, preserving all other whitespace. This is needed when a post-process script intentionally adds trailing spaces, e.g. appending a space after sentence-ending punctuation for smoother dictation flow.fallback_on_empty(default:true) — When set tofalse, empty command output is returned as an empty string instead of falling back to the original transcription text. This is needed when a post-process script intentionally outputs nothing to suppress unwanted transcriptions, e.g. filtering out[BLANK_AUDIO]markers.Why this is needed
The current post-processing pipeline unconditionally calls
.trim()on command output, which strips trailing spaces that some scripts add intentionally. It also unconditionally falls back to the original text when output is empty, which defeats scripts designed to suppress certain transcriptions.These two behaviors are reasonable defaults, but they need to be configurable for legitimate use cases.
Backward compatibility
Both fields default to
true, which preserves the existing behavior exactly. No configuration changes are required for existing users.Config example
Tests
4 new tests added covering the new fields. All 16
post_processtests pass.Files changed
src/config.rs— Addtrimandfallback_on_emptyfields toPostProcessConfigwith serde defaults and documentation comments; add config file commentssrc/daemon.rs— Populate new fields when constructingPostProcessConfigfrom profile overridessrc/output/post_process.rs— Implement conditional trim and fallback logic inPostProcessor; add 4 tests