chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"academy/internal/agent/tools"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestBrowserSourcePromptFollowsExplicitTurnSelection(t *testing.T) {
|
||||
for _, custom := range []string{"", "Prefer knowledge-base search and Skills for research."} {
|
||||
engine := newTestEngine(t, &mockChat{})
|
||||
engine.systemPromptTemplate = custom
|
||||
require.NotContains(t, engine.buildSystemPrompt(t.Context()), "User-selected source for this turn")
|
||||
engine.config.LocalBrowserEnabled = true
|
||||
require.NotContains(
|
||||
t,
|
||||
engine.buildSystemPrompt(t.Context()),
|
||||
"User-selected source for this turn",
|
||||
"selection alone cannot advertise an unavailable tool",
|
||||
)
|
||||
engine.toolRegistry = tools.NewToolRegistry()
|
||||
engine.toolRegistry.RegisterTool(newCountingTool("local_browser"))
|
||||
prompt := engine.buildSystemPrompt(t.Context())
|
||||
require.Contains(t, prompt, "Use local_browser")
|
||||
require.Contains(t, prompt, "Other enabled tools remain available")
|
||||
require.Contains(t, prompt, "not merely permission to use it")
|
||||
require.NotContains(t, prompt, "tools are disabled")
|
||||
require.Contains(t, prompt, "Do not silently")
|
||||
engine.config.LocalBrowserEnabled = false
|
||||
engine.toolRegistry = tools.NewToolRegistry()
|
||||
require.NotContains(t, engine.buildSystemPrompt(t.Context()), "User-selected source for this turn")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user