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
+7
-6
@@ -57,14 +57,15 @@ func chatWorkDirSpec(workDir string) string {
|
||||
|
||||
// chatSystem renders the DB-managed prompt body for agentKey. Custom agents have
|
||||
// no per-key in-code default, so DefaultAssistantPrompt is the render fallback.
|
||||
func chatSystem(agentKey, workDir string) string {
|
||||
return renderSystem(agentKey, DefaultAssistantPrompt, chatVars{Now: nowStr()}) + chatWorkDirSpec(workDir)
|
||||
func chatSystem(agentKey, dataDir, workDir string) string {
|
||||
return renderSystem(agentKey, DefaultAssistantPrompt, chatVars{DataDir: dataDir, Now: nowStr()}) + chatWorkDirSpec(workDir)
|
||||
}
|
||||
|
||||
// chatVars carries the runtime variables a custom agent's prompt may reference.
|
||||
// Now (server wall-clock, refreshed each turn) is the only one today; any other
|
||||
// {{.X}} fails to render and falls back to DefaultAssistantPrompt.
|
||||
type chatVars struct{ Now string }
|
||||
// DataDir (server data root) + Now (server wall-clock, refreshed each turn) are the
|
||||
// universal ones; any other {{.X}} fails to render and falls back to
|
||||
// DefaultAssistantPrompt.
|
||||
type chatVars struct{ DataDir, Now string }
|
||||
|
||||
// Chat runs ONE turn of a conversation with the agent identified by agentKey,
|
||||
// resuming prior history keyed by sessionID. maxTurns is the per-turn agent step
|
||||
@@ -94,7 +95,7 @@ func (c *ChatAgent) Chat(ctx context.Context, agentKey, sessionID, message strin
|
||||
tools, def, cleanup := AugmentTools(ctx, agentKey, base)
|
||||
defer cleanup()
|
||||
|
||||
system, boundary := deferredSystem(chatSystem(agentKey, sessionWorkDir), def)
|
||||
system, boundary := deferredSystem(chatSystem(agentKey, c.workDir, sessionWorkDir), def)
|
||||
opts := agentcore.Options{
|
||||
Provider: c.prov,
|
||||
SystemPrompt: system,
|
||||
|
||||
Reference in new issue
Block a user