feat: reduced memory usage

This commit is contained in:
Per Stark
2025-01-16 08:29:49 +01:00
parent c0d5fde2a4
commit 0826a23a60
5 changed files with 119 additions and 96 deletions

View File

@@ -21,14 +21,17 @@ use super::analysis::{
pub struct ContentProcessor {
db_client: Arc<SurrealDbClient>,
openai_client: async_openai::Client<async_openai::config::OpenAIConfig>,
openai_client: Arc<async_openai::Client<async_openai::config::OpenAIConfig>>,
}
impl ContentProcessor {
pub async fn new(surreal_db_client: Arc<SurrealDbClient>) -> Result<Self, AppError> {
pub async fn new(
surreal_db_client: Arc<SurrealDbClient>,
openai_client: Arc<async_openai::Client<async_openai::config::OpenAIConfig>>,
) -> Result<Self, AppError> {
Ok(Self {
db_client: surreal_db_client,
openai_client: async_openai::Client::new(),
openai_client,
})
}