mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-12-28 15:45:43 +00:00
chore: force restart plugin
This commit is contained in:
parent
2b8aaf1d46
commit
f0b8b00461
4
frontend/rust-lib/Cargo.lock
generated
4
frontend/rust-lib/Cargo.lock
generated
@ -198,7 +198,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "appflowy-local-ai"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=cf0b5e77d3bbcecbcd9cbed86476658b477399e6#cf0b5e77d3bbcecbcd9cbed86476658b477399e6"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=cca2e80536dc2e0a994931f43b0f1c0fd9d4abd0#cca2e80536dc2e0a994931f43b0f1c0fd9d4abd0"
|
||||
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=cf0b5e77d3bbcecbcd9cbed86476658b477399e6#cf0b5e77d3bbcecbcd9cbed86476658b477399e6"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=cca2e80536dc2e0a994931f43b0f1c0fd9d4abd0#cca2e80536dc2e0a994931f43b0f1c0fd9d4abd0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cfg-if",
|
||||
|
||||
@ -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 = "cf0b5e77d3bbcecbcd9cbed86476658b477399e6" }
|
||||
appflowy-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "cf0b5e77d3bbcecbcd9cbed86476658b477399e6" }
|
||||
appflowy-local-ai = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "cca2e80536dc2e0a994931f43b0f1c0fd9d4abd0" }
|
||||
appflowy-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "cca2e80536dc2e0a994931f43b0f1c0fd9d4abd0" }
|
||||
|
||||
@ -141,7 +141,7 @@ impl LocalAIController {
|
||||
resource: &Arc<LocalAIResourceController>,
|
||||
ai_plugin: &Arc<OllamaAIPlugin>,
|
||||
) {
|
||||
if let Err(err) = initialize_ai_plugin(ai_plugin, resource, None).await {
|
||||
if let Err(err) = initialize_ai_plugin(ai_plugin, resource, None, false).await {
|
||||
error!("[AI Plugin] failed to setup plugin: {:?}", err);
|
||||
}
|
||||
}
|
||||
@ -278,7 +278,7 @@ impl LocalAIController {
|
||||
|
||||
#[instrument(level = "debug", skip_all)]
|
||||
pub async fn restart_plugin(&self) {
|
||||
if let Err(err) = initialize_ai_plugin(&self.ai_plugin, &self.resource, None).await {
|
||||
if let Err(err) = initialize_ai_plugin(&self.ai_plugin, &self.resource, None, true).await {
|
||||
error!("[AI Plugin] failed to setup plugin: {:?}", err);
|
||||
}
|
||||
}
|
||||
@ -430,7 +430,8 @@ impl LocalAIController {
|
||||
);
|
||||
if enabled {
|
||||
let (tx, rx) = tokio::sync::oneshot::channel();
|
||||
if let Err(err) = initialize_ai_plugin(&self.ai_plugin, &self.resource, Some(tx)).await {
|
||||
if let Err(err) = initialize_ai_plugin(&self.ai_plugin, &self.resource, Some(tx), false).await
|
||||
{
|
||||
error!("[AI Plugin] failed to initialize local ai: {:?}", err);
|
||||
}
|
||||
let _ = rx.await;
|
||||
@ -460,10 +461,14 @@ async fn initialize_ai_plugin(
|
||||
plugin: &Arc<OllamaAIPlugin>,
|
||||
llm_resource: &Arc<LocalAIResourceController>,
|
||||
ret: Option<tokio::sync::oneshot::Sender<()>>,
|
||||
force: bool,
|
||||
) -> FlowyResult<()> {
|
||||
let plugin = plugin.clone();
|
||||
if plugin.get_plugin_running_state().is_loading() {
|
||||
return Ok(());
|
||||
|
||||
if !force {
|
||||
if plugin.get_plugin_running_state().is_loading() {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
let lack_of_resource = llm_resource.get_lack_of_resource().await;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user