mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-28 12:21:56 +01:00
feat: improved configuration
configuration now works with both env variables and config file
This commit is contained in:
@@ -37,7 +37,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
db.ensure_initialized().await?;
|
||||
|
||||
let session_store = Arc::new(db.create_session_store().await?);
|
||||
let openai_client = Arc::new(async_openai::Client::new());
|
||||
let openai_client = Arc::new(async_openai::Client::with_config(
|
||||
OpenAIConfig::new().with_api_key(&config.openai_api_key),
|
||||
));
|
||||
|
||||
let html_state = HtmlState::new_with_resources(db, openai_client, session_store)?;
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
db.ensure_initialized().await?;
|
||||
|
||||
let session_store = Arc::new(db.create_session_store().await?);
|
||||
let openai_client = Arc::new(async_openai::Client::new());
|
||||
let openai_client = Arc::new(async_openai::Client::with_config(
|
||||
OpenAIConfig::new().with_api_key(&config.openai_api_key),
|
||||
));
|
||||
|
||||
let html_state = HtmlState::new_with_resources(db, openai_client, session_store)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user