Compare commits

...
Author SHA1 Message Date
Nathan 71cb0f023b chore: bump client api 2025-02-06 17:33:28 +08:00
Nathan 669c17064b chore: bump client api 2025-02-06 17:06:57 +08:00
Nathan b3cb6090f2 Merge branch 'main' into chore/optional-response-format 2025-02-06 17:03:07 +08:00
Richard Shiue c39a91a014 chore: optional response format 2025-01-16 11:10:55 +08:00
9 changed files with 41 additions and 24 deletions

No files matched your search

+28 -14
View File
@@ -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",
+2 -2
View File
@@ -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 = 0
+1 -1
View File
@@ -54,7 +54,7 @@ pub trait ChatCloudService: Send + Sync + 'static {
workspace_id: &str,
chat_id: &str,
message_id: i64,
format: ResponseFormat,
format: Option<ResponseFormat>,
) -> Result<StreamAnswer, FlowyError>;
async fn get_answer(
+3 -3
View File
@@ -138,7 +138,7 @@ impl Chat {
// Save message to disk
save_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);
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);
let answer_stream_buffer = self.stream_buffer.clone();
let uid = self.user_service.user_id()?;
@@ -196,7 +196,7 @@ impl Chat {
uid: i64,
workspace_id: String,
question_id: i64,
format: ResponseFormat,
format: Option<ResponseFormat>,
) {
let stop_stream = self.stop_stream.clone();
let chat_id = self.chat_id.clone();
@@ -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);
@@ -156,7 +156,7 @@ impl ChatCloudService for AICloudServiceMiddleware {
workspace_id: &str,
chat_id: &str,
question_id: i64,
format: ResponseFormat,
format: Option<ResponseFormat>,
) -> Result<StreamAnswer, FlowyError> {
if self.local_llm_controller.is_running() {
let row = self.get_message_record(question_id)?;
@@ -704,7 +704,7 @@ impl ChatCloudService for ServerProvider {
workspace_id: &str,
chat_id: &str,
message_id: i64,
format: ResponseFormat,
format: Option<ResponseFormat>,
) -> Result<StreamAnswer, FlowyError> {
let workspace_id = workspace_id.to_string();
let chat_id = chat_id.to_string();
@@ -100,8 +100,9 @@ where
workspace_id: &str,
chat_id: &str,
message_id: i64,
format: ResponseFormat,
format: Option<ResponseFormat>,
) -> Result<StreamAnswer, FlowyError> {
let format = format.unwrap_or_default();
trace!(
"stream_answer: workspace_id={}, chat_id={}, format={:?}",
workspace_id,
@@ -51,7 +51,7 @@ impl ChatCloudService for DefaultChatCloudServiceImpl {
_workspace_id: &str,
_chat_id: &str,
_message_id: i64,
_format: ResponseFormat,
_format: Option<ResponseFormat>,
) -> Result<StreamAnswer, FlowyError> {
Err(FlowyError::not_support().with_context("Chat is not supported in local server."))
}