chore: fix disable local ai

This commit is contained in:
nathan 2024-08-14 21:01:49 +08:00
parent a66fba2753
commit f23787fec7
2 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import 'package:appflowy/workspace/presentation/settings/pages/setting_ai_view/m
import 'package:appflowy/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart';
import 'package:flowy_infra/theme_extension.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
@ -147,7 +148,7 @@ class _LocalAIOnBoarding extends StatelessWidget {
child: BlocBuilder<LocalAIOnBoardingBloc, LocalAIOnBoardingState>(
builder: (context, state) {
// Show the local AI settings if the user has purchased the AI Local plan
if (state.isPurchaseAILocal) {
if (kDebugMode || state.isPurchaseAILocal) {
return const LocalAISetting();
} else {
if (member.role.isOwner) {

View File

@ -326,9 +326,12 @@ impl LocalAIController {
.store_preferences
.get_bool(APPFLOWY_LOCAL_AI_CHAT_ENABLED)
.unwrap_or(true);
self.enable_chat_plugin(chat_enabled).await?;
if self.local_ai_resource.is_resource_ready() {
self.enable_chat_plugin(chat_enabled).await?;
}
} else {
self.enable_chat_plugin(false).await?;
let _ = self.enable_chat_plugin(false).await;
}
Ok(enabled)
}