Przebudowanie aplikacji, usprawnione AI, dodanie combo buildera
Some checks failed
Build Linux App / build (push) Failing after 1m18s

This commit is contained in:
Kazimierz Ciołek
2026-07-06 23:44:17 +02:00
parent 9dcc4b87de
commit 6dd7213eb0
48 changed files with 3229 additions and 669 deletions

View File

@@ -12,9 +12,12 @@ class AiConstants {
'http://localhost:$chatServerPort/v1/chat/completions';
static String get embeddingApiUrl =>
'http://localhost:$embeddingServerPort/v1/embeddings';
static String chatHealthUrl = 'http://localhost:$chatServerPort/health';
static String embeddingHealthUrl =
'http://localhost:$embeddingServerPort/health';
// Model files
static const String qwenModelFile = 'qwen2.5-7b-instruct-q4_k_m.gguf';
static const String qwenModelFile = 'qwen3-4b-instruct-2507-q4_k_m.gguf';
static const String nomicModelFile = 'nomic-embed-text-v1.5.Q4_K_M.gguf';
static const String nomicModelName = 'nomic-embed-text-v1.5.Q4_K_M';
@@ -27,13 +30,30 @@ class AiConstants {
static const String nomicModelUrl =
'https://huggingface.co/nomic-ai/nomic-embed-text-v1.5-GGUF/resolve/main/nomic-embed-text-v1.5.Q4_K_M.gguf';
static const String qwenModelUrl =
'https://huggingface.co/bartowski/Qwen2.5-7B-Instruct-GGUF/resolve/main/Qwen2.5-7B-Instruct-Q4_K_M.gguf';
'https://huggingface.co/bartowski/Qwen_Qwen3-4B-Instruct-2507-GGUF/resolve/main/Qwen_Qwen3-4B-Instruct-2507-Q4_K_M.gguf';
// Human-readable model labels (single source of truth for UI copy)
static const String chatModelLabel = 'Qwen3 4B Instruct Q4_K_M';
static const String embeddingModelLabel = 'Nomic Embed Text v1.5 Q4_K_M';
// Minimum plausible file sizes — a partially downloaded file is smaller.
static const int qwenModelMinBytes = 2_000_000_000; // full file ≈ 2.4 GB
static const int nomicModelMinBytes = 50_000_000; // full file ≈ 84 MB
static const int serverBinaryMinBytes = 1_000_000;
// Server configuration
static const int qwenContextSize = 4096;
static const int nomicContextSize = 8192;
static const int qwenContextSize = 8192;
static const int nomicContextSize = 2048;
static const int gpuLayerOffload = 99;
static const double chatTemperature = 0.7;
static const int chatMaxTokens = 1536;
/// How many most-recent messages are sent back to the model as history.
static const int chatHistoryLimit = 12;
/// Nomic v1.5 requires task prefixes for good retrieval quality.
static const String nomicDocumentPrefix = 'search_document: ';
static const String nomicQueryPrefix = 'search_query: ';
// Timeouts
static const Duration serverConnectTimeout = Duration(seconds: 30);
@@ -41,9 +61,21 @@ class AiConstants {
static const Duration embeddingConnectTimeout = Duration(seconds: 10);
static const Duration embeddingReceiveTimeout = Duration(seconds: 60);
/// Cold-loading a multi-GB model can take minutes: on the first Vulkan
/// run llama.cpp additionally compiles GPU pipelines for the device.
static const Duration serverStartupTimeout = Duration(minutes: 5);
/// CPU fallback loads via mmap and needs no pipeline compilation.
static const Duration serverStartupTimeoutCpu = Duration(minutes: 3);
static const Duration healthPollInterval = Duration(milliseconds: 750);
// System prompt
static const String baseSystemPrompt =
'You are a helpful AI fitness assistant for personal trainers. '
'Help users design training plans, analyse exercise technique, '
'and answer questions about sports science and nutrition.';
'You are the AI coach inside TrainHub, a training hub for ITF Taekwon-Do. '
'You help with: designing drills and training plans (patterns/tul, '
'sparring/matsogi, kicks, conditioning), analysing technique, belt '
'grading preparation, and sports science questions. '
'Use correct ITF terminology (e.g. dollyo chagi, yop chagi, tul names). '
'Always answer in the same language the user writes in. '
'Be concise and practical — coaches read this between rounds.';
}

View File

@@ -2,7 +2,7 @@ class AppConstants {
AppConstants._();
static const String appName = 'TrainHub';
static const String appVersion = '2.0.0';
static const String appVersion = '2.1.0';
static const double windowWidth = 1280;
static const double windowHeight = 800;
static const double minWindowWidth = 800;

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:trainhub_flutter/core/theme/app_colors.dart';
class UIConstants {
UIConstants._();
@@ -29,4 +30,9 @@ class UIConstants {
static BorderRadius get smallCardBorderRadius =>
BorderRadius.circular(smallBorderRadius);
/// Soft red glow behind primary accents (CTA buttons, active timers).
static List<BoxShadow> get accentGlow => const [
BoxShadow(color: AppColors.accentGlow, blurRadius: 24, spreadRadius: 1),
];
}

View File

@@ -16,19 +16,22 @@ class AppColors {
static const Color zinc900 = Color(0xFF18181B);
static const Color zinc950 = Color(0xFF09090B);
// Semantic colors
static const Color surface = zinc950;
static const Color surfaceContainer = zinc900;
static const Color surfaceContainerHigh = zinc800;
static const Color border = zinc800;
static const Color borderSubtle = Color(0xFF1F1F23);
// Semantic colors — "dojang" dark: near-black surfaces, subtle borders
static const Color surface = Color(0xFF070708);
static const Color surfaceContainer = Color(0xFF111113);
static const Color surfaceContainerHigh = Color(0xFF1A1A1D);
static const Color border = Color(0xFF232326);
static const Color borderSubtle = Color(0xFF1A1A1E);
static const Color textPrimary = zinc50;
static const Color textSecondary = zinc400;
static const Color textMuted = zinc500;
// Accent colors
static const Color accent = Color(0xFFFF9800);
static const Color accentMuted = Color(0x33FF9800);
// Accent colors — signature red
static const Color accent = Color(0xFFFF2B2B);
static const Color accentBright = Color(0xFFFF4D4D);
static const Color accentMuted = Color(0x2EFF2B2B);
static const Color accentBorder = Color(0x40FF2B2B);
static const Color accentGlow = Color(0x59FF2B2B);
static const Color success = Color(0xFF22C55E);
static const Color successMuted = Color(0x3322C55E);
static const Color destructive = Color(0xFFEF4444);

View File

@@ -10,23 +10,32 @@ class AppTheme {
useMaterial3: true,
brightness: Brightness.dark,
colorScheme: const ColorScheme.dark(
primary: AppColors.zinc50,
primary: AppColors.accent,
onPrimary: AppColors.zinc950,
secondary: AppColors.zinc200,
onSecondary: AppColors.zinc950,
surface: AppColors.zinc950,
surface: AppColors.surface,
onSurface: AppColors.zinc50,
surfaceContainer: AppColors.zinc900,
surfaceContainer: AppColors.surfaceContainer,
error: AppColors.destructive,
onError: AppColors.zinc50,
outline: AppColors.zinc800,
outline: AppColors.border,
outlineVariant: AppColors.zinc700,
),
scaffoldBackgroundColor: AppColors.surface,
textTheme: GoogleFonts.interTextTheme(ThemeData.dark().textTheme).apply(
bodyColor: AppColors.textPrimary,
displayColor: AppColors.textPrimary,
),
textTheme: GoogleFonts.interTextTheme(ThemeData.dark().textTheme)
.copyWith(
displayLarge: GoogleFonts.chakraPetch(fontWeight: FontWeight.w700),
displayMedium: GoogleFonts.chakraPetch(fontWeight: FontWeight.w700),
displaySmall: GoogleFonts.chakraPetch(fontWeight: FontWeight.w700),
headlineLarge: GoogleFonts.chakraPetch(fontWeight: FontWeight.w700),
headlineMedium: GoogleFonts.chakraPetch(fontWeight: FontWeight.w600),
headlineSmall: GoogleFonts.chakraPetch(fontWeight: FontWeight.w600),
)
.apply(
bodyColor: AppColors.textPrimary,
displayColor: AppColors.textPrimary,
),
cardTheme: CardThemeData(
color: AppColors.surfaceContainer,
elevation: 0,
@@ -41,13 +50,10 @@ class AppTheme {
thickness: 1,
space: 1,
),
iconTheme: const IconThemeData(
color: AppColors.textSecondary,
size: 20,
),
iconTheme: const IconThemeData(color: AppColors.textSecondary, size: 20),
navigationRailTheme: NavigationRailThemeData(
backgroundColor: AppColors.surfaceContainer,
selectedIconTheme: const IconThemeData(color: AppColors.textPrimary),
selectedIconTheme: const IconThemeData(color: AppColors.accent),
unselectedIconTheme: const IconThemeData(color: AppColors.textMuted),
selectedLabelTextStyle: GoogleFonts.inter(
fontSize: 12,
@@ -59,7 +65,7 @@ class AppTheme {
fontWeight: FontWeight.w400,
color: AppColors.textMuted,
),
indicatorColor: AppColors.zinc700,
indicatorColor: AppColors.accentMuted,
),
inputDecorationTheme: InputDecorationTheme(
filled: true,
@@ -75,12 +81,9 @@ class AppTheme {
),
focusedBorder: OutlineInputBorder(
borderRadius: UIConstants.smallCardBorderRadius,
borderSide: const BorderSide(color: AppColors.zinc400, width: 1),
),
hintStyle: GoogleFonts.inter(
color: AppColors.textMuted,
fontSize: 14,
borderSide: const BorderSide(color: AppColors.accent, width: 1),
),
hintStyle: GoogleFonts.inter(color: AppColors.textMuted, fontSize: 14),
labelStyle: GoogleFonts.inter(
color: AppColors.textSecondary,
fontSize: 14,
@@ -100,15 +103,16 @@ class AppTheme {
),
filledButtonTheme: FilledButtonThemeData(
style: FilledButton.styleFrom(
backgroundColor: AppColors.zinc50,
backgroundColor: AppColors.accent,
foregroundColor: AppColors.zinc950,
shape: RoundedRectangleBorder(
borderRadius: UIConstants.smallCardBorderRadius,
),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
textStyle: GoogleFonts.inter(
textStyle: GoogleFonts.chakraPetch(
fontSize: 14,
fontWeight: FontWeight.w500,
fontWeight: FontWeight.w600,
letterSpacing: 0.8,
),
),
),
@@ -120,10 +124,7 @@ class AppTheme {
borderRadius: UIConstants.smallCardBorderRadius,
),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
textStyle: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w500,
),
textStyle: GoogleFonts.inter(fontSize: 14, fontWeight: FontWeight.w500),
),
),
textButtonTheme: TextButtonThemeData(
@@ -133,24 +134,23 @@ class AppTheme {
borderRadius: UIConstants.smallCardBorderRadius,
),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
textStyle: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w500,
),
textStyle: GoogleFonts.inter(fontSize: 14, fontWeight: FontWeight.w500),
),
),
tabBarTheme: TabBarThemeData(
labelColor: AppColors.textPrimary,
unselectedLabelColor: AppColors.textMuted,
indicatorColor: AppColors.textPrimary,
indicatorColor: AppColors.accent,
dividerColor: AppColors.border,
labelStyle: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w500,
labelStyle: GoogleFonts.chakraPetch(
fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: 1,
),
unselectedLabelStyle: GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w400,
unselectedLabelStyle: GoogleFonts.chakraPetch(
fontSize: 13,
fontWeight: FontWeight.w500,
letterSpacing: 1,
),
),
snackBarTheme: SnackBarThemeData(
@@ -184,15 +184,13 @@ class AppTheme {
checkboxTheme: CheckboxThemeData(
fillColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return AppColors.zinc50;
return AppColors.accent;
}
return Colors.transparent;
}),
checkColor: WidgetStateProperty.all(AppColors.zinc950),
side: const BorderSide(color: AppColors.zinc400),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
),
tooltipTheme: TooltipThemeData(
decoration: BoxDecoration(
@@ -200,10 +198,7 @@ class AppTheme {
borderRadius: BorderRadius.circular(6),
border: Border.all(color: AppColors.zinc700),
),
textStyle: GoogleFonts.inter(
color: AppColors.textPrimary,
fontSize: 12,
),
textStyle: GoogleFonts.inter(color: AppColors.textPrimary, fontSize: 12),
),
);
}

View File

@@ -5,99 +5,114 @@ import 'package:trainhub_flutter/core/theme/app_colors.dart';
class AppTypography {
AppTypography._();
static TextStyle get displayLarge => GoogleFonts.inter(
fontSize: 36,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
height: 1.2,
);
/// Display font for headings — squarish techno look ("dojang" style).
/// Pair with `.toUpperCase()` on the text for the full effect.
static TextStyle get displayLarge => GoogleFonts.chakraPetch(
fontSize: 36,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
height: 1.2,
letterSpacing: 0.5,
);
static TextStyle get headlineLarge => GoogleFonts.inter(
fontSize: 28,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
height: 1.3,
);
static TextStyle get headlineLarge => GoogleFonts.chakraPetch(
fontSize: 28,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
height: 1.3,
letterSpacing: 0.5,
);
static TextStyle get headlineMedium => GoogleFonts.inter(
fontSize: 24,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
height: 1.3,
);
static TextStyle get headlineMedium => GoogleFonts.chakraPetch(
fontSize: 24,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
height: 1.3,
letterSpacing: 0.5,
);
static TextStyle get titleLarge => GoogleFonts.inter(
fontSize: 20,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
height: 1.4,
);
static TextStyle get titleLarge => GoogleFonts.chakraPetch(
fontSize: 20,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
height: 1.4,
letterSpacing: 0.3,
);
static TextStyle get titleMedium => GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
fontSize: 16,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
static TextStyle get titleSmall => GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
static TextStyle get bodyLarge => GoogleFonts.inter(
fontSize: 16,
fontWeight: FontWeight.w400,
color: AppColors.textPrimary,
height: 1.5,
);
fontSize: 16,
fontWeight: FontWeight.w400,
color: AppColors.textPrimary,
height: 1.5,
);
static TextStyle get bodyMedium => GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.textPrimary,
height: 1.5,
);
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.textPrimary,
height: 1.5,
);
static TextStyle get bodySmall => GoogleFonts.inter(
fontSize: 12,
fontWeight: FontWeight.w400,
color: AppColors.textSecondary,
height: 1.5,
);
fontSize: 12,
fontWeight: FontWeight.w400,
color: AppColors.textSecondary,
height: 1.5,
);
static TextStyle get labelLarge => GoogleFonts.inter(
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
static TextStyle get labelMedium => GoogleFonts.inter(
fontSize: 12,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
fontSize: 12,
fontWeight: FontWeight.w500,
color: AppColors.textPrimary,
height: 1.4,
);
static TextStyle get caption => GoogleFonts.inter(
fontSize: 12,
fontWeight: FontWeight.w400,
color: AppColors.textMuted,
height: 1.4,
);
fontSize: 12,
fontWeight: FontWeight.w400,
color: AppColors.textMuted,
height: 1.4,
);
static TextStyle get monoLarge => GoogleFonts.jetBrainsMono(
fontSize: 72,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
);
fontSize: 72,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
);
static TextStyle get monoMedium => GoogleFonts.jetBrainsMono(
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.textPrimary,
);
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.textPrimary,
);
/// Small tracked-out mono label, e.g. "TODAY · THU 29 MAY".
/// Callers uppercase the text and override the color (often [AppColors.accent]).
static TextStyle get overline => GoogleFonts.jetBrainsMono(
fontSize: 11,
fontWeight: FontWeight.w600,
color: AppColors.textMuted,
letterSpacing: 2,
);
}