Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: update prompt
Nathana8b55ca3f07d
diff --git a/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart b/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dartindex 2dff6ccbd2..2cad319cdd 100644--- a/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart+++ b/frontend/appflowy_flutter/lib/ai/service/ai_prompt_input_bloc.dart@@ -37,6 +37,16 @@ class AIPromptInputBloc extends Bloc<AIPromptInputEvent, AIPromptInputState> {(event, emit) {event.when(updateAIState: (LocalAIPB localAIState) {+ if (localAIState.hasLackOfResource()) {+ emit(+ state.copyWith(+ aiType: AIType.appflowyAI,+ supportChatWithFile: false,+ localAIState: localAIState,+ ),+ );+ return;+ }// Only user enable chat with file and the plugin is already runningfinal supportChatWithFile = localAIState.enabled &&localAIState.state == RunningStatePB.Running;diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/ai/plugin_state_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/ai/plugin_state_bloc.dartindex 93b0417e63..f9727dfc89 100644--- a/frontend/appflowy_flutter/lib/workspace/application/settings/ai/plugin_state_bloc.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/ai/plugin_state_bloc.dart@@ -6,7 +6,6 @@ import 'package:appflowy_backend/log.dart';import 'package:appflowy_backend/protobuf/flowy-ai/entities.pb.dart';import 'package:bloc/bloc.dart';import 'package:freezed_annotation/freezed_annotation.dart';-import 'package:url_launcher/url_launcher.dart' show launchUrl;part 'plugin_state_bloc.freezed.dart';@@ -60,48 +59,46 @@ class PluginStateBloc extends Bloc<PluginStateEvent, PluginStateState> {},updateLocalAIState: (LocalAIPB aiState) {// if the offline ai is not started, ask user to start it- if (aiState.isAppDownloaded) {- if (aiState.hasLackOfResource()) {+ if (aiState.hasLackOfResource()) {+ emit(+ PluginStateState(+ action: PluginStateAction.lackOfResource(aiState.lackOfResource),+ ),+ );+ return;+ }++ // Chech state of the plugin+ switch (aiState.state) {+ case RunningStatePB.ReadyToRun:emit(- PluginStateState(- action:- PluginStateAction.lackOfResource(aiState.lackOfResource),+ const PluginStateState(+ action: PluginStateAction.readToRun(),),);- return;- }- // Chech state of the plugin- switch (aiState.state) {- case RunningStatePB.ReadyToRun:- emit(- const PluginStateState(- action: PluginStateAction.readToRun(),- ),- );-- case RunningStatePB.Connecting:- emit(- const PluginStateState(- action: PluginStateAction.initializingPlugin(),- ),- );- case RunningStatePB.Running:- emit(const PluginStateState(action: PluginStateAction.running()));- break;- case RunningStatePB.Stopped:- emit(- state.copyWith(action: const PluginStateAction.restartPlugin()),- );- default:- break;- }- } else {- emit(- const PluginStateState(- action: PluginStateAction.downloadLocalAIApp(),- ),- );+ case RunningStatePB.Connecting:+ emit(+ const PluginStateState(+ action: PluginStateAction.initializingPlugin(),+ ),+ );+ case RunningStatePB.Connected:+ emit(+ const PluginStateState(+ action: PluginStateAction.initializingPlugin(),+ ),+ );+ break;+ case RunningStatePB.Running:+ emit(const PluginStateState(action: PluginStateAction.running()));+ break;+ case RunningStatePB.Stopped:+ emit(+ state.copyWith(action: const PluginStateAction.restartPlugin()),+ );+ default:+ break;}},restartLocalAI: () async {@@ -110,15 +107,6 @@ class PluginStateBloc extends Bloc<PluginStateEvent, PluginStateState> {);unawaited(AIEventRestartLocalAI().send());},- downloadOfflineAIApp: () async {- final result = await AIEventGetLocalAIDownloadLink().send();- await result.fold(- (app) async {- await launchUrl(Uri.parse(app.link));- },- (err) {},- );- },resourceStateChange: (data) {emit(PluginStateState(@@ -136,7 +124,6 @@ class PluginStateEvent with _$PluginStateEvent {const factory PluginStateEvent.updateLocalAIState(LocalAIPB aiState) =_UpdateLocalAIState;const factory PluginStateEvent.restartLocalAI() = _RestartLocalAI;- const factory PluginStateEvent.downloadOfflineAIApp() = _DownloadOfflineAIApp;const factory PluginStateEvent.resourceStateChange(LackOfAIResourcePB data) =_ResourceStateChange;}@@ -155,6 +142,5 @@ class PluginStateAction with _$PluginStateAction {const factory PluginStateAction.initializingPlugin() = _InitializingPlugin;const factory PluginStateAction.running() = _PluginRunning;const factory PluginStateAction.restartPlugin() = _RestartPlugin;- const factory PluginStateAction.downloadLocalAIApp() = _DownloadLocalAIApp;const factory PluginStateAction.lackOfResource(String desc) = _LackOfResource;}diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting_panel.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting_panel.dartindex cdbba0f28a..6b95f2e9d2 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting_panel.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting_panel.dart@@ -71,25 +71,7 @@ class _LocalAIStateWidget extends StatelessWidget {Widget build(BuildContext context) {return BlocBuilder<LocalAISettingPanelBloc, LocalAISettingPanelState>(builder: (context, state) {- if (state.progressIndicator != null) {- final child = state.progressIndicator!.when(- downloadLocalAIApp: () => OpenOrDownloadOfflineAIApp(- onRetry: () {- context- .read<LocalAISettingPanelBloc>()- .add(const LocalAISettingPanelEvent.started());- },- ),- checkPluginState: () => const PluginStateIndicator(),- );-- return Padding(- padding: const EdgeInsets.only(top: 8),- child: child,- );- } else {- return const PluginStateIndicator();- }+ return const PluginStateIndicator();},);}diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/ollma_setting.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/ollma_setting.dartindex 45394a9db5..04bd27372a 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/ollma_setting.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/ollma_setting.dart@@ -28,8 +28,6 @@ class OllamaSettingPage extends StatelessWidget {return Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- _InstallOllamaInstruction(),- const VSpace(12),ListView.separated(shrinkWrap: true,itemCount: state.inputItems.length,@@ -40,6 +38,10 @@ class OllamaSettingPage extends StatelessWidget {},),const VSpace(6),+ Opacity(+ opacity: 0.6,+ child: _InstallOllamaInstruction(),+ ),_SaveButton(isEdited: state.isEdited),],);diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_state.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_state.dartindex f1896b145b..73fd0f2f42 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_state.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_state.dart@@ -29,13 +29,6 @@ class PluginStateIndicator extends StatelessWidget {initializingPlugin: () => const InitLocalAIIndicator(),running: () => const _LocalAIRunning(),restartPlugin: () => const _RestartPluginButton(),- downloadLocalAIApp: () => OpenOrDownloadOfflineAIApp(- onRetry: () {- context- .read<PluginStateBloc>()- .add(const PluginStateEvent.started());- },- ),lackOfResource: (desc) => _LackOfResource(desc: desc),);},@@ -216,6 +209,22 @@ class _LackOfResource extends StatelessWidget {@overrideWidget build(BuildContext context) {- return FlowyText(desc);+ return Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ FlowySvg(+ FlowySvgs.toast_warning_filled_s,+ size: const Size.square(20.0),+ blendMode: null,+ ),+ const HSpace(6),+ Expanded(+ child: FlowyText(+ desc,+ maxLines: 3,+ ),+ )+ ],+ );}}diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.jsonindex 66625d124d..de94737ba9 100644--- a/frontend/resources/translations/en.json+++ b/frontend/resources/translations/en.json@@ -866,9 +866,9 @@"activeOfflineAI": "Active","downloadOfflineAI": "Download","openModelDirectory": "Open folder",- "localAISetupInstruction1": "Follow the",- "localAISetupInstruction2": "instruction",- "localAISetupInstruction3": "to setup your Ollama",+ "localAISetupInstruction1": "Follow these",+ "localAISetupInstruction2": "instructions",+ "localAISetupInstruction3": "to set up Ollama and AppFlowy Local AI. Skip if you've already set it up","startLocalAI": "It may take a few seconds to start the local AI"}},diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex ddd730c1c3..be89f620d6 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -198,7 +198,7 @@ dependencies = [[[package]]name = "appflowy-local-ai"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=99447e23d5563328e5a2c2b0749e44540359a818#99447e23d5563328e5a2c2b0749e44540359a818"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=ab121037b42c9b8f3e874598eb4ee72b29ef46b4#ab121037b42c9b8f3e874598eb4ee72b29ef46b4"dependencies = ["anyhow","appflowy-plugin",@@ -218,7 +218,7 @@ dependencies = [[[package]]name = "appflowy-plugin"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=99447e23d5563328e5a2c2b0749e44540359a818#99447e23d5563328e5a2c2b0749e44540359a818"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=ab121037b42c9b8f3e874598eb4ee72b29ef46b4#ab121037b42c9b8f3e874598eb4ee72b29ef46b4"dependencies = ["anyhow","cfg-if",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex c73ac79d72..0c70b37e09 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -152,5 +152,5 @@ collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFl# To update the commit ID, run:# scripts/tool/update_local_ai_rev.sh new_rev_id# ⚠️⚠️⚠️️-appflowy-local-ai = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "99447e23d5563328e5a2c2b0749e44540359a818" }-appflowy-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "99447e23d5563328e5a2c2b0749e44540359a818" }+appflowy-local-ai = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "ab121037b42c9b8f3e874598eb4ee72b29ef46b4" }+appflowy-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "ab121037b42c9b8f3e874598eb4ee72b29ef46b4" }diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rsindex 7fff47c89d..4b52851534 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs@@ -502,7 +502,7 @@ async fn initialize_ai_plugin(std::thread::current().id());- match plugin.init_chat_plugin(config).await {+ match plugin.init_plugin(config).await {Ok(_) => {},Err(err) => error!("[AI Plugin] failed to setup plugin: {:?}", err),}diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rsindex d0e7288df1..1825ebea50 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs@@ -38,18 +38,16 @@ pub enum WatchDiskEvent {pub enum PendingResource {LocalAIAppNotDownloaded,- OllamaServerNotFound,- OllamaNotInstalled,+ OllamaServerNotReady,MissingModel(String),}impl PendingResource {pub fn desc(self) -> String {match self {- PendingResource::LocalAIAppNotDownloaded => "Local AI app not downloaded".to_string(),- PendingResource::OllamaServerNotFound => "Ollama server not ready".to_string(),- PendingResource::OllamaNotInstalled => "Ollama not installed".to_string(),- PendingResource::MissingModel(model) => format!("Missing model: {}", model),+ PendingResource::LocalAIAppNotDownloaded => "The Local AI app was not installed correctly. Please follow the instructions to install the Local AI application".to_string(),+ PendingResource::OllamaServerNotReady => "Ollama is not ready. Please follow the instructions to install Ollama".to_string(),+ PendingResource::MissingModel(model) => format!("Cannot find the model: {}. Please use the ollama pull command to install the model", model),}}}@@ -184,7 +182,7 @@ impl LocalAIResourceController {"[LLM Resource] Ollama server is not responding at {}",setting.ollama_server_url);- resources.push(PendingResource::OllamaServerNotFound);+ resources.push(PendingResource::OllamaServerNotReady);return Ok(resources);},}@@ -217,11 +215,11 @@ impl LocalAIResourceController {"[LLM Resource] 'ollama list' command failed with status: {:?}",output.status);- resources.push(PendingResource::OllamaNotInstalled);+ resources.push(PendingResource::OllamaServerNotReady);},Err(e) => {error!("[LLM Resource] failed to execute 'ollama list': {:?}", e);- resources.push(PendingResource::OllamaNotInstalled);+ resources.push(PendingResource::OllamaServerNotReady);},}