Initial commit

This commit is contained in:
Slavi Pantaleev
2024-09-12 13:44:06 +03:00
commit 946aa9d9e9
220 changed files with 26033 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
use crate::{entity::MessageContext, Bot};
pub mod create;
pub mod delete;
pub mod details;
pub mod determination;
pub mod help;
pub mod list;
pub use determination::{determine_controller, AgentControllerType};
pub async fn dispatch_controller(
handler: &AgentControllerType,
message_context: &MessageContext,
bot: &Bot,
) -> anyhow::Result<()> {
match handler {
AgentControllerType::CreateRoomLocal { provider, agent_id } => {
create::handle_room_local(
bot,
bot.room_config_manager(),
message_context,
provider,
agent_id,
)
.await
}
AgentControllerType::CreateGlobal { provider, agent_id } => {
create::handle_global(
bot,
bot.global_config_manager(),
message_context,
provider,
agent_id,
)
.await
}
AgentControllerType::List => list::handle(bot, message_context).await,
AgentControllerType::Details(agent_identifier) => {
details::handle(bot, message_context, agent_identifier).await
}
AgentControllerType::Delete(agent_identifier) => {
delete::handle(
bot,
bot.room_config_manager(),
bot.global_config_manager(),
message_context,
agent_identifier,
)
.await
}
AgentControllerType::Help => help::handle(bot, message_context).await,
}
}