feat: 添加虚拟调度器聊天 ID 前缀,跳过不应发送到外部通道的消息
This commit is contained in:
parent
f4758f8513
commit
83b525e442
@ -12,6 +12,9 @@ pub struct OutboundDispatcher {
|
|||||||
channels: Arc<RwLock<HashMap<String, Arc<dyn Channel + Send + Sync>>>>,
|
channels: Arc<RwLock<HashMap<String, Arc<dyn Channel + Send + Sync>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Prefix for virtual scheduler chat IDs that should not be sent to external channels.
|
||||||
|
const SCHEDULER_VIRTUAL_CHAT_ID_PREFIX: &str = "scheduler/";
|
||||||
|
|
||||||
impl OutboundDispatcher {
|
impl OutboundDispatcher {
|
||||||
pub fn new(bus: Arc<MessageBus>) -> Self {
|
pub fn new(bus: Arc<MessageBus>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -40,6 +43,17 @@ impl OutboundDispatcher {
|
|||||||
"OutboundDispatcher received message"
|
"OutboundDispatcher received message"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Skip messages with virtual scheduler chat IDs (e.g., "scheduler/job_id")
|
||||||
|
// These are internal messages from SilentAgentTask that should not be sent externally
|
||||||
|
if msg.chat_id.starts_with(SCHEDULER_VIRTUAL_CHAT_ID_PREFIX) {
|
||||||
|
tracing::debug!(
|
||||||
|
channel = %msg.channel,
|
||||||
|
chat_id = %msg.chat_id,
|
||||||
|
"Skipping message with virtual scheduler chat_id"
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let channel_name = msg.channel.clone();
|
let channel_name = msg.channel.clone();
|
||||||
let channel = self.channels.read().await.get(&channel_name).cloned();
|
let channel = self.channels.read().await.get(&channel_name).cloned();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user