mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 20:47:49 +08:00
fix bug
This commit is contained in:
@@ -591,15 +591,8 @@ func (al *AgentLoop) maybeRunAutonomyRound(msg bus.InboundMessage) bool {
|
||||
s.lastNudgeAt = now
|
||||
s.pending = true
|
||||
focus := strings.TrimSpace(s.focus)
|
||||
idleFor := now.Sub(s.lastUserAt).Truncate(time.Second)
|
||||
al.autonomyMu.Unlock()
|
||||
|
||||
al.bus.PublishOutbound(bus.OutboundMessage{
|
||||
Channel: msg.Channel,
|
||||
ChatID: msg.ChatID,
|
||||
Content: fmt.Sprintf("[自主模式] 你已空闲 %s,我已启动第 %d 轮自主推进。", idleFor, round),
|
||||
})
|
||||
|
||||
al.bus.PublishInbound(bus.InboundMessage{
|
||||
Channel: msg.Channel,
|
||||
SenderID: "autonomy",
|
||||
@@ -893,18 +886,22 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
|
||||
}
|
||||
|
||||
directives := parseTaskExecutionDirectives(msg.Content)
|
||||
if inferred, ok := al.inferTaskExecutionDirectives(ctx, msg.Content); ok {
|
||||
// Explicit /run/@run command always has higher priority than inferred directives.
|
||||
if !isExplicitRunCommand(msg.Content) {
|
||||
directives = inferred
|
||||
if controlEligible {
|
||||
if inferred, ok := al.inferTaskExecutionDirectives(ctx, msg.Content); ok {
|
||||
// Explicit /run/@run command always has higher priority than inferred directives.
|
||||
if !isExplicitRunCommand(msg.Content) {
|
||||
directives = inferred
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Synthetic messages should run quietly and only report final outcomes.
|
||||
directives.stageReport = false
|
||||
}
|
||||
userPrompt := directives.task
|
||||
if strings.TrimSpace(userPrompt) == "" {
|
||||
userPrompt = msg.Content
|
||||
}
|
||||
if al.isAutonomyEnabled(msg.SessionKey) && controlEligible {
|
||||
directives.stageReport = true
|
||||
userPrompt = buildAutonomyTaskPrompt(userPrompt)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user