chore: shorten default write interval (#661)

This commit is contained in:
Nathan.fooo 2024-06-28 10:06:09 +08:00 committed by GitHub
parent 59b2fefee9
commit a6539dd963
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View File

@ -184,7 +184,7 @@ impl RedisSortedSet {
} }
} }
#[derive(Clone, Serialize, Deserialize)] #[derive(Clone, Serialize, Deserialize, Debug)]
pub struct PendingWrite { pub struct PendingWrite {
pub object_id: String, pub object_id: String,
pub seq: i64, pub seq: i64,
@ -201,7 +201,7 @@ impl PendingWrite {
} }
} }
#[derive(Clone, Serialize_repr, Deserialize_repr)] #[derive(Clone, Serialize_repr, Deserialize_repr, Debug)]
#[repr(u8)] #[repr(u8)]
pub enum WritePriority { pub enum WritePriority {
High = 0, High = 0,

View File

@ -115,7 +115,7 @@ pub fn get_configuration() -> Result<Config, anyhow::Error> {
) )
.parse()?, .parse()?,
edit_state_max_count: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_COUNT", "100").parse()?, edit_state_max_count: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_COUNT", "100").parse()?,
edit_state_max_secs: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_SECS", "360").parse()?, edit_state_max_secs: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_SECS", "60").parse()?,
}, },
redis_uri: get_env_var("APPFLOWY_REDIS_URI", "redis://localhost:6379").into(), redis_uri: get_env_var("APPFLOWY_REDIS_URI", "redis://localhost:6379").into(),
}; };

View File

@ -4,23 +4,25 @@ use appflowy_ai_client::client::AppFlowyAIClient;
use appflowy_ai_client::dto::{ use appflowy_ai_client::dto::{
EmbeddingEncodingFormat, EmbeddingInput, EmbeddingOutput, EmbeddingRequest, EmbeddingsModel, EmbeddingEncodingFormat, EmbeddingInput, EmbeddingOutput, EmbeddingRequest, EmbeddingsModel,
}; };
use database::index::{search_documents, SearchDocumentParams}; use database::index::{search_documents, SearchDocumentParams};
use shared_entity::dto::search_dto::{ use shared_entity::dto::search_dto::{
SearchContentType, SearchDocumentRequest, SearchDocumentResponseItem, SearchContentType, SearchDocumentRequest, SearchDocumentResponseItem,
}; };
use shared_entity::response::AppResponseError; use shared_entity::response::AppResponseError;
use sqlx::PgPool; use sqlx::PgPool;
use uuid::Uuid; use uuid::Uuid;
pub async fn search_document( pub async fn search_document(
pg_pool: &PgPool, pg_pool: &PgPool,
openai: &AppFlowyAIClient, ai_client: &AppFlowyAIClient,
uid: i64, uid: i64,
workspace_id: Uuid, workspace_id: Uuid,
request: SearchDocumentRequest, request: SearchDocumentRequest,
metrics: &RequestMetrics, metrics: &RequestMetrics,
) -> Result<Vec<SearchDocumentResponseItem>, AppResponseError> { ) -> Result<Vec<SearchDocumentResponseItem>, AppResponseError> {
let embeddings = openai let embeddings = ai_client
.embeddings(EmbeddingRequest { .embeddings(EmbeddingRequest {
input: EmbeddingInput::String(request.query.clone()), input: EmbeddingInput::String(request.query.clone()),
model: EmbeddingsModel::TextEmbedding3Small.to_string(), model: EmbeddingsModel::TextEmbedding3Small.to_string(),

View File

@ -192,7 +192,7 @@ pub fn get_configuration() -> Result<Config, anyhow::Error> {
) )
.parse()?, .parse()?,
edit_state_max_count: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_COUNT", "100").parse()?, edit_state_max_count: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_COUNT", "100").parse()?,
edit_state_max_secs: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_SECS", "360").parse()?, edit_state_max_secs: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_SECS", "60").parse()?,
}, },
mailer: MailerSetting { mailer: MailerSetting {
smtp_host: get_env_var("APPFLOWY_MAILER_SMTP_HOST", "smtp.gmail.com"), smtp_host: get_env_var("APPFLOWY_MAILER_SMTP_HOST", "smtp.gmail.com"),