mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-03 10:57:35 +08:00
chore: update project files
This commit is contained in:
@@ -371,19 +371,6 @@ func (al *AgentLoop) buildSubagentRunInput(run *tools.SubagentRun) string {
|
||||
return taskText
|
||||
}
|
||||
|
||||
func nodeAgentTaskResult(payload map[string]interface{}) string {
|
||||
if len(payload) == 0 {
|
||||
return ""
|
||||
}
|
||||
if result := tools.MapStringArg(payload, "result"); result != "" {
|
||||
return result
|
||||
}
|
||||
if content := tools.MapStringArg(payload, "content"); content != "" {
|
||||
return content
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (al *AgentLoop) readSubagentPromptFile(relPath string) string {
|
||||
if al == nil {
|
||||
return ""
|
||||
|
||||
@@ -6,25 +6,13 @@ func TestResolveMessageToolTargetUsesStringHelpers(t *testing.T) {
|
||||
channel, chat := resolveMessageToolTarget(map[string]interface{}{
|
||||
"channel": "telegram",
|
||||
"to": "chat-2",
|
||||
}, "whatsapp", "chat-1")
|
||||
}, "weixin", "chat-1")
|
||||
if channel != "telegram" || chat != "chat-2" {
|
||||
t.Fatalf("unexpected target: %s %s", channel, chat)
|
||||
}
|
||||
|
||||
channel, chat = resolveMessageToolTarget(map[string]interface{}{}, "whatsapp", "chat-1")
|
||||
if channel != "whatsapp" || chat != "chat-1" {
|
||||
channel, chat = resolveMessageToolTarget(map[string]interface{}{}, "weixin", "chat-1")
|
||||
if channel != "weixin" || chat != "chat-1" {
|
||||
t.Fatalf("unexpected fallback target: %s %s", channel, chat)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeAgentTaskResultUsesCompatiblePayloadFields(t *testing.T) {
|
||||
if got := nodeAgentTaskResult(map[string]interface{}{"result": "done"}); got != "done" {
|
||||
t.Fatalf("unexpected result field extraction: %q", got)
|
||||
}
|
||||
if got := nodeAgentTaskResult(map[string]interface{}{"content": "fallback"}); got != "fallback" {
|
||||
t.Fatalf("unexpected content field extraction: %q", got)
|
||||
}
|
||||
if got := nodeAgentTaskResult(nil); got != "" {
|
||||
t.Fatalf("expected empty result for nil payload, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user