chore: shorten default write interval (#661)
This commit is contained in:
parent
59b2fefee9
commit
a6539dd963
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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(),
|
||||||
|
|
|
||||||
|
|
@ -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"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue