chore: support flex response layout (#1215)

* chore: support flex response layout
This commit is contained in:
Nathan.fooo 2025-02-06 17:32:10 +08:00 committed by GitHub
parent a7dff1b7d8
commit c80157a687
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 15 deletions

View File

@ -91,7 +91,6 @@ APPFLOWY_S3_ACCESS_KEY=${AWS_ACCESS_KEY}
APPFLOWY_S3_SECRET_KEY=${AWS_SECRET}
APPFLOWY_S3_BUCKET=appflowy
#APPFLOWY_S3_REGION=us-east-1
APPFLOWY_S3_PRESIGNED_URL_ENDPOINT=http://localhost/minio-api
# AppFlowy Cloud Mailer
# Note that smtps (TLS) is always required, even for ports other than 465

View File

@ -44,11 +44,12 @@ pub struct ResponseFormat {
#[derive(Clone, Debug, Default, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum OutputLayout {
#[default]
Paragraph = 0,
BulletList = 1,
NumberedList = 2,
SimpleTable = 3,
#[default]
Flex = 4,
}
#[derive(Clone, Debug, Default, Serialize_repr, Deserialize_repr, Eq, PartialEq)]

View File

@ -2,6 +2,7 @@ use crate::client::{localhost_client, LOCALHOST_GOTRUE};
use crate::log::setup_log;
use client_api::Client;
use lazy_static::lazy_static;
use tokio::sync::OnceCell;
use uuid::Uuid;
lazy_static! {
@ -12,7 +13,6 @@ lazy_static! {
password: std::env::var("GOTRUE_ADMIN_PASSWORD").unwrap_or("password".to_string()),
}
};
static ref ADMIN_SIGN_IN_MUTEX: tokio::sync::Mutex<()> = tokio::sync::Mutex::new(());
}
#[derive(Clone, Debug)]
@ -25,20 +25,20 @@ pub fn generate_unique_email() -> String {
format!("user_{}@appflowy.io", Uuid::new_v4())
}
pub async fn admin_user_client() -> Client {
let admin_client = localhost_client();
#[cfg(target_arch = "wasm32")]
{
let msg = format!("{}", admin_client);
web_sys::console::log_1(&msg.into());
}
static ADMIN_USER_CLIENT: OnceCell<Client> = OnceCell::const_new();
let _guard = ADMIN_SIGN_IN_MUTEX.lock().await;
let _is_new = admin_client
.sign_in_password(&ADMIN_USER.email, &ADMIN_USER.password)
pub async fn admin_user_client() -> Client {
ADMIN_USER_CLIENT
.get_or_init(|| async {
let client = localhost_client();
client
.sign_in_password(&ADMIN_USER.email, &ADMIN_USER.password)
.await
.expect("Failed to sign in admin user");
client
})
.await
.unwrap();
admin_client
.clone()
}
pub async fn generate_unique_registered_user() -> User {