diff --git a/src/channels/feishu.rs b/src/channels/feishu.rs index b008b23..e328b5f 100644 --- a/src/channels/feishu.rs +++ b/src/channels/feishu.rs @@ -1620,6 +1620,15 @@ impl Default for MdPatterns { } impl FeishuChannel { + fn strip_thinking_tags(content: &str) -> String { + use std::sync::LazyLock; + static THINK_RE: LazyLock = LazyLock::new(|| { + Regex::new(r"(?s).*?").unwrap() + }); + let stripped = THINK_RE.replace_all(content, ""); + stripped.trim().to_string() + } + /// Determine the optimal Feishu message format for content. fn detect_msg_format(content: &str) -> MsgFormat { let patterns = MdPatterns::new(); @@ -2075,6 +2084,10 @@ impl Channel for FeishuChannel { } async fn send(&self, msg: OutboundMessage) -> Result<(), ChannelError> { + let msg = OutboundMessage { + content: Self::strip_thinking_tags(&msg.content), + ..msg + }; let receive_id = if msg.chat_id.starts_with("oc_") { &msg.chat_id } else { &msg.reply_to.as_ref().unwrap_or(&msg.chat_id) }; let receive_id_type = if msg.chat_id.starts_with("oc_") { "chat_id" } else { "open_id" };