Skip to content

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.

chore: bump client api

Nathan797156615938
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart
index 5a73501583..5a55072c17 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart
@@ -113,7 +113,9 @@ class ChatAIMessageWidget extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- AIMarkdownText(markdown: state.text),
+ AIMarkdownText(
+ markdown: state.text,
+ ),
if (state.sources.isNotEmpty)
SelectionContainer.disabled(
child: AIMessageMetadata(
@@ -128,26 +130,22 @@ class ChatAIMessageWidget extends StatelessWidget {
);
},
onError: (error) {
- onStopStream();
return ChatErrorMessageWidget(
errorMessage: LocaleKeys.chat_aiServerUnavailable.tr(),
);
},
onAIResponseLimit: () {
- onStopStream();
return ChatErrorMessageWidget(
errorMessage:
LocaleKeys.sideBar_askOwnerToUpgradeToAIMax.tr(),
);
},
onAIImageResponseLimit: () {
- onStopStream();
return ChatErrorMessageWidget(
errorMessage: LocaleKeys.sideBar_purchaseAIMax.tr(),
);
},
onAIMaxRequired: (message) {
- onStopStream();
return ChatErrorMessageWidget(
errorMessage: message,
);
diff --git a/frontend/appflowy_flutter/macos/Podfile.lock b/frontend/appflowy_flutter/macos/Podfile.lock
index 30ee626f09..b4a1a3d20d 100644
--- a/frontend/appflowy_flutter/macos/Podfile.lock
+++ b/frontend/appflowy_flutter/macos/Podfile.lock
@@ -144,34 +144,34 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos
SPEC CHECKSUMS:
- app_links: 9028728e32c83a0831d9db8cf91c526d16cc5468
- appflowy_backend: 464aeb3e5c6966a41641a2111e5ead72ce2695f7
- auto_updater_macos: 3a42f1a06be6981f1a18be37e6e7bf86aa732118
- bitsdojo_window_macos: 7959fb0ca65a3ccda30095c181ecb856fae48ea9
- connectivity_plus: e74b9f74717d2d99d45751750e266e55912baeb5
- desktop_drop: e0b672a7d84c0a6cbc378595e82cdb15f2970a43
- device_info_plus: a56e6e74dbbd2bb92f2da12c64ddd4f67a749041
- file_selector_macos: 6280b52b459ae6c590af5d78fc35c7267a3c4b31
- flowy_infra_ui: 8760ff42a789de40bf5007a5f176b454722a341e
+ app_links: 10e0a0ab602ffaf34d142cd4862f29d34b303b2a
+ appflowy_backend: 865496343de667fc8c600e04b9fd05234e130cf9
+ auto_updater_macos: 3e3462c418fe4e731917eacd8d28eef7af84086d
+ bitsdojo_window_macos: 44e3b8fe3dd463820e0321f6256c5b1c16bb6a00
+ connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747
+ desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
+ device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
+ file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d
+ flowy_infra_ui: 03301a39ad118771adbf051a664265c61c507f38
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
HotKey: 400beb7caa29054ea8d864c96f5ba7e5b4852277
- hotkey_manager: b443f35f4d772162937aa73fd8995e579f8ac4e2
- irondash_engine_context: 893c7d96d20ce361d7e996f39d360c4c2f9869ba
- local_notifier: ebf072651e35ae5e47280ad52e2707375cb2ae4e
- package_info_plus: f0052d280d17aa382b932f399edf32507174e870
- path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
+ hotkey_manager: c32bf0bfe8f934b7bc17ab4ad5c4c142960b023c
+ irondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478
+ local_notifier: e9506bc66fc70311e8bc7291fb70f743c081e4ff
+ package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b
+ path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
ReachabilitySwift: 32793e867593cfc1177f5d16491e3a197d2fccda
- screen_retriever_macos: 452e51764a9e1cdb74b3c541238795849f21557f
+ screen_retriever_macos: 776e0fa5d42c6163d2bf772d22478df4b302b161
Sentry: 1fe34e9c2cbba1e347623610d26db121dcb569f1
- sentry_flutter: e24b397f9a61fa5bbefd8279c3b2242ca86faa90
- share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc
- shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
+ sentry_flutter: a39c2a2d67d5e5b9cb0b94a4985c76dd5b3fc737
+ share_plus: 1fa619de8392a4398bfaf176d441853922614e89
+ shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
Sparkle: 5f8960a7a119aa7d45dacc0d5837017170bc5675
- sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
- super_native_extensions: c2795d6d9aedf4a79fae25cb6160b71b50549189
- url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673
- webview_flutter_wkwebview: 44d4dee7d7056d5ad185d25b38404436d56c547c
- window_manager: 1d01fa7ac65a6e6f83b965471b1a7fdd3f06166c
+ sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
+ super_native_extensions: 85efee3a7495b46b04befcfc86ed12069264ebf3
+ url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404
+ webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
+ window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8
PODFILE CHECKSUM: 0532f3f001ca3110b8be345d6491fff690e95823
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 91a5eccdce..4ed30fa6f7 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=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
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=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"anyhow",
"bytes",
@@ -788,7 +788,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
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=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
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=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"futures-channel",
"futures-util",
@@ -1129,7 +1129,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"anyhow",
"bincode",
@@ -1151,7 +1151,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"anyhow",
"async-trait",
@@ -1546,7 +1546,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"bincode",
"bytes",
@@ -2979,7 +2979,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"anyhow",
"getrandom 0.2.10",
@@ -2994,7 +2994,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"app-error",
"jsonwebtoken",
@@ -3609,7 +3609,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"anyhow",
"bytes",
@@ -6176,7 +6176,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb92783#eb927831cd1d6e9091c9aee2a5f7413d548b2186"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=1634d17dd48488f6b55a7e0b874390343f18ebbf#1634d17dd48488f6b55a7e0b874390343f18ebbf"
dependencies = [
"anyhow",
"app-error",
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index 5322f51f9a..7ef8620dc9 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 = "eb92783" }
-client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "eb92783" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "1634d17dd48488f6b55a7e0b874390343f18ebbf" }
+client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "1634d17dd48488f6b55a7e0b874390343f18ebbf" }
[profile.dev]
opt-level = 0
diff --git a/frontend/rust-lib/flowy-ai/src/chat.rs b/frontend/rust-lib/flowy-ai/src/chat.rs
index bbba58e278..2ed7a584d0 100644
--- a/frontend/rust-lib/flowy-ai/src/chat.rs
+++ b/frontend/rust-lib/flowy-ai/src/chat.rs
@@ -14,7 +14,7 @@ use allo_isolate::Isolate;
use flowy_ai_pub::cloud::{
ChatCloudService, ChatMessage, MessageCursor, QuestionStreamValue, ResponseFormat,
};
-use flowy_error::{FlowyError, FlowyResult};
+use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_sqlite::DBConnection;
use futures::{SinkExt, StreamExt};
use lib_infra::isolate_stream::IsolateSink;
@@ -134,11 +134,9 @@ impl Chat {
{
error!("Failed to index file: {}", err);
}
- let _ = question_sink.send(StreamMessage::Done.to_string()).await;
// Save message to disk
save_and_notify_message(uid, &self.chat_id, &self.user_service, question.clone())?;
-
let format = params.format.clone().map(Into::into).unwrap_or_default();
self.stream_response(
@@ -220,8 +218,10 @@ impl Chat {
match message {
QuestionStreamValue::Answer { value } => {
answer_stream_buffer.lock().await.push_str(&value);
- // trace!("[Chat] stream answer: {}", value);
- if let Err(err) = answer_sink.send(format!("data:{}", value)).await {
+ if let Err(err) = answer_sink
+ .send(StreamMessage::OnData(value).to_string())
+ .await
+ {
error!("Failed to stream answer via IsolateSink: {}", err);
}
},
@@ -229,7 +229,9 @@ impl Chat {
if let Ok(s) = serde_json::to_string(&value) {
// trace!("[Chat] stream metadata: {}", s);
answer_stream_buffer.lock().await.set_metadata(value);
- let _ = answer_sink.send(format!("metadata:{}", s)).await;
+ let _ = answer_sink
+ .send(StreamMessage::Metadata(s).to_string())
+ .await;
}
},
QuestionStreamValue::KeepAlive => {
@@ -238,16 +240,23 @@ impl Chat {
}
},
Err(err) => {
- error!("[Chat] failed to stream answer: {}", err);
- let _ = answer_sink.send(format!("error:{}", err)).await;
- let pb = ChatMessageErrorPB {
- chat_id: chat_id.clone(),
- error_message: err.to_string(),
- };
- chat_notification_builder(&chat_id, ChatNotification::StreamChatMessageError)
- .payload(pb)
- .send();
- return Err(err);
+ if err.code == ErrorCode::RequestTimeout || err.code == ErrorCode::Internal {
+ error!("[Chat] unexpected stream error: {}", err);
+ let _ = answer_sink.send(StreamMessage::Done.to_string()).await;
+ } else {
+ error!("[Chat] failed to stream answer: {}", err);
+ let _ = answer_sink
+ .send(StreamMessage::OnError(err.msg.clone()).to_string())
+ .await;
+ let pb = ChatMessageErrorPB {
+ chat_id: chat_id.clone(),
+ error_message: err.to_string(),
+ };
+ chat_notification_builder(&chat_id, ChatNotification::StreamChatMessageError)
+ .payload(pb)
+ .send();
+ return Err(err);
+ }
},
}
}
@@ -269,7 +278,9 @@ impl Chat {
.send(format!("LOCAL_AI_NOT_READY:{}", err.msg))
.await;
} else {
- let _ = answer_sink.send(format!("error:{}", err)).await;
+ let _ = answer_sink
+ .send(StreamMessage::OnError(err.msg.clone()).to_string())
+ .await;
}
let pb = ChatMessageErrorPB {
diff --git a/frontend/rust-lib/flowy-ai/src/completion.rs b/frontend/rust-lib/flowy-ai/src/completion.rs
index 0dd145d853..7c5b77e030 100644
--- a/frontend/rust-lib/flowy-ai/src/completion.rs
+++ b/frontend/rust-lib/flowy-ai/src/completion.rs
@@ -106,6 +106,7 @@ impl CompletionTask {
object_id: self.context.object_id,
workspace_id: Some(self.workspace_id.clone()),
rag_ids: Some(self.context.rag_ids),
+ completion_history: None,
}),
format: self.context.format.map(Into::into).unwrap_or_default(),
};
diff --git a/frontend/rust-lib/flowy-ai/src/stream_message.rs b/frontend/rust-lib/flowy-ai/src/stream_message.rs
index c507262b85..3e76282aa8 100644
--- a/frontend/rust-lib/flowy-ai/src/stream_message.rs
+++ b/frontend/rust-lib/flowy-ai/src/stream_message.rs
@@ -5,6 +5,9 @@ pub enum StreamMessage {
IndexStart,
IndexEnd,
Text(String),
+ OnData(String),
+ OnError(String),
+ Metadata(String),
Done,
StartIndexFile { file_name: String },
EndIndexFile { file_name: String },
@@ -20,7 +23,10 @@ impl Display for StreamMessage {
StreamMessage::Text(text) => {
write!(f, "data:{}", text)
},
+ StreamMessage::OnData(message) => write!(f, "data:{message}"),
+ StreamMessage::OnError(message) => write!(f, "error:{message}"),
StreamMessage::Done => write!(f, "done:"),
+ StreamMessage::Metadata(s) => write!(f, "metadata:{s}"),
StreamMessage::StartIndexFile { file_name } => {
write!(f, "start_index_file:{}", file_name)
},