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: optional response format (#7204)
Richard Shiue62a6fb89132b
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex 88d0e9d6f8..9408978e26 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -163,7 +163,7 @@ checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"[[package]]name = "app-error"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","bincode",@@ -183,7 +183,7 @@ dependencies = [[[package]]name = "appflowy-ai-client"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","bytes",@@ -786,7 +786,7 @@ dependencies = [[[package]]name = "client-api"version = "0.2.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["again","anyhow",@@ -843,7 +843,7 @@ dependencies = [[[package]]name = "client-api-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["collab-entity","collab-rt-entity",@@ -856,7 +856,7 @@ dependencies = [[[package]]name = "client-websocket"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["futures-channel","futures-util",@@ -1128,7 +1128,7 @@ dependencies = [[[package]]name = "collab-rt-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","bincode",@@ -1153,7 +1153,7 @@ dependencies = [[[package]]name = "collab-rt-protocol"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","async-trait",@@ -1400,7 +1400,7 @@ dependencies = ["cssparser-macros","dtoa-short","itoa",- "phf 0.8.0",+ "phf 0.11.2","smallvec",]@@ -1548,7 +1548,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"[[package]]name = "database-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","app-error",@@ -2970,7 +2970,7 @@ dependencies = [[[package]]name = "gotrue"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","futures-util",@@ -2987,7 +2987,7 @@ dependencies = [[[package]]name = "gotrue-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","app-error",@@ -3598,7 +3598,7 @@ dependencies = [[[package]]name = "infra"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","bytes",@@ -4624,7 +4624,7 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"dependencies = [- "phf_macros",+ "phf_macros 0.8.0","phf_shared 0.8.0","proc-macro-hack",]@@ -4644,6 +4644,7 @@ version = "0.11.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"dependencies = [+ "phf_macros 0.11.3","phf_shared 0.11.2",]@@ -4711,6 +4712,19 @@ dependencies = ["syn 1.0.109",]+[[package]]+name = "phf_macros"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"+dependencies = [+ "phf_generator 0.11.2",+ "phf_shared 0.11.2",+ "proc-macro2",+ "quote",+ "syn 2.0.94",+]+[[package]]name = "phf_shared"version = "0.8.0"@@ -6140,7 +6154,7 @@ dependencies = [[[package]]name = "shared-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a#4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=c80157a687397a38c7390ec3d7fee034b93db963#c80157a687397a38c7390ec3d7fee034b93db963"dependencies = ["anyhow","app-error",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex 312088862e..b2725230ac 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -103,8 +103,8 @@ dashmap = "6.0.1"# Run the script.add_workspace_members:# scripts/tool/update_client_api_rev.sh new_rev_id# ⚠️⚠️⚠️️-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a" }-client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a" }+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "c80157a687397a38c7390ec3d7fee034b93db963" }+client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "c80157a687397a38c7390ec3d7fee034b93db963" }[profile.dev]opt-level = 0diff --git a/frontend/rust-lib/flowy-ai/src/chat.rs b/frontend/rust-lib/flowy-ai/src/chat.rsindex 3c18ee0b9f..12b230580a 100644--- a/frontend/rust-lib/flowy-ai/src/chat.rs+++ b/frontend/rust-lib/flowy-ai/src/chat.rs@@ -138,7 +138,7 @@ impl Chat {// Save message to disksave_and_notify_message(uid, &self.chat_id, &self.user_service, question.clone())?;- let format = params.format.clone().unwrap_or_default().into();+ let format = params.format.clone().map(Into::into).unwrap_or_default();self.stream_response(params.answer_stream_port,@@ -171,7 +171,7 @@ impl Chat {.store(false, std::sync::atomic::Ordering::SeqCst);self.stream_buffer.lock().await.clear();- let format = format.unwrap_or_default().into();+ let format = format.map(Into::into).unwrap_or_default();let answer_stream_buffer = self.stream_buffer.clone();let uid = self.user_service.user_id()?;diff --git a/frontend/rust-lib/flowy-ai/src/completion.rs b/frontend/rust-lib/flowy-ai/src/completion.rsindex fd799b411f..7ce7f79a2e 100644--- a/frontend/rust-lib/flowy-ai/src/completion.rs+++ b/frontend/rust-lib/flowy-ai/src/completion.rs@@ -104,8 +104,10 @@ impl CompletionTask {custom_prompt: None,metadata: Some(CompletionMetadata {object_id: self.context.object_id,+ workspace_id: None,rag_ids: Some(self.context.rag_ids),}),+ format: Default::default(),};info!("start completion: {:?}", params);