mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: local ai toggle (#5968)
* chore: fix disable local ai * chore: do not index file
This commit is contained in:
parent
8935b7158c
commit
7eb8ea347d
@ -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:appflowy/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart';
|
||||||
import 'package:flowy_infra/theme_extension.dart';
|
import 'package:flowy_infra/theme_extension.dart';
|
||||||
import 'package:flowy_infra_ui/widget/spacing.dart';
|
import 'package:flowy_infra_ui/widget/spacing.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
@ -147,7 +148,7 @@ class _LocalAIOnBoarding extends StatelessWidget {
|
|||||||
child: BlocBuilder<LocalAIOnBoardingBloc, LocalAIOnBoardingState>(
|
child: BlocBuilder<LocalAIOnBoardingBloc, LocalAIOnBoardingState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
// Show the local AI settings if the user has purchased the AI Local plan
|
// Show the local AI settings if the user has purchased the AI Local plan
|
||||||
if (state.isPurchaseAILocal) {
|
if (kDebugMode || state.isPurchaseAILocal) {
|
||||||
return const LocalAISetting();
|
return const LocalAISetting();
|
||||||
} else {
|
} else {
|
||||||
if (member.role.isOwner) {
|
if (member.role.isOwner) {
|
||||||
|
@ -326,9 +326,12 @@ impl LocalAIController {
|
|||||||
.store_preferences
|
.store_preferences
|
||||||
.get_bool(APPFLOWY_LOCAL_AI_CHAT_ENABLED)
|
.get_bool(APPFLOWY_LOCAL_AI_CHAT_ENABLED)
|
||||||
.unwrap_or(true);
|
.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 {
|
} else {
|
||||||
self.enable_chat_plugin(false).await?;
|
let _ = self.enable_chat_plugin(false).await;
|
||||||
}
|
}
|
||||||
Ok(enabled)
|
Ok(enabled)
|
||||||
}
|
}
|
||||||
@ -361,6 +364,10 @@ impl LocalAIController {
|
|||||||
metadata_list: &[ChatMessageMetadata],
|
metadata_list: &[ChatMessageMetadata],
|
||||||
index_process_sink: &mut (impl Sink<String> + Unpin),
|
index_process_sink: &mut (impl Sink<String> + Unpin),
|
||||||
) -> FlowyResult<()> {
|
) -> FlowyResult<()> {
|
||||||
|
if !self.is_enabled() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
for metadata in metadata_list {
|
for metadata in metadata_list {
|
||||||
if let Err(err) = metadata.data.validate() {
|
if let Err(err) = metadata.data.validate() {
|
||||||
error!(
|
error!(
|
||||||
|
Loading…
Reference in New Issue
Block a user