From 590469229c9329b51edc5c4030fd4bc9ff013fcd Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 6 Jul 2024 08:00:53 +0800 Subject: [PATCH] chore: update test --- appflowy-local-ai/tests/chat_test/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appflowy-local-ai/tests/chat_test/mod.rs b/appflowy-local-ai/tests/chat_test/mod.rs index 9418049..846039d 100644 --- a/appflowy-local-ai/tests/chat_test/mod.rs +++ b/appflowy-local-ai/tests/chat_test/mod.rs @@ -30,7 +30,7 @@ async fn ci_chat_stream_test() { test.init_embedding_plugin().await; let chat_id = uuid::Uuid::new_v4().to_string(); - let mut resp = test.stream_chat_message(&chat_id, "hello world").await; + let mut resp = test.stream_chat_message(&chat_id, "what is banana?").await; let mut list = vec![]; while let Some(s) = resp.next().await { list.push(String::from_utf8(s.unwrap().to_vec()).unwrap()); @@ -39,6 +39,8 @@ async fn ci_chat_stream_test() { let answer = list.join(""); eprintln!("response: {:?}", answer); - let score = test.calculate_similarity(&answer, "Hello! How can I help you today? Is there something specific you would like to know or discuss").await; + let expected = r#"banana is a fruit that belongs to the genus _______, which also includes other fruits such as apple and pear. It has several varieties with different shapes, colors, and flavors depending on where it grows. Bananas are typically green or yellow in color and have smooth skin that peels off easily when ripe. They are sweet and juicy, often eaten raw or roasted, and can also be used for cooking and baking. In some cultures, banana is considered a symbol of good luck, fertility, and prosperity. Bananas originated in Southeast Asia, where they were cultivated by early humans thousands of years ago. They are now grown around the world as a major crop, with significant production in many countries including the United States, Brazil, India, and China#"#; + + let score = test.calculate_similarity(&answer, expected).await; assert!(score > 0.7, "score: {}", score); }