Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: complete text endpoints #557

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: complete text endpoints
  • Loading branch information
appflowy committed May 16, 2024
commit 856c36fac894dec04296b4f654c37bf4a02c4a16
3 changes: 1 addition & 2 deletions deploy.env
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ GOTRUE_EXTERNAL_DISCORD_REDIRECT_URI=http://your-host/gotrue/callback
# This is where storage like images, files, etc. will be stored
# By default, Minio is used as the default file storage which uses host's file system
APPFLOWY_S3_USE_MINIO=true
APPFLOWY_S3_MINIO_URL=http://minio:9000 # change this if you are using a different address for minio
APPFLOWY_S3_MINIO_URL=http://minio:9000# change this if you are using a different address for minio
APPFLOWY_S3_ACCESS_KEY=minioadmin
APPFLOWY_S3_SECRET_KEY=minioadmin
APPFLOWY_S3_BUCKET=appflowy
Expand Down Expand Up @@ -108,7 +108,6 @@ CLOUDFLARE_TUNNEL_TOKEN=

# AppFlowy AI
APPFLOWY_AI_OPENAI_API_KEY=
APPFLOWY_AI_SERVER_HOST=ai
APPFLOWY_AI_SERVER_PORT=5001

# AppFlowy History
Expand Down
1 change: 0 additions & 1 deletion dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ CLOUDFLARE_TUNNEL_TOKEN=

# AppFlowy AI
APPFLOWY_AI_OPENAI_API_KEY=
APPFLOWY_AI_SERVER_HOST=localhost
APPFLOWY_AI_SERVER_PORT=5001

# AppFlowy History
Expand Down
4 changes: 1 addition & 3 deletions src/api/ai_tool.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use crate::biz::chat::ops::create_chat;
use crate::state::AppState;
use actix_web::web::{Data, Json};
use actix_web::{web, App, Scope};
use actix_web::{web, Scope};
use app_error::AppError;
use appflowy_ai_client::dto::CompleteTextResponse;
use database_entity::chat::CreateChatParams;
use shared_entity::dto::ai_dto::{
CompleteTextParams, SummarizeRowData, SummarizeRowParams, SummarizeRowResponse,
};
Expand Down
1 change: 0 additions & 1 deletion src/api/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use collab_rt_protocol::validate_encode_collab;
use database::collab::CollabStorage;
use database::user::select_uid_from_email;
use database_entity::dto::*;
use shared_entity::dto::ai_dto::{SummarizeRowData, SummarizeRowParams, SummarizeRowResponse};
use shared_entity::dto::workspace_dto::*;
use shared_entity::response::AppResponseError;
use shared_entity::response::{AppResponse, JsonAppResponse};
Expand Down
20 changes: 20 additions & 0 deletions tests/ai_test/complete_text.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use appflowy_ai_client::dto::CompletionType;
use client_api_test::TestClient;
use shared_entity::dto::ai_dto::CompleteTextParams;

#[tokio::test]
async fn improve_writing_test() {
let test_client = TestClient::new_user().await;
let workspace_id = test_client.workspace_id().await;
let params = CompleteTextParams {
text: "I feel hungry".to_string(),
completion_type: CompletionType::ImproveWriting,
};

let resp = test_client
.api_client
.completion_text(&workspace_id, params)
.await
.unwrap();
assert!(resp.text.contains("hungry"));
}
1 change: 1 addition & 0 deletions tests/ai_test/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
mod complete_text;
mod summarize_row;
Loading