fix: default model edge cases

This commit is contained in:
cogwheel0
2025-08-17 17:43:19 +05:30
parent cf449fb796
commit 7b598d7c04
14 changed files with 90 additions and 429 deletions

View File

@@ -139,7 +139,7 @@ class VoiceInputService {
path: filePath,
);
// ignore: avoid_print
print('DEBUG: VoiceInputService recording started at: ' + filePath);
print('DEBUG: VoiceInputService recording started at: $filePath');
// Drive intensity from amplitude stream and detect silence
// Consider amplitude less than threshold as silence; stop after ~3s of continuous silence
@@ -183,7 +183,7 @@ class VoiceInputService {
return;
}
// ignore: avoid_print
print('DEBUG: VoiceInputService recording saved: ' + path);
print('DEBUG: VoiceInputService recording saved: $path');
// Hand off recorded file path to listeners as a special token; UI layer will upload for transcription
_textStreamController?.add('[[AUDIO_FILE_PATH]]:$path');
} catch (e) {

View File

@@ -109,7 +109,7 @@ class _ChatPageState extends ConsumerState<ChatPage> {
// Try to use the default model provider
try {
final model = await ref.read(defaultModelProvider.future);
final Model? model = await ref.read(defaultModelProvider.future);
if (model != null) {
debugPrint('DEBUG: Model auto-selected via provider: ${model.name}');
}
@@ -2170,7 +2170,7 @@ class _VoiceInputSheetState extends ConsumerState<_VoiceInputSheet> {
if (text.startsWith('[[AUDIO_FILE_PATH]]:')) {
final filePath = text.split(':').skip(1).join(':');
debugPrint(
'DEBUG: VoiceInputSheet received audio file path: ' + filePath,
'DEBUG: VoiceInputSheet received audio file path: $filePath',
);
_transcribeRecordedFile(filePath);
} else {
@@ -2237,7 +2237,7 @@ class _VoiceInputSheetState extends ConsumerState<_VoiceInputSheet> {
language: language,
);
debugPrint(
'DEBUG: Transcription received: ' + (text.isEmpty ? '[empty]' : text),
'DEBUG: Transcription received: ${text.isEmpty ? '[empty]' : text}',
);
if (!mounted) return;
setState(() {

View File

@@ -199,6 +199,7 @@ class _ModelSelectorPageState extends ConsumerState<ModelSelectorPage> {
onTap: () {
ref.read(selectedModelProvider.notifier).state =
model;
ref.read(isManualModelSelectionProvider.notifier).state = true;
Navigator.pop(context);
},
),

View File

@@ -839,19 +839,19 @@ class MoreOptionsSheet extends ConsumerWidget {
}
}
void _showDeleteConfirmation(BuildContext context, WidgetRef ref) {
ThemedDialogs.confirm(
void _showDeleteConfirmation(BuildContext context, WidgetRef ref) async {
final confirmed = await ThemedDialogs.confirm(
context,
title: 'Delete Messages',
message:
'Are you sure you want to delete ${messages.length} message${messages.length == 1 ? '' : 's'}? This action cannot be undone.',
confirmText: 'Delete',
isDestructive: true,
).then((confirmed) {
if (confirmed == true) {
_deleteMessages(context, ref);
}
});
);
if (confirmed == true && context.mounted) {
_deleteMessages(context, ref);
}
}
void _deleteMessages(BuildContext context, WidgetRef ref) async {