Files
HomeAgent/internal/agent/core/gpttest_test.go
JianFeeeee 4e70b8d5d8 refactor(module): 核心仓 Go module 路径改为 github.com/JianFeeeee/HologramAgent
批 1,不含 SDK 仓与目录改名。

- go.mod 第 1 行 module 路径
- 366 个 .go 文件的完整前缀 github.com/JianFeeeee/HomeAgent 机械替换
  (857 处,仅完整前缀;展示名/注释里的 HomeAgent 字样留给批 5)
- 未改:third_party 目录名、SDK 自身 go.mod module、go.mod replace 目标、
  homed/waiter 可执行名、.hmap 后缀
2026-10-21 12:17:19 +08:00

34 lines
1.3 KiB
Go

package core
import (
"strings"
"testing"
"github.com/JianFeeeee/HologramAgent/internal/sdk"
)
func TestExecuteGetPluginTools(tmp *testing.T) {
sh := NewStageHost()
sh.RegisterTool("weather_current", sdk.ToolDef{Name: "weather_current", Plugin: "weather", Description: "当前天气", Parameters: map[string]interface{}{"type": "object"}}, nil)
sh.RegisterTool("weather_forecast", sdk.ToolDef{Name: "weather_forecast", Plugin: "weather", Description: "天气预报"}, nil)
sh.RegisterTool("device_ctl_cmdrun", sdk.ToolDef{Name: "device_ctl_cmdrun", Plugin: "remotedevice", Description: "下发命令"}, nil)
a := New(AgentConfig{ID: "t", StageHost: sh})
out := a.executeGetPluginTools("weather")
if !strings.Contains(out, "weather_current") || !strings.Contains(out, "weather_forecast") {
tmp.Fatalf("weather tools missing:\n%s", out)
}
if strings.Contains(out, "device_ctl_cmdrun") {
tmp.Fatalf("should not contain other plugin:\n%s", out)
}
all := a.executeGetPluginTools("")
if !strings.Contains(all, "weather_current") || !strings.Contains(all, "device_ctl_cmdrun") {
tmp.Fatalf("all tools missing:\n%s", all)
}
none := a.executeGetPluginTools("nope")
if !strings.Contains(none, "没有可用的工具") {
tmp.Fatalf("unknown plugin msg:\n%s", none)
}
}