storkit: merge 383_refactor_reorganize_chat_system_into_chat_module_with_transport_submodules
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
//! (it clears local session state and message history) and is not routed here.
|
||||
|
||||
use crate::http::context::{AppContext, OpenApiResult};
|
||||
use crate::matrix::commands::CommandDispatch;
|
||||
use crate::chat::transport::matrix::commands::CommandDispatch;
|
||||
use poem::http::StatusCode;
|
||||
use poem_openapi::{Object, OpenApi, Tags, payload::Json};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -112,7 +112,7 @@ fn dispatch_sync(
|
||||
format!("{bot_name} {cmd} {args}")
|
||||
};
|
||||
|
||||
match crate::matrix::commands::try_handle_command(&dispatch, &synthetic) {
|
||||
match crate::chat::transport::matrix::commands::try_handle_command(&dispatch, &synthetic) {
|
||||
Some(response) => response,
|
||||
None => {
|
||||
// Command exists in the registry but its fallback handler returns None
|
||||
@@ -138,7 +138,7 @@ async fn dispatch_assign(
|
||||
return "Usage: `/assign <number> <model>` (e.g. `/assign 42 opus`)".to_string();
|
||||
}
|
||||
|
||||
crate::matrix::assign::handle_assign("web-ui", number_str, model_str, project_root, agents)
|
||||
crate::chat::transport::matrix::assign::handle_assign("web-ui", number_str, model_str, project_root, agents)
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ async fn dispatch_start(
|
||||
Some(hint_str)
|
||||
};
|
||||
|
||||
crate::matrix::start::handle_start("web-ui", number_str, agent_hint, project_root, agents)
|
||||
crate::chat::transport::matrix::start::handle_start("web-ui", number_str, agent_hint, project_root, agents)
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -176,14 +176,14 @@ async fn dispatch_delete(
|
||||
if number_str.is_empty() || !number_str.chars().all(|c| c.is_ascii_digit()) {
|
||||
return "Usage: `/delete <number>` (e.g. `/delete 42`)".to_string();
|
||||
}
|
||||
crate::matrix::delete::handle_delete("web-ui", number_str, project_root, agents).await
|
||||
crate::chat::transport::matrix::delete::handle_delete("web-ui", number_str, project_root, agents).await
|
||||
}
|
||||
|
||||
async fn dispatch_rebuild(
|
||||
project_root: &std::path::Path,
|
||||
agents: &Arc<crate::agents::AgentPool>,
|
||||
) -> String {
|
||||
crate::matrix::rebuild::handle_rebuild("web-ui", project_root, agents).await
|
||||
crate::chat::transport::matrix::rebuild::handle_rebuild("web-ui", project_root, agents).await
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -31,8 +31,8 @@ use settings::SettingsApi;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::slack::SlackWebhookContext;
|
||||
use crate::whatsapp::WhatsAppWebhookContext;
|
||||
use crate::chat::transport::slack::SlackWebhookContext;
|
||||
use crate::chat::transport::whatsapp::WhatsAppWebhookContext;
|
||||
|
||||
const DEFAULT_PORT: u16 = 3001;
|
||||
|
||||
@@ -85,8 +85,8 @@ pub fn build_routes(
|
||||
if let Some(wa_ctx) = whatsapp_ctx {
|
||||
route = route.at(
|
||||
"/webhook/whatsapp",
|
||||
get(crate::whatsapp::webhook_verify)
|
||||
.post(crate::whatsapp::webhook_receive)
|
||||
get(crate::chat::transport::whatsapp::webhook_verify)
|
||||
.post(crate::chat::transport::whatsapp::webhook_receive)
|
||||
.data(wa_ctx),
|
||||
);
|
||||
}
|
||||
@@ -95,11 +95,11 @@ pub fn build_routes(
|
||||
route = route
|
||||
.at(
|
||||
"/webhook/slack",
|
||||
post(crate::slack::webhook_receive).data(sl_ctx.clone()),
|
||||
post(crate::chat::transport::slack::webhook_receive).data(sl_ctx.clone()),
|
||||
)
|
||||
.at(
|
||||
"/webhook/slack/command",
|
||||
post(crate::slack::slash_command_receive).data(sl_ctx),
|
||||
post(crate::chat::transport::slack::slash_command_receive).data(sl_ctx),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user