feat: 提示词新增全局变量 DataDir + 触发合并/种子意图默认值调整
- prompt: 新增全局运行时变量 {{.DataDir}}(服务端数据根目录 s.m.dir),
与 {{.Now}} 一样对所有 agent(planner/worker/mainagent/goals/chat 及自定义)可用;
各 Vars 结构体加 DataDir 字段并在渲染时填入根 workDir,globalPromptVars 登记以便
校验/UI 变量列表/预览识别(纯运行时变量,不入库,无需迁移)。
- trigger_merge_mode 默认 by_task→all(schema/config/后端兜底/前端初值同步)。
- seed_first_intent 默认 true→false(走标准先规划再执行);spawn_task 不再暴露该参数,
工具建任务一律 false。
This commit is contained in:
1 parent
4c33317c6a
commit
80fcf528dc
18 files changed
+61
-43
No files matched your search
@@ -20,7 +20,7 @@ func TestChatNowVarRenders(t *testing.T) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
out := chatSystem("tec_benchmark", "/tmp/x")
|
||||
out := chatSystem("tec_benchmark", "/app/data", "/tmp/x")
|
||||
if !strings.Contains(out, "当前时间:") {
|
||||
t.Fatalf("custom prompt body missing, likely fell back to default: %q", out)
|
||||
}
|
||||
@@ -30,6 +30,23 @@ func TestChatNowVarRenders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestChatDataDirVarRenders verifies the universal {{.DataDir}} runtime variable:
|
||||
// a custom prompt referencing it renders the server data root (s.m.dir), rather
|
||||
// than failing template execution and falling back to DefaultAssistantPrompt.
|
||||
func TestChatDataDirVarRenders(t *testing.T) {
|
||||
prev := PromptOverride
|
||||
defer func() { PromptOverride = prev }()
|
||||
|
||||
PromptOverride = func(key string) (string, bool) {
|
||||
return "数据根目录:{{.DataDir}}", true
|
||||
}
|
||||
|
||||
out := chatSystem("tec_benchmark", "/app/data", "/tmp/x")
|
||||
if !strings.Contains(out, "数据根目录:/app/data") {
|
||||
t.Fatalf("{{.DataDir}} did not render the data root: %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
// TestChatUnknownVarFallsBack verifies an out-of-catalog {{.X}} still degrades
|
||||
// safely to the default assistant prompt (never a half-rendered prompt).
|
||||
func TestChatUnknownVarFallsBack(t *testing.T) {
|
||||
@@ -40,7 +57,7 @@ func TestChatUnknownVarFallsBack(t *testing.T) {
|
||||
return "引用了不存在的变量:{{.Bogus}}", true
|
||||
}
|
||||
|
||||
out := chatSystem("whatever", "/tmp/x")
|
||||
out := chatSystem("whatever", "/app/data", "/tmp/x")
|
||||
if strings.Contains(out, "引用了不存在的变量") {
|
||||
t.Fatalf("broken template should have fallen back, got custom body: %q", out)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user