diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index b0cd0836..bcbd15ab 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -104,6 +104,7 @@ jobs: sed -i "s|AI_AWS_SECRET_ACCESS_KEY=.*|AI_AWS_SECRET_ACCESS_KEY=${{ secrets.LOCAL_AI_AWS_SECRET_ACCESS_KEY }}|" .env sed -i 's|AI_APPFLOWY_HOST=.*|AI_APPFLOWY_HOST=http://localhost|' .env sed -i 's|APPFLOWY_WEB_URL=.*|APPFLOWY_WEB_URL=http://localhost:3000|' .env + sed -i 's|.*APPFLOWY_S3_PRESIGNED_URL_ENDPOINT=.*|APPFLOWY_S3_PRESIGNED_URL_ENDPOINT=http://localhost/minio-api|' .env shell: bash - name: Update Nginx Configuration diff --git a/libs/appflowy-ai-client/src/dto.rs b/libs/appflowy-ai-client/src/dto.rs index 8e354fb2..43f9c70a 100644 --- a/libs/appflowy-ai-client/src/dto.rs +++ b/libs/appflowy-ai-client/src/dto.rs @@ -147,6 +147,7 @@ pub enum CompletionType { MakeShorter = 3, MakeLonger = 4, ContinueWriting = 5, + Explain = 6, } #[derive(Debug, Clone, Serialize)] diff --git a/libs/appflowy-ai-client/tests/chat_test/completion_test.rs b/libs/appflowy-ai-client/tests/chat_test/completion_test.rs index 3f216b34..211349ad 100644 --- a/libs/appflowy-ai-client/tests/chat_test/completion_test.rs +++ b/libs/appflowy-ai-client/tests/chat_test/completion_test.rs @@ -5,6 +5,28 @@ use appflowy_ai_client::dto::{ ResponseFormat, }; +#[tokio::test] +async fn completion_explain_test() { + let client = appflowy_ai_client(); + let params = CompleteTextParams { + text: "Snowboarding".to_string(), + completion_type: Some(CompletionType::Explain), + custom_prompt: None, + metadata: Some(CompletionMetadata { + object_id: uuid::Uuid::new_v4().to_string(), + workspace_id: Some(uuid::Uuid::new_v4().to_string()), + rag_ids: None, + }), + format: ResponseFormat::default(), + }; + let stream = client + .stream_completion_text(params, "gpt-4o-mini") + .await + .unwrap(); + let text = collect_stream_text(stream).await; + assert!(!text.is_empty()); +} + #[tokio::test] async fn completion_image_test() { let client = appflowy_ai_client(); diff --git a/libs/database/src/file/s3_client_impl.rs b/libs/database/src/file/s3_client_impl.rs index aa111e6c..9dc6fa3d 100644 --- a/libs/database/src/file/s3_client_impl.rs +++ b/libs/database/src/file/s3_client_impl.rs @@ -90,6 +90,13 @@ impl AwsS3BucketClientImpl { .map_or(url.clone(), |presigned| { url.replace(&self.endpoint, presigned) }); + trace!( + "generated presigned url: {}, public presigned url:{}, endpoint:{}, presigned_url_endpoint:{:?}", + url, + public_url, + self.endpoint, + self.presigned_url_endpoint + ); Ok(public_url) } diff --git a/tests/workspace/import_test.rs b/tests/workspace/import_test.rs index 97b527cc..44633d93 100644 --- a/tests/workspace/import_test.rs +++ b/tests/workspace/import_test.rs @@ -193,10 +193,6 @@ async fn upload_file( .await? .presigned_url; - // if url.contains("http://minio:9000") { - // url = url.replace("http://minio:9000", "http://localhost/minio"); - // } - if let Some(secs) = upload_after_secs { tokio::time::sleep(Duration::from_secs(secs)).await; } @@ -215,9 +211,9 @@ async fn import_notion_zip_until_complete(name: &str) -> (TestClient, String) { // Uncomment the following lines to use the predicated upload file API. // Currently, we use `upload_file` to send a file to appflowy_worker, which then // processes the upload task. - // let file_path = PathBuf::from(format!("tests/workspace/asset/{name}")); - // client.api_client.import_file(&file_path).await.unwrap(); - upload_file(&client, name, None).await.unwrap(); + let file_path = PathBuf::from(format!("tests/workspace/asset/{name}")); + client.api_client.import_file(&file_path).await.unwrap(); + // upload_file(&client, name, None).await.unwrap(); let default_workspace_id = client.workspace_id().await;