feat(startup): Optimize model tools auto-selection timing during app initialization

This commit is contained in:
cogwheel0
2025-12-02 21:22:34 +05:30
parent ecad71dcf6
commit c0c7944f16
2 changed files with 9 additions and 8 deletions

View File

@@ -173,9 +173,6 @@ class AppStartupFlow extends _$AppStartupFlow {
keepAlive(appIntentCoordinatorProvider);
keepAlive(quickActionsCoordinatorProvider);
// Ensure model tools auto-selection is active throughout app lifecycle
keepAlive(defaultModelAutoSelectionProvider);
// Kick background model loading flow (non-blocking)
Future<void>.delayed(const Duration(milliseconds: 120), () {
if (!ref.mounted) return;
@@ -279,6 +276,12 @@ class AppStartupFlow extends _$AppStartupFlow {
scope: 'startup',
data: {'error': e},
);
} finally {
// Ensure model tools auto-selection is active AFTER model load attempt
// This guarantees tools are applied for the restored model
if (ref.mounted) {
keepAlive(defaultModelAutoSelectionProvider);
}
}
});