feat: add Hinglish language support with custom prompting and improve…#243
feat: add Hinglish language support with custom prompting and improve…#243janakkapadia wants to merge 7 commits into
Conversation
…d post-processing patterns
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds prompt support to transcription uploads, routes Hinglish and Gujlish through English transcription with custom prompts, expands language pickers, tightens post-processing instructions for Latin-script mixed-language output, and updates app version metadata. ChangesMixed-language transcription support
Sequence Diagram(s)sequenceDiagram
participant SettingsView
participant AppState
participant TranscriptionService
participant PostProcessingService
SettingsView->>AppState: set transcriptionLanguage to Hinglish or Gujlish
AppState->>TranscriptionService: init(language: "en", prompt: mixed-language prompt)
TranscriptionService-->>AppState: transcribed English-script text
AppState->>PostProcessingService: applyOutputLanguage(Hinglish or Gujlish)
PostProcessingService-->>AppState: output restricted to Latin-script mixed language
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Makefile`:
- Line 96: The DMG recipe still includes a lingering fileicon step, so remove
the fileicon invocation from the Makefile’s DMG build target and keep the rest
of the staging/package flow intact. Use the DMG-related recipe around the build
target to locate the exact shell command and ensure no other references to
fileicon remain in that target.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d9e324fe-9e7e-4a7d-805d-240beb5475c3
📒 Files selected for processing (5)
MakefileSources/AppState.swiftSources/PostProcessingService.swiftSources/SettingsView.swiftSources/TranscriptionService.swift
There was a problem hiding this comment.
🧹 Nitpick comments (2)
Sources/AppState.swift (2)
1012-1023: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRedundant
"en"mapping in two places.
resolvedTranscriptionLanguagealready resolveshinglish/gujlishto"en", so theisMixedLanguage ? "en" : resolvedTranscriptionLanguageternary at Line 1012 is redundant — passingresolvedTranscriptionLanguagedirectly yields the same result and keeps the mapping in one place.♻️ Optional simplification
transcriptionModel: transcriptionModel, - language: isMixedLanguage ? "en" : resolvedTranscriptionLanguage, + language: resolvedTranscriptionLanguage, prompt: customPrompt🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Sources/AppState.swift` around lines 1012 - 1023, The mixed-language `"en"` fallback is duplicated in the transcription language setup, since resolvedTranscriptionLanguage already maps "hinglish" and "gujlish" to "en". Update the call site in AppState so the transcription request uses resolvedTranscriptionLanguage directly instead of the isMixedLanguage ternary, keeping the mapping centralized in resolvedTranscriptionLanguage and avoiding redundant logic.
996-1015: 🎯 Functional Correctness | 🔵 TrivialRealtime service lacks custom prompt support entirely
The
RealtimeTranscriptionServicedoes not currently support passing a custom system prompt to the backend. ItsConfigurationstruct includes onlybaseURL,apiKey,model, andlanguage. Because the field does not exist in the implementation, the prompt cannot be forwarded in the current architecture; the realtime path is not a matter of a missed variable assignment but requires adding support for prompts to theRealtimeTranscriptionServiceimplementation (e.g., extendingConfigurationand updating the WebSocket payload) to match the file-based service.Until such support is added, the mixed-language prompt is correctly limited to the file-based transcription path. If Hinglish/Gujlish transcription is mandatory for realtime users, the realtime service requires a feature enhancement to accept and forward custom prompts.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Sources/AppState.swift` around lines 996 - 1015, The mixed-language custom prompt in makeTranscriptionService is only supported by the file-based TranscriptionService, not the realtime path. Keep the Hinglish/Gujlish prompt handling limited to this factory for now, and if realtime support is needed, extend RealtimeTranscriptionService by adding prompt to its Configuration and forwarding it in the WebSocket payload before wiring it into AppState.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Sources/AppState.swift`:
- Around line 1012-1023: The mixed-language `"en"` fallback is duplicated in the
transcription language setup, since resolvedTranscriptionLanguage already maps
"hinglish" and "gujlish" to "en". Update the call site in AppState so the
transcription request uses resolvedTranscriptionLanguage directly instead of the
isMixedLanguage ternary, keeping the mapping centralized in
resolvedTranscriptionLanguage and avoiding redundant logic.
- Around line 996-1015: The mixed-language custom prompt in
makeTranscriptionService is only supported by the file-based
TranscriptionService, not the realtime path. Keep the Hinglish/Gujlish prompt
handling limited to this factory for now, and if realtime support is needed,
extend RealtimeTranscriptionService by adding prompt to its Configuration and
forwarding it in the WebSocket payload before wiring it into AppState.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 556d3b58-06a5-4fbd-a3de-6832386d4ff2
📒 Files selected for processing (3)
Sources/AppState.swiftSources/PostProcessingService.swiftSources/SettingsView.swift
🚧 Files skipped from review as they are similar to previous changes (1)
- Sources/PostProcessingService.swift
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/PostProcessingService.swift`:
- Around line 630-636: The output-language directive in applyOutputLanguage is
too broad because the native-script prohibition is being applied for every
language; update the prompt construction so the “Do NOT use the native script”
constraint is only appended when the language is Hinglish or Gujlish, while
preserving the existing explanation text and output-only requirement for those
two cases. Keep the logic localized in applyOutputLanguage by branching on the
language value alongside the current explanation handling, so explicit languages
like Hindi or Gujarati can use their native scripts normally.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 334fb666-7fb0-4b45-ae63-3ea638b9cd5e
📒 Files selected for processing (1)
Sources/PostProcessingService.swift
…d post-processing patterns
Summary by CodeRabbit