diff --git a/dev.env b/dev.env index d38ebb1b5..24a12cd69 100644 --- a/dev.env +++ b/dev.env @@ -121,7 +121,7 @@ AI_OPENAI_API_KEY= AI_SERVER_PORT=5001 AI_SERVER_HOST=localhost AI_DATABASE_URL=postgresql+psycopg://postgres:password@localhost:5432/postgres -AI_REDIS_URL=redis://redis:6379 +AI_REDIS_URL=redis://localhost:6379 LOCAL_AI_TEST_ENABLED=false AI_APPFLOWY_BUCKET_NAME=appflowy AI_APPFLOWY_HOST=http://localhost:8000 @@ -131,7 +131,7 @@ AI_AWS_SECRET_ACCESS_KEY=${AWS_SECRET} # AppFlowy Indexer APPFLOWY_INDEXER_ENABLED=true APPFLOWY_INDEXER_DATABASE_URL=postgres://postgres:password@localhost:5432/postgres -APPFLOWY_INDEXER_REDIS_URL=redis://redis:6379 +APPFLOWY_INDEXER_REDIS_URL=redis://localhost:6379 APPFLOWY_INDEXER_EMBEDDING_BUFFER_SIZE=5000 # AppFlowy Collaborate diff --git a/libs/appflowy-ai-client/src/dto.rs b/libs/appflowy-ai-client/src/dto.rs index e5fb7a1eb..f7f6dea40 100644 --- a/libs/appflowy-ai-client/src/dto.rs +++ b/libs/appflowy-ai-client/src/dto.rs @@ -458,6 +458,7 @@ pub struct CalculateSimilarityParams { pub workspace_id: String, pub input: String, pub expected: String, + pub use_embedding: bool, } #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/libs/client-api-test/src/test_client.rs b/libs/client-api-test/src/test_client.rs index 1a63536b1..e8c30ac01 100644 --- a/libs/client-api-test/src/test_client.rs +++ b/libs/client-api-test/src/test_client.rs @@ -640,11 +640,13 @@ impl TestClient { input: &str, expected: &str, score: f64, + use_embedding: bool, ) { let params = CalculateSimilarityParams { workspace_id: workspace_id.to_string(), input: input.to_string(), expected: expected.to_string(), + use_embedding, }; let resp = self.api_client.calculate_similarity(params).await.unwrap(); assert!( diff --git a/tests/ai_test/chat_with_selected_doc_test.rs b/tests/ai_test/chat_with_selected_doc_test.rs index db558c5ec..18938a884 100644 --- a/tests/ai_test/chat_with_selected_doc_test.rs +++ b/tests/ai_test/chat_with_selected_doc_test.rs @@ -111,7 +111,13 @@ async fn chat_with_multiple_selected_source_test() { .await; let expected_unknown_japan_answer = r#"I don’t know the date for your trip to Japan"#; test_client - .assert_similarity(&workspace_id, &answer, expected_unknown_japan_answer, 0.7) + .assert_similarity( + &workspace_id, + &answer, + expected_unknown_japan_answer, + 0.7, + true, + ) .await; // update chat context to snowboarding_in_japan_plan @@ -136,7 +142,7 @@ async fn chat_with_multiple_selected_source_test() { You take off to Japan on **January 7th** "#; test_client - .assert_similarity(&workspace_id, &answer, expected, 0.8) + .assert_similarity(&workspace_id, &answer, expected, 0.8, false) .await; // Ask question for alex to make sure two documents are treated as chat context @@ -149,7 +155,7 @@ async fn chat_with_multiple_selected_source_test() { .await; let expected = r#"Tennis, basketball, cycling, badminton, snowboarding."#; test_client - .assert_similarity(&workspace_id, &answer, expected, 0.8) + .assert_similarity(&workspace_id, &answer, expected, 0.8, true) .await; // remove the Japan plan and check the response. After remove the Japan plan, the chat should not @@ -172,7 +178,13 @@ async fn chat_with_multiple_selected_source_test() { ) .await; test_client - .assert_similarity(&workspace_id, &answer, expected_unknown_japan_answer, 0.7) + .assert_similarity( + &workspace_id, + &answer, + expected_unknown_japan_answer, + 0.7, + true, + ) .await; } @@ -233,7 +245,7 @@ async fn chat_with_selected_source_override_test() { Overall, Alex balances his work as a software programmer with his passion for sports, finding excitement and freedom in each activity. "#; test_client - .assert_similarity(&workspace_id, &answer, expected, 0.8) + .assert_similarity(&workspace_id, &answer, expected, 0.8, true) .await; // remove all content for given document @@ -276,7 +288,7 @@ Overall, Alex balances his work as a software programmer with his passion for sp he certainly has many experiences in the culinary world, where he enjoys savoring flavors and discovering new dishes "#; test_client - .assert_similarity(&workspace_id, &answer, expected, 0.8) + .assert_similarity(&workspace_id, &answer, expected, 0.8, true) .await; } diff --git a/tests/search/document_search.rs b/tests/search/document_search.rs index 435a5191e..522722b98 100644 --- a/tests/search/document_search.rs +++ b/tests/search/document_search.rs @@ -79,6 +79,7 @@ reprisal. Lack of Commitment Without clarity and buy-in, team decisions bec The Five Dysfunctions of a Team by Patrick Lencioni The Five Dysfunctions of a Team by Patrick Lenci" "# .to_string(), + use_embedding: true, }; let score = test_client .api_client @@ -131,6 +132,7 @@ The Five Dysfunctions of a Team by Patrick Lencioni The Five Dysfunctions of a T ultimately leading her team toward improved collaboration and performance. "# .to_string(), + use_embedding: true, }; let score = test_client .api_client