chore: support explain text (#1213)
This commit is contained in:
parent
fdb7d62d0c
commit
a7dff1b7d8
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ pub enum CompletionType {
|
|||
MakeShorter = 3,
|
||||
MakeLonger = 4,
|
||||
ContinueWriting = 5,
|
||||
Explain = 6,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue