Poprawki
Some checks failed
Build Linux App / build (push) Failing after 1m12s

This commit is contained in:
Kazimierz Ciołek
2026-07-07 22:03:36 +02:00
parent 6dd7213eb0
commit ebb7426c67
14 changed files with 886 additions and 82 deletions

View File

@@ -58,6 +58,37 @@ class _ChatPageState extends ConsumerState<ChatPage> {
_inputFocusNode.requestFocus();
}
Future<void> _createPlanFromMessage(
ChatController controller,
String content,
) async {
// Simple progress dialog — extraction is a second LLM round-trip.
showDialog<void>(
context: context,
barrierDismissible: false,
builder: (_) => const Center(child: CircularProgressIndicator()),
);
try {
final name = await controller.createPlanFromText(content);
if (!mounted) return;
Navigator.of(context, rootNavigator: true).pop();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Plan "$name" created — find it under Trainings.'),
),
);
} catch (e) {
if (!mounted) return;
Navigator.of(context, rootNavigator: true).pop();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Could not create a plan: $e'),
backgroundColor: AppColors.surfaceContainerHigh,
),
);
}
}
String _formatTimestamp(String timestamp) {
try {
final dt = DateTime.parse(timestamp);
@@ -306,6 +337,9 @@ class _ChatPageState extends ConsumerState<ChatPage> {
return MessageBubble(
message: msg,
formattedTime: _formatTimestamp(msg.createdAt),
onCreatePlan: msg.isUser
? null
: () => _createPlanFromMessage(controller, msg.content),
);
},
);