@@ -2,6 +2,7 @@ use crate::{
|
||||
bot::Bot,
|
||||
gitea::{GiteaAPI, WebhookType},
|
||||
open_router::OpenRouterClient,
|
||||
sandbox::SandboxConfig,
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
@@ -20,6 +21,7 @@ mod errors;
|
||||
mod gitea;
|
||||
mod metrics;
|
||||
mod open_router;
|
||||
mod sandbox;
|
||||
mod state;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
@@ -76,6 +78,19 @@ async fn run() -> anyhow::Result<()> {
|
||||
|
||||
let shutdown = CancellationToken::new();
|
||||
|
||||
let sandbox = SandboxConfig {
|
||||
enabled: config.sandbox_enabled,
|
||||
runtime: devcontainer_rs::ContainerRuntime::new(config.container_runtime.clone()),
|
||||
max_iterations: config.sandbox_max_iterations,
|
||||
};
|
||||
|
||||
if sandbox.enabled && !sandbox.runtime.available().await {
|
||||
warn!(
|
||||
runtime = sandbox.runtime.program(),
|
||||
"Sandbox is enabled but the container runtime is not available"
|
||||
);
|
||||
}
|
||||
|
||||
let bot = Bot::new(
|
||||
gitea_user.login,
|
||||
gitea_api,
|
||||
@@ -83,6 +98,7 @@ async fn run() -> anyhow::Result<()> {
|
||||
reqwest::Client::new(),
|
||||
config.bot_max_concurrent,
|
||||
config.open_router_model.clone(),
|
||||
sandbox,
|
||||
);
|
||||
|
||||
let (tx, rx) = tokio::sync::mpsc::channel::<WebhookType>(config.bot_max_concurrent * 2);
|
||||
|
||||
Reference in New Issue
Block a user