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: remove local ai related path to lai repo
Nathana7adeeadb178
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex a72f4596f6..a251594ef9 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -345,12 +345,11 @@ dependencies = [[[package]]name = "af-local-ai"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=4b3d50cbec2f58be2ac385231b8f585f1555e282#4b3d50cbec2f58be2ac385231b8f585f1555e282"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=9d731d89ea2e0fd764da2effa8a456210c5a39c3#9d731d89ea2e0fd764da2effa8a456210c5a39c3"dependencies = ["af-plugin","anyhow","bytes",- "futures","reqwest 0.11.27","serde","serde_json",@@ -358,14 +357,12 @@ dependencies = ["tokio-stream","tokio-util","tracing",- "zip 2.2.0",- "zip-extensions",][[package]]name = "af-mcp"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=4b3d50cbec2f58be2ac385231b8f585f1555e282#4b3d50cbec2f58be2ac385231b8f585f1555e282"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=9d731d89ea2e0fd764da2effa8a456210c5a39c3#9d731d89ea2e0fd764da2effa8a456210c5a39c3"dependencies = ["anyhow","futures-util",@@ -379,7 +376,7 @@ dependencies = [[[package]]name = "af-plugin"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=4b3d50cbec2f58be2ac385231b8f585f1555e282#4b3d50cbec2f58be2ac385231b8f585f1555e282"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=9d731d89ea2e0fd764da2effa8a456210c5a39c3#9d731d89ea2e0fd764da2effa8a456210c5a39c3"dependencies = ["anyhow","cfg-if",@@ -2504,7 +2501,6 @@ dependencies = ["tracing-subscriber","uuid","validator 0.18.1",- "winreg 0.55.0","zip 2.2.0","zip-extensions",]diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex 78f67f8f90..4df29d1fe4 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -152,6 +152,6 @@ 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# ⚠️⚠️⚠️️-af-local-ai = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "4b3d50cbec2f58be2ac385231b8f585f1555e282" }-af-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "4b3d50cbec2f58be2ac385231b8f585f1555e282" }-af-mcp = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "4b3d50cbec2f58be2ac385231b8f585f1555e282" }+af-local-ai = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "9d731d89ea2e0fd764da2effa8a456210c5a39c3" }+af-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "9d731d89ea2e0fd764da2effa8a456210c5a39c3" }+af-mcp = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "9d731d89ea2e0fd764da2effa8a456210c5a39c3" }diff --git a/frontend/rust-lib/flowy-ai/Cargo.toml b/frontend/rust-lib/flowy-ai/Cargo.tomlindex ee056021c4..a08eae7e92 100644--- a/frontend/rust-lib/flowy-ai/Cargo.toml+++ b/frontend/rust-lib/flowy-ai/Cargo.toml@@ -53,11 +53,6 @@ collab-integrate.workspace = truenotify = "6.1.1"af-mcp = { version = "0.1.0" }-[target.'cfg(target_os = "windows")'.dependencies]-winreg = "0.55"--#cmd_lib = { version = "1.9.5" }-[dev-dependencies]dotenv = "0.15.0"uuid.workspace = truediff --git a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rsindex 6fbe7ce2fc..ac44e9ad55 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs@@ -13,9 +13,9 @@ use futures::Sink;use lib_infra::async_trait::async_trait;use std::collections::HashMap;-use crate::local_ai::watch::is_plugin_ready;use crate::stream_message::StreamMessage;use af_local_ai::ollama_plugin::OllamaAIPlugin;+use af_plugin::core::path::is_plugin_ready;use af_plugin::core::plugin::RunningState;use arc_swap::ArcSwapOption;use futures_util::SinkExt;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rsindex f90c360ec7..2fc6fad2cc 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs@@ -5,13 +5,13 @@ use flowy_error::{ErrorCode, FlowyError, FlowyResult};use lib_infra::async_trait::async_trait;use crate::entities::LackOfAIResourcePB;-use crate::local_ai::watch::{is_plugin_ready, ollama_plugin_path};#[cfg(target_os = "macos")]use crate::local_ai::watch::{watch_offline_app, WatchContext};use crate::notification::{chat_notification_builder, ChatNotification, APPFLOWY_AI_NOTIFICATION_KEY,};use af_local_ai::ollama_plugin::OllamaPluginConfig;+use af_plugin::core::path::{is_plugin_ready, ollama_plugin_path};use lib_infra::util::{get_operating_system, OperatingSystem};use reqwest::Client;use serde::Deserialize;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/watch.rs b/frontend/rust-lib/flowy-ai/src/local_ai/watch.rsindex 1d7be0daf9..2baed3f0a5 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/watch.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/watch.rs@@ -1,13 +1,10 @@use crate::local_ai::resource::WatchDiskEvent;+use af_plugin::core::path::{install_path, ollama_plugin_path};use flowy_error::{FlowyError, FlowyResult};use std::path::PathBuf;-use std::process::Command;use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver};use tracing::{error, trace};-#[cfg(windows)]-use winreg::{enums::*, RegKey};-#[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))]#[allow(dead_code)]pub struct WatchContext {@@ -61,131 +58,3 @@ pub fn watch_offline_app() -> FlowyResult<(WatchContext, UnboundedReceiver<Watchrx,))}--#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]-pub(crate) fn install_path() -> Option<PathBuf> {- None-}--#[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))]-pub(crate) fn install_path() -> Option<PathBuf> {- #[cfg(target_os = "windows")]- return None;-- #[cfg(target_os = "macos")]- return Some(PathBuf::from("/usr/local/bin"));-- #[cfg(target_os = "linux")]- return None;-}--#[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))]-pub fn is_plugin_ready() -> bool {- ollama_plugin_path().exists() || ollama_plugin_command_available()-}--#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]-pub fn is_plugin_ready() -> bool {- false-}--#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]-pub(crate) fn ollama_plugin_path() -> PathBuf {- PathBuf::new()-}--#[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))]-pub(crate) fn ollama_plugin_path() -> std::path::PathBuf {- #[cfg(target_os = "windows")]- {- // Use LOCALAPPDATA for a user-specific installation path on Windows.- let local_appdata =- std::env::var("LOCALAPPDATA").unwrap_or_else(|_| "C:\\Program Files".to_string());- std::path::PathBuf::from(local_appdata).join("Programs\\appflowy_plugin\\af_ollama_plugin.exe")- }-- #[cfg(target_os = "macos")]- {- let offline_app = "af_ollama_plugin";- std::path::PathBuf::from(format!("/usr/local/bin/{}", offline_app))- }-- #[cfg(target_os = "linux")]- {- let offline_app = "af_ollama_plugin";- std::path::PathBuf::from(format!("/usr/local/bin/{}", offline_app))- }-}--pub(crate) fn ollama_plugin_command_available() -> bool {- if cfg!(windows) {- #[cfg(windows)]- {- use std::os::windows::process::CommandExt;- const CREATE_NO_WINDOW: u32 = 0x08000000;- let output = Command::new("cmd")- .args(&["/C", "where", "af_ollama_plugin"])- .creation_flags(CREATE_NO_WINDOW)- .output();- if let Ok(output) = output {- if !output.stdout.is_empty() {- return true;- }- }-- // 2. Fallback: Check registry PATH for the executable- let path_dirs = get_windows_path_dirs();- let plugin_exe = "af_ollama_plugin.exe"; // Adjust name if needed-- path_dirs.iter().any(|dir| {- let full_path = std::path::Path::new(dir).join(plugin_exe);- full_path.exists()- })- }-- #[cfg(not(windows))]- false- } else {- let output = Command::new("command")- .args(["-v", "af_ollama_plugin"])- .output();- match output {- Ok(o) => !o.stdout.is_empty(),- _ => false,- }- }-}--#[cfg(windows)]-fn get_windows_path_dirs() -> Vec<String> {- let mut paths = Vec::new();-- // Check HKEY_CURRENT_USER\Environment- let hkcu = RegKey::predef(HKEY_CURRENT_USER);- if let Ok(env) = hkcu.open_subkey("Environment") {- if let Ok(path) = env.get_value::<String, _>("Path") {- paths.extend(path.split(';').map(|s| s.trim().to_string()));- }- }-- // Check HKEY_LOCAL_MACHINE\SYSTEM\...\Environment- let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);- if let Ok(env) = hklm.open_subkey(r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment")- {- if let Ok(path) = env.get_value::<String, _>("Path") {- paths.extend(path.split(';').map(|s| s.trim().to_string()));- }- }- paths-}--#[cfg(test)]-mod tests {- use crate::local_ai::watch::ollama_plugin_command_available;-- #[test]- fn test_command_import() {- let result = ollama_plugin_command_available();- println!("ollama plugin exist: {:?}", result);- }-}