mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-06 15:38:59 +08:00
add sessions tool and subagents steer control
This commit is contained in:
@@ -3,6 +3,7 @@ package tools
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -22,6 +23,7 @@ type SubagentTask struct {
|
||||
OriginChatID string
|
||||
Status string
|
||||
Result string
|
||||
Steering []string
|
||||
Created int64
|
||||
Updated int64
|
||||
}
|
||||
@@ -230,3 +232,19 @@ func (sm *SubagentManager) KillTask(taskID string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (sm *SubagentManager) SteerTask(taskID, message string) bool {
|
||||
sm.mu.Lock()
|
||||
defer sm.mu.Unlock()
|
||||
t, ok := sm.tasks[taskID]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
message = strings.TrimSpace(message)
|
||||
if message == "" {
|
||||
return false
|
||||
}
|
||||
t.Steering = append(t.Steering, message)
|
||||
t.Updated = time.Now().UnixMilli()
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user