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: support response format
Nathanee69283a23c4
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex 6a4ea2102d..672e355983 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=f1b5167e9569e8a61ef50a1afb140306a5287e57#f1b5167e9569e8a61ef50a1afb140306a5287e57"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=cf0b5e77d3bbcecbcd9cbed86476658b477399e6#cf0b5e77d3bbcecbcd9cbed86476658b477399e6"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=f1b5167e9569e8a61ef50a1afb140306a5287e57#f1b5167e9569e8a61ef50a1afb140306a5287e57"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-LocalAI?rev=cf0b5e77d3bbcecbcd9cbed86476658b477399e6#cf0b5e77d3bbcecbcd9cbed86476658b477399e6"dependencies = ["anyhow","cfg-if",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex a9142cd9d2..0a732ec2a2 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 = "f1b5167e9569e8a61ef50a1afb140306a5287e57" }-appflowy-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "f1b5167e9569e8a61ef50a1afb140306a5287e57" }+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" }diff --git a/frontend/rust-lib/flowy-ai-pub/src/cloud.rs b/frontend/rust-lib/flowy-ai-pub/src/cloud.rsindex 98198c8f9f..f8fdeb212d 100644--- a/frontend/rust-lib/flowy-ai-pub/src/cloud.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/cloud.rs@@ -92,7 +92,7 @@ pub trait ChatCloudService: Send + Sync + 'static {params: CompleteTextParams,) -> Result<StreamComplete, FlowyError>;- async fn index_file(+ async fn embed_file(&self,workspace_id: &str,file_path: &Path,diff --git a/frontend/rust-lib/flowy-ai/src/chat.rs b/frontend/rust-lib/flowy-ai/src/chat.rsindex 93ed5ba858..3156053ae2 100644--- a/frontend/rust-lib/flowy-ai/src/chat.rs+++ b/frontend/rust-lib/flowy-ai/src/chat.rs@@ -587,7 +587,7 @@ impl Chat {);self.chat_service- .index_file(+ .embed_file(&self.user_service.workspace_id()?,&file_path,&self.chat_id,diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rsindex f6e0750970..8fa27ccc26 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs@@ -392,7 +392,7 @@ impl LocalAIController {.await;let result = self- .index_file(chat_id, file_path, content, Some(index_metadata.clone()))+ .embed_file(chat_id, file_path, content, Some(index_metadata.clone())).await;match result {Ok(_) => {diff --git a/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs b/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rsindex 686637cb3e..7ebe5889a7 100644--- a/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs+++ b/frontend/rust-lib/flowy-ai/src/middleware/chat_service_mw.rs@@ -163,7 +163,7 @@ impl ChatCloudService for AICloudServiceMiddleware {let row = self.get_message_record(question_id)?;match self.local_ai- .stream_question(chat_id, &row.content, json!({}))+ .stream_question(chat_id, &row.content, Some(json!(format)), json!({})).await{Ok(stream) => Ok(QuestionStream::new(stream).boxed()),@@ -277,7 +277,11 @@ impl ChatCloudService for AICloudServiceMiddleware {if self.local_ai.is_running() {match self.local_ai- .complete_text(¶ms.text, params.completion_type.unwrap() as u8)+ .complete_text(+ ¶ms.text,+ params.completion_type.unwrap() as u8,+ Some(json!(params.format)),+ ).await{Ok(stream) => Ok(@@ -298,7 +302,7 @@ impl ChatCloudService for AICloudServiceMiddleware {}}- async fn index_file(+ async fn embed_file(&self,workspace_id: &str,file_path: &Path,@@ -308,14 +312,14 @@ impl ChatCloudService for AICloudServiceMiddleware {if self.local_ai.is_running() {self.local_ai- .index_file(chat_id, Some(file_path.to_path_buf()), None, metadata)+ .embed_file(chat_id, Some(file_path.to_path_buf()), None, metadata).await.map_err(|err| FlowyError::local_ai().with_context(err))?;Ok(())} else {self.cloud_service- .index_file(workspace_id, file_path, chat_id, metadata)+ .embed_file(workspace_id, file_path, chat_id, metadata).await}}diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rsindex 22342615e3..80c22642a4 100644--- a/frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rs+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/cloud_service_impl.rs@@ -781,7 +781,7 @@ impl ChatCloudService for ServerProvider {.await}- async fn index_file(+ async fn embed_file(&self,workspace_id: &str,file_path: &Path,@@ -791,7 +791,7 @@ impl ChatCloudService for ServerProvider {self.get_server()?.chat_service()- .index_file(workspace_id, file_path, chat_id, metadata)+ .embed_file(workspace_id, file_path, chat_id, metadata).await}diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rsindex 11fc5cc27c..c7077dc061 100644--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs@@ -200,7 +200,7 @@ whereOk(stream.boxed())}- async fn index_file(+ async fn embed_file(&self,_workspace_id: &str,_file_path: &Path,diff --git a/frontend/rust-lib/flowy-server/src/default_impl.rs b/frontend/rust-lib/flowy-server/src/default_impl.rsindex 194aa89ef3..d1a16159c4 100644--- a/frontend/rust-lib/flowy-server/src/default_impl.rs+++ b/frontend/rust-lib/flowy-server/src/default_impl.rs@@ -101,7 +101,7 @@ impl ChatCloudService for DefaultChatCloudServiceImpl {Err(FlowyError::not_support().with_context("complete text is not supported in local server."))}- async fn index_file(+ async fn embed_file(&self,_workspace_id: &str,_file_path: &Path,