Skip to content

Commit

Permalink
Merge pull request #1753 from matthiasn/feat/detect_asr_lang
Browse files Browse the repository at this point in the history
feat: detect ASR language
  • Loading branch information
matthiasn authored May 21, 2024
2 parents a4fa177 + bc91585 commit 2c82c04
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 67 deletions.
3 changes: 2 additions & 1 deletion ios/Runner/WhisperKitRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public class WhisperKitRunner: NSObject, FlutterStreamHandler {
audioPath: audioFilePath,
decodeOptions: DecodingOptions(
task: DecodingTask.transcribe,
usePrefillPrompt: false
usePrefillPrompt: false,
detectLanguage: true
),
callback: self.sendTranscriptionProgressEvent
)
Expand Down
3 changes: 1 addition & 2 deletions lib/beamer/beamer_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import 'package:lotti/services/nav_service.dart';
import 'package:lotti/themes/theme.dart';
import 'package:lotti/widgets/audio/audio_recording_indicator.dart';
import 'package:lotti/widgets/badges/tasks_badge_icon.dart';
import 'package:lotti/widgets/charts/loading_widget.dart';
import 'package:lotti/widgets/misc/desktop_menu.dart';
import 'package:lotti/widgets/misc/time_recording_indicator.dart';
import 'package:lotti/widgets/nav_bar/nav_bar.dart';
Expand Down Expand Up @@ -171,7 +170,7 @@ class MyBeamerApp extends StatelessWidget {
if (themingSnapshot.darkTheme == null) {
return const EmptyScaffoldWithTitle(
'...',
body: LoadingWidget(),
body: CircularProgressIndicator(),
);
}

Expand Down
3 changes: 1 addition & 2 deletions lib/pages/dashboards/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:lotti/pages/empty_scaffold.dart';
import 'package:lotti/pages/settings/sliver_box_adapter_page.dart';
import 'package:lotti/services/nav_service.dart';
import 'package:lotti/utils/platform.dart';
import 'package:lotti/widgets/charts/loading_widget.dart';
import 'package:lotti/widgets/charts/utils.dart';
import 'package:lotti/widgets/dashboards/dashboard_widget.dart';
import 'package:lotti/widgets/misc/timespan_segmented_control.dart';
Expand Down Expand Up @@ -87,7 +86,7 @@ class _DashboardPageState extends State<DashboardPage> {
if (!snapshot.hasData) {
return EmptyScaffoldWithTitle(
context.messages.dashboardsLoadingHint,
body: const LoadingWidget(),
body: const CircularProgressIndicator(),
);
}

Expand Down
5 changes: 2 additions & 3 deletions lib/widgets/charts/dashboard_health_bmi_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:lotti/widgets/charts/dashboard_chart.dart';
import 'package:lotti/widgets/charts/dashboard_health_bmi_data.dart';
import 'package:lotti/widgets/charts/dashboard_health_config.dart';
import 'package:lotti/widgets/charts/dashboard_health_data.dart';
import 'package:lotti/widgets/charts/loading_widget.dart';
import 'package:lotti/widgets/charts/time_series/time_series_line_chart.dart';

class DashboardHealthBmiChart extends StatefulWidget {
Expand Down Expand Up @@ -65,7 +64,7 @@ class _DashboardHealthBmiChartState extends State<DashboardHealthBmiChart> {
final height = heightEntry?.data.value;

if (height == null) {
return const LoadingWidget();
return const CircularProgressIndicator();
}

return StreamBuilder<List<JournalEntity>>(
Expand All @@ -79,7 +78,7 @@ class _DashboardHealthBmiChartState extends State<DashboardHealthBmiChart> {
AsyncSnapshot<List<JournalEntity>> snapshot,
) {
if (snapshot.data == null) {
return const LoadingWidget();
return const CircularProgressIndicator();
}

final items = snapshot.data ?? [];
Expand Down
26 changes: 0 additions & 26 deletions lib/widgets/charts/loading_widget.dart

This file was deleted.

4 changes: 3 additions & 1 deletion macos/Runner/WhisperKitRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class WhisperKitRunner: NSObject, FlutterStreamHandler {
}
}


Task {
if (self.whisperKit == nil) {
self.whisperKit = try? await WhisperKit(model: self.model,
Expand All @@ -46,7 +47,8 @@ public class WhisperKitRunner: NSObject, FlutterStreamHandler {
audioPath: audioFilePath,
decodeOptions: DecodingOptions(
task: DecodingTask.transcribe,
usePrefillPrompt: false
usePrefillPrompt: false,
detectLanguage: true
),
callback: self.sendTranscriptionProgressEvent
)
Expand Down
54 changes: 27 additions & 27 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ packages:
dependency: "direct main"
description:
name: arb_utils
sha256: "783b57d5c2860101048b7189ef2950db7622c670aa24162600cc4d3023326d92"
sha256: "0483278c1f550e210d77229ad1d97f83917a6198da677dace5748585910c05df"
url: "https://pub.dev"
source: hosted
version: "0.7.1"
version: "0.8.1"
archive:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -425,6 +425,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.0"
dart_console2:
dependency: transitive
description:
name: dart_console2
sha256: f7636b74f19910a20e3d03262190ad78546a33dfc972dba7bb9fe1530826269e
url: "https://pub.dev"
source: hosted
version: "3.1.1"
dart_geohash:
dependency: "direct main"
description:
Expand All @@ -437,10 +445,10 @@ packages:
dependency: transitive
description:
name: dart_quill_delta
sha256: "4b32a3ca6efb7b849d016f52c7dc655b5af8f8058fbd35995fbad6dc0fa84e88"
sha256: e2f0be62c733a1f2ba51f70a8b544acd5a19ea726e409dd341e5f4a35582cfe0
url: "https://pub.dev"
source: hosted
version: "9.3.16"
version: "9.3.18"
dart_style:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -974,10 +982,10 @@ packages:
dependency: "direct main"
description:
name: flutter_quill
sha256: "04ea42c09ca64bb9f8798189ca650c07819431a03c3f6bbcf0f7c9cf201c8d15"
sha256: "94922fbb84f9ac4949f355bfb0337da1fb61f1110a0069d8b5d65746379a8dc0"
url: "https://pub.dev"
source: hosted
version: "9.3.16"
version: "9.3.18"
flutter_riverpod:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1467,10 +1475,10 @@ packages:
dependency: "direct main"
description:
name: langchain_ollama
sha256: "52cfd83605c2b88b0674ca94c21a7ba06566ad34ac7d7ac18e0c77b23b5cb6f7"
sha256: "46afcd5cd95ec5f5e3e1b3c459c948c2789e99b5f821c8514e4c653917f2db66"
url: "https://pub.dev"
source: hosted
version: "0.2.1"
version: "0.2.1+1"
langchain_tiktoken:
dependency: transitive
description:
Expand Down Expand Up @@ -1575,14 +1583,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
lottie:
dependency: "direct main"
description:
name: lottie
sha256: "6a24ade5d3d918c306bb1c21a6b9a04aab0489d51a2582522eea820b4093b62b"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
markdown:
dependency: transitive
description:
Expand Down Expand Up @@ -1763,10 +1763,10 @@ packages:
dependency: "direct main"
description:
name: ollama_dart
sha256: dfdedc218ecf9a7e55a7778f8ab4fe52529299aac83086aeb6c2da5e7f236391
sha256: "5e83b6b77785e7dbc454ff70ab14883e6cc1e6157c8df4e84da77845bc074df9"
url: "https://pub.dev"
source: hosted
version: "0.1.0"
version: "0.1.0+1"
olm:
dependency: transitive
description:
Expand Down Expand Up @@ -2224,7 +2224,7 @@ packages:
source: hosted
version: "2.3.5"
riverpod_generator:
dependency: "direct main"
dependency: "direct dev"
description:
name: riverpod_generator
sha256: d451608bf17a372025fc36058863737636625dfdb7e3cbf6142e0dfeb366ab22
Expand Down Expand Up @@ -2283,10 +2283,10 @@ packages:
dependency: transitive
description:
name: settings_yaml
sha256: abfd2a6a2c48883154ffe11ddd4f72ce43cc2d7f030ae060f7237fb3b2bddbf7
sha256: "415bc91cbcfe8b66b0945fdad8823b439ec9bd31591db6c1a4d2d07cab97899d"
url: "https://pub.dev"
source: hosted
version: "8.1.0-alpha.2"
version: "8.1.0"
share_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -2584,18 +2584,18 @@ packages:
dependency: transitive
description:
name: super_clipboard
sha256: "2b9c6118bf887182096c13646d0ad83e585f026f655e555731ba7743f9d2bee6"
sha256: f81058a9b3cadaaf60f37c2a37dd2647c6e5eda4533e335f1512605e3b9fb860
url: "https://pub.dev"
source: hosted
version: "0.8.13"
version: "0.8.15"
super_native_extensions:
dependency: transitive
description:
name: super_native_extensions
sha256: "12f4bee60f94ed4a460795c9b4a52679ba9dd292cb0d154c8fe2438189864f4b"
sha256: bb6499c83484c1dbe293e68907a9b6d51e30b699502c5e11940e834c310df261
url: "https://pub.dev"
source: hosted
version: "0.8.13"
version: "0.8.15"
sync_http:
dependency: transitive
description:
Expand Down Expand Up @@ -2744,10 +2744,10 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: "360a6ed2027f18b73c8d98e159dda67a61b7f2e0f6ec26e86c3ada33b0621775"
sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9"
url: "https://pub.dev"
source: hosted
version: "6.3.1"
version: "6.3.2"
url_launcher_ios:
dependency: transitive
description:
Expand Down
9 changes: 4 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.466+2526
version: 0.9.467+2528

msix_config:
display_name: LottiApp
Expand All @@ -18,7 +18,7 @@ environment:
sdk: '>=3.0.1 <4.0.0'

dependencies:
arb_utils: ^0.7.1
arb_utils: ^0.8.1
audio_video_progress_bar: ^2.0.1
auto_size_text: ^3.0.0
beamer: ^1.5.2
Expand Down Expand Up @@ -103,7 +103,6 @@ dependencies:
langchain_ollama: ^0.2.0
latlong2: ^0.9.0
location: ^6.0.1
lottie: ^3.0.0
material_design_icons_flutter: ^7.0.7096
matrix: ^0.29.2
media_kit: ^1.0.2
Expand Down Expand Up @@ -132,7 +131,6 @@ dependencies:
research_package: ^1.3.2
retry: ^3.1.0
riverpod_annotation: ^2.3.5
riverpod_generator: ^2.4.0
riverpod_lint: ^2.3.10
rxdart: ^0.27.7
share_plus: ^9.0.0
Expand Down Expand Up @@ -168,13 +166,14 @@ dev_dependencies:
flutter_native_splash: ^2.2.16
flutter_test:
sdk: flutter
freezed: ^2.3.2
freezed: ^2.5.2
glados: ^1.1.1
integration_test:
sdk: flutter
json_serializable: ^6.0.0
mocktail: ^1.0.0
msix: ^3.7.0
riverpod_generator: ^2.4.0
very_good_analysis: ^5.0.0

flutter_icons:
Expand Down
24 changes: 24 additions & 0 deletions test/utils/uuid_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,29 @@ void main() {
test('Generated UUID is valid', () {
expect(isUuid(uuid.v1()), true);
});

test('Returns true for valid UUID', () {
expect(isUuid('123e4567-e89b-12d3-a456-426614174000'), true);
});

test('Returns false for null', () {
expect(isUuid(null), false);
});

test('Returns false for empty string', () {
expect(isUuid(''), false);
});

test('Returns false for string without hyphens', () {
expect(isUuid('123e4567e89b12d3a456426614174000'), false);
});

test('Returns false for string with invalid length', () {
expect(isUuid('123e4567-e89b-12d3-a456-42661417400'), false);
});

test('Returns false for string with invalid characters', () {
expect(isUuid('123e4567-e89b-12d3-a456-42661417400g'), false);
});
});
}

0 comments on commit 2c82c04

Please sign in to comment.