Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Jan 2, 2025
1 parent 76c85df commit 116b279
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libs/indexer/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ use database_entity::dto::AFCollabEmbeddedChunk;
use infra::env_util::get_env_var;
use rayon::prelude::*;
use redis::aio::ConnectionManager;
use secrecy::{ExposeSecret, Secret};
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
use std::cmp::max;
use std::collections::HashSet;
use std::ops::DerefMut;
use std::sync::{Arc, Weak};
use std::time::{Duration, Instant};
use secrecy::{ExposeSecret, Secret};
use tokio::sync::mpsc;
use tokio::sync::mpsc::error::TrySendError;
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
Expand Down
7 changes: 5 additions & 2 deletions services/appflowy-worker/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use indexer::metrics::EmbeddingMetrics;
use indexer::thread_pool::ThreadPoolNoAbortBuilder;
use infra::env_util::get_env_var;
use mailer::sender::Mailer;
use secrecy::{ExposeSecret, Secret};
use std::sync::{Arc, Once};
use std::time::Duration;
use secrecy::{ExposeSecret, Secret};
use tokio::net::TcpListener;
use tokio::task::LocalSet;
use tracing::info;
Expand Down Expand Up @@ -144,7 +144,10 @@ pub async fn create_app(listener: TcpListener, config: Config) -> Result<(), Err
enable: appflowy_collaborate::config::get_env_var("APPFLOWY_INDEXER_ENABLED", "true")
.parse::<bool>()
.unwrap_or(true),
open_api_key: Secret::new(appflowy_collaborate::config::get_env_var("APPFLOWY_AI_OPENAI_API_KEY", "")),
open_api_key: Secret::new(appflowy_collaborate::config::get_env_var(
"APPFLOWY_AI_OPENAI_API_KEY",
"",
)),
tick_interval_secs: 10,
},
));
Expand Down
6 changes: 4 additions & 2 deletions services/appflowy-worker/src/indexer_worker/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use indexer::vector::embedder::Embedder;
use indexer::vector::open_ai;
use rayon::prelude::*;
use redis::aio::ConnectionManager;
use secrecy::{ExposeSecret, Secret};
use sqlx::PgPool;
use std::sync::Arc;
use std::time::{Duration, Instant};
use secrecy::{ExposeSecret, Secret};
use tokio::sync::mpsc::{unbounded_channel, UnboundedSender};
use tokio::sync::RwLock;
use tokio::time::{interval, MissedTickBehavior};
Expand Down Expand Up @@ -243,5 +243,7 @@ fn handle_task(
}

fn create_embedder(config: &BackgroundIndexerConfig) -> Embedder {
Embedder::OpenAI(open_ai::Embedder::new(config.open_api_key.expose_secret().clone()))
Embedder::OpenAI(open_ai::Embedder::new(
config.open_api_key.expose_secret().clone(),
))
}

0 comments on commit 116b279

Please sign in to comment.