feat(startup): Optimize model tools auto-selection timing during app initialization
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -145,13 +145,11 @@ class _ConduitAppState extends ConsumerState<ConduitApp> {
|
||||
() => ref.read(authApiIntegrationProvider),
|
||||
delay: const Duration(milliseconds: 16),
|
||||
);
|
||||
queueInit(
|
||||
() => ref.read(defaultModelAutoSelectionProvider),
|
||||
delay: const Duration(milliseconds: 24),
|
||||
);
|
||||
// Note: defaultModelAutoSelectionProvider is now initialized in
|
||||
// AppStartupFlow after authentication to avoid loading tools too early
|
||||
queueInit(
|
||||
() => ref.read(shareReceiverInitializerProvider),
|
||||
delay: const Duration(milliseconds: 32),
|
||||
delay: const Duration(milliseconds: 24),
|
||||
);
|
||||
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
|
||||
Reference in New Issue
Block a user