-
-
Notifications
You must be signed in to change notification settings - Fork 358
fix: Improve error handling in whisper_transcription_controller #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
YadavAkhileshh
wants to merge
6
commits into
AOSSIE-Org:dev
Choose a base branch
from
YadavAkhileshh:fix/whisper-logging-680
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
92d6c88
fix: replace print() with log() and add user error feedback in whispe…
YadavAkhileshh e6067b5
fix: address review feedback - single snackbar and cleaner loop
YadavAkhileshh af3261e
fix: add segment index back to debug logs using asMap().entries
YadavAkhileshh 6c5aa15
fix: simplify to boolean flag with original for-in loop
YadavAkhileshh 9e26938
fix: localize snackbar text for transcription warning
YadavAkhileshh 28c7dc5
merge: resolve conflict with upstream/dev
YadavAkhileshh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ import 'package:ffmpeg_kit_flutter_new/return_code.dart'; | |
| import 'package:get/get.dart'; | ||
| import 'package:path_provider/path_provider.dart'; | ||
| import 'package:resonate/utils/constants.dart'; | ||
| import 'package:resonate/utils/enums/log_type.dart'; | ||
| import 'package:resonate/views/widgets/snackbar.dart'; | ||
| import 'package:whisper_flutter_new/whisper_flutter_new.dart'; | ||
|
|
||
| class WhisperTranscriptionController extends GetxController { | ||
|
|
@@ -59,6 +61,9 @@ class WhisperTranscriptionController extends GetxController { | |
| final StringBuffer lrcContent = StringBuffer(); | ||
| lrcContent.writeln('[re:Resonate App - AOSSIE]'); | ||
| lrcContent.writeln('[ve:v1.0.0]'); | ||
|
|
||
| bool hasFailedSegments = false; | ||
|
|
||
| for (WhisperTranscribeSegment? segment in transcriptionSegments) { | ||
| try { | ||
| // Parse the log line | ||
|
|
@@ -67,11 +72,25 @@ class WhisperTranscriptionController extends GetxController { | |
| // Convert to LRC format and add to content | ||
| lrcContent.writeln(segmentString); | ||
| } | ||
| } catch (e) { | ||
| print(e.toString()); | ||
| } catch (e, stackTrace) { | ||
| log( | ||
| 'Error converting transcription segment: ${e.toString()}', | ||
| error: e, | ||
| stackTrace: stackTrace, | ||
| ); | ||
| hasFailedSegments = true; | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // Show a single user-friendly snackbar if any segments failed | ||
| if (hasFailedSegments) { | ||
| customSnackbar( | ||
| 'Transcription Warning', | ||
| 'Some parts of the transcription could not be processed.', | ||
|
||
| LogType.warning, | ||
| ); | ||
| } | ||
|
|
||
| return lrcContent.toString(); | ||
| } | ||
|
|
||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert the loop logic to like it was before, much simpler. No need to keep a count of the segments. Just use a boolean to check whether some part has failed.