修复错误警告
This commit is contained in:
@@ -50,7 +50,7 @@ impl TelegramBackend {
|
||||
|
||||
let resp = self
|
||||
.client
|
||||
.post(&self.api_url("sendMessage"))
|
||||
.post(self.api_url("sendMessage"))
|
||||
.json(&body)
|
||||
.send()
|
||||
.await
|
||||
@@ -94,7 +94,7 @@ impl ChatChannelBackend for TelegramBackend {
|
||||
// Verify bot token by calling getMe
|
||||
let resp = self
|
||||
.client
|
||||
.get(&self.api_url("getMe"))
|
||||
.get(self.api_url("getMe"))
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| ChatChannelError::ConnectionFailed(e.to_string()))?;
|
||||
@@ -217,7 +217,7 @@ impl ChatChannelBackend for TelegramBackend {
|
||||
async fn test_connection(&self) -> Result<(), ChatChannelError> {
|
||||
let resp = self
|
||||
.client
|
||||
.get(&self.api_url("getMe"))
|
||||
.get(self.api_url("getMe"))
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| ChatChannelError::ConnectionFailed(e.to_string()))?;
|
||||
|
||||
@@ -88,7 +88,7 @@ pub async fn handle_search(db: &DatabaseConnection, keyword: &str) -> RichMessag
|
||||
}
|
||||
|
||||
RichMessage::info(body.trim_end())
|
||||
.with_title(&format!("搜索 \"{}\" - {} 条结果", keyword, matched.len()))
|
||||
.with_title(format!("搜索 \"{}\" - {} 条结果", keyword, matched.len()))
|
||||
}
|
||||
|
||||
pub async fn handle_detail(db: &DatabaseConnection, conversation_id: i32) -> RichMessage {
|
||||
@@ -114,11 +114,11 @@ pub async fn handle_detail(db: &DatabaseConnection, conversation_id: i32) -> Ric
|
||||
|
||||
let title = conv.title.as_deref().unwrap_or("(无标题)");
|
||||
RichMessage::info(title)
|
||||
.with_title(&format!("会话详情 #{}", conv.id))
|
||||
.with_title(format!("会话详情 #{}", conv.id))
|
||||
.with_field("代理", &conv.agent_type)
|
||||
.with_field("状态", format!("{:?}", conv.status))
|
||||
.with_field("消息数", &conv.message_count.to_string())
|
||||
.with_field("创建时间", &conv.created_at.format("%Y-%m-%d %H:%M").to_string())
|
||||
.with_field("消息数", conv.message_count.to_string())
|
||||
.with_field("创建时间", conv.created_at.format("%Y-%m-%d %H:%M").to_string())
|
||||
}
|
||||
|
||||
pub async fn handle_today(db: &DatabaseConnection) -> RichMessage {
|
||||
@@ -176,7 +176,7 @@ pub async fn handle_today(db: &DatabaseConnection) -> RichMessage {
|
||||
}
|
||||
}
|
||||
|
||||
RichMessage::info(body).with_title(&format!(
|
||||
RichMessage::info(body).with_title(format!(
|
||||
"今日活动 ({})",
|
||||
now.format("%Y-%m-%d")
|
||||
))
|
||||
|
||||
@@ -27,6 +27,12 @@ pub struct ChatChannelManager {
|
||||
inner: Arc<Inner>,
|
||||
}
|
||||
|
||||
impl Default for ChatChannelManager {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl ChatChannelManager {
|
||||
pub fn new() -> Self {
|
||||
let (command_tx, command_rx) = mpsc::channel(256);
|
||||
|
||||
Reference in New Issue
Block a user