mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-05-28 10:11:37 +02:00
Add files via upload
This commit is contained in:
@@ -234,7 +234,7 @@ func (h *RobotHandler) HandleMessage(platform, userID, text string) (reply strin
|
||||
_ = h.db.UpdateConversationTitle(convID, newTitle)
|
||||
}
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), h.robotMessageTimeout())
|
||||
sk := h.sessionKey(platform, userID)
|
||||
h.cancelMu.Lock()
|
||||
h.runningCancels[sk] = cancel
|
||||
@@ -252,6 +252,9 @@ func (h *RobotHandler) HandleMessage(platform, userID, text string) (reply strin
|
||||
if errors.Is(err, context.Canceled) {
|
||||
return "任务已取消。"
|
||||
}
|
||||
if errors.Is(err, context.DeadlineExceeded) {
|
||||
return "任务执行超时,请稍后重试或精简本次请求范围。"
|
||||
}
|
||||
return "处理失败: " + err.Error()
|
||||
}
|
||||
if newConvID != convID {
|
||||
@@ -260,6 +263,11 @@ func (h *RobotHandler) HandleMessage(platform, userID, text string) (reply strin
|
||||
return resp
|
||||
}
|
||||
|
||||
func (h *RobotHandler) robotMessageTimeout() time.Duration {
|
||||
// 机器人整次消息处理超时(与单次工具超时 agent.tool_timeout_minutes 解耦)。
|
||||
return 10 * time.Hour
|
||||
}
|
||||
|
||||
func (h *RobotHandler) cmdHelp() string {
|
||||
return "**【CyberStrikeAI 机器人命令】**\n\n" +
|
||||
"- `帮助` `help` — 显示本帮助 | Show this help\n" +
|
||||
|
||||
Reference in New Issue
Block a user