mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-02 10:58:58 +08:00
fix bug
This commit is contained in:
@@ -3,6 +3,8 @@ package agent
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/bus"
|
||||
)
|
||||
|
||||
func TestParseTaskExecutionDirectives_RunCommand(t *testing.T) {
|
||||
@@ -152,3 +154,36 @@ func TestExtractJSONObject_Invalid(t *testing.T) {
|
||||
t.Fatalf("expected empty json, got: %q", raw)
|
||||
}
|
||||
}
|
||||
|
||||
func TestShouldHandleControlIntents_UserMessage(t *testing.T) {
|
||||
msg := bus.InboundMessage{
|
||||
SenderID: "user",
|
||||
Content: "请进入自主模式",
|
||||
}
|
||||
if !shouldHandleControlIntents(msg) {
|
||||
t.Fatalf("expected user message to be control-eligible")
|
||||
}
|
||||
}
|
||||
|
||||
func TestShouldHandleControlIntents_AutonomySyntheticSender(t *testing.T) {
|
||||
msg := bus.InboundMessage{
|
||||
SenderID: "autonomy",
|
||||
Content: "自主模式第 1 轮推进",
|
||||
}
|
||||
if shouldHandleControlIntents(msg) {
|
||||
t.Fatalf("expected autonomy synthetic message to be ignored for control intents")
|
||||
}
|
||||
}
|
||||
|
||||
func TestShouldHandleControlIntents_AutoLearnSyntheticMetadata(t *testing.T) {
|
||||
msg := bus.InboundMessage{
|
||||
SenderID: "gateway",
|
||||
Content: "自动学习第 1 轮",
|
||||
Metadata: map[string]string{
|
||||
"source": "autolearn",
|
||||
},
|
||||
}
|
||||
if shouldHandleControlIntents(msg) {
|
||||
t.Fatalf("expected autolearn synthetic metadata message to be ignored for control intents")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user