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(appIntentCoordinatorProvider);
|
||||||
keepAlive(quickActionsCoordinatorProvider);
|
keepAlive(quickActionsCoordinatorProvider);
|
||||||
|
|
||||||
// Ensure model tools auto-selection is active throughout app lifecycle
|
|
||||||
keepAlive(defaultModelAutoSelectionProvider);
|
|
||||||
|
|
||||||
// Kick background model loading flow (non-blocking)
|
// Kick background model loading flow (non-blocking)
|
||||||
Future<void>.delayed(const Duration(milliseconds: 120), () {
|
Future<void>.delayed(const Duration(milliseconds: 120), () {
|
||||||
if (!ref.mounted) return;
|
if (!ref.mounted) return;
|
||||||
@@ -279,6 +276,12 @@ class AppStartupFlow extends _$AppStartupFlow {
|
|||||||
scope: 'startup',
|
scope: 'startup',
|
||||||
data: {'error': e},
|
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),
|
() => ref.read(authApiIntegrationProvider),
|
||||||
delay: const Duration(milliseconds: 16),
|
delay: const Duration(milliseconds: 16),
|
||||||
);
|
);
|
||||||
queueInit(
|
// Note: defaultModelAutoSelectionProvider is now initialized in
|
||||||
() => ref.read(defaultModelAutoSelectionProvider),
|
// AppStartupFlow after authentication to avoid loading tools too early
|
||||||
delay: const Duration(milliseconds: 24),
|
|
||||||
);
|
|
||||||
queueInit(
|
queueInit(
|
||||||
() => ref.read(shareReceiverInitializerProvider),
|
() => ref.read(shareReceiverInitializerProvider),
|
||||||
delay: const Duration(milliseconds: 32),
|
delay: const Duration(milliseconds: 24),
|
||||||
);
|
);
|
||||||
|
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user