chore: fix ai client test (#589)

This commit is contained in:
Nathan.fooo 2024-05-30 07:50:25 +08:00 committed by GitHub
parent 128e978016
commit 9b4bfce616
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 1 deletions

1
Cargo.lock generated
View File

@ -576,6 +576,7 @@ dependencies = [
"tokio",
"tracing",
"tracing-subscriber",
"uuid",
]
[[package]]

View File

@ -17,6 +17,7 @@ serde_repr = { version = "0.1", optional = true }
[dev-dependencies]
tokio = { version = "1.37.0", features = ["macros", "test-util"] }
tracing-subscriber = { version = "0.3.18", features = ["registry", "env-filter", "ansi", "json"] }
uuid = { version = "1.6", features = ["v4"] }
[features]
default = ["client-api"]

View File

@ -4,8 +4,9 @@ use crate::appflowy_ai_client;
async fn qa_test() {
let client = appflowy_ai_client();
client.health_check().await.unwrap();
let chat_id = uuid::Uuid::new_v4().to_string();
let resp = client
.send_question("fake_chat_id", "I feel hungry")
.send_question(&chat_id, "I feel hungry")
.await
.unwrap();
assert!(!resp.content.is_empty());

View File

@ -97,6 +97,10 @@ async fn spawn_control_group(
.await
{
if let Some(handles) = weak_handles.upgrade() {
if messages.is_empty() {
continue;
}
trace!("[History] received {} control messages", messages.len());
for message in &messages {
if let Ok(event) = CollabControlEvent::decode(&message.data) {