systemprompt-runtime 0.1.22

Application runtime context and module registry for systemprompt.io
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::Result;
use systemprompt_database::{
    DatabaseProvider, install_module_schemas_from_source, install_module_seeds_from_path,
};
use systemprompt_models::modules::Module;

use crate::AppContext;

pub async fn install_module(module: &Module) -> Result<()> {
    let app_context = AppContext::new().await?;
    install_module_with_db(module, app_context.db_pool().as_ref()).await
}

pub async fn install_module_with_db(module: &Module, db: &dyn DatabaseProvider) -> Result<()> {
    install_module_schemas_from_source(module, db).await?;
    install_module_seeds_from_path(module, db).await?;
    Ok(())
}