feat(cloud-agent): 上下文计量 - 每步发出 context_pressure 读数并用上游实测定锚 (#601)
This commit is contained in:
@@ -456,6 +456,10 @@ func (s *Service) CreateCloudAgentRun(userID string, req CloudAgentRequest, pare
|
||||
state := cloudAgentState{Version: 1, Request: req, ParentID: parentID, Fingerprint: fingerprint, CreativeAnchor: creativeAnchor, Plan: inheritedPlan, Skills: skillSnapshots, Profile: profile, Policy: policy}
|
||||
canonical := cloudAgentCanonicalFor(system, history, req.Prompt, req, len(profile.Layers) > 0)
|
||||
s.attachCloudAgentLessons(&canonical, userID, req.Prompt)
|
||||
// 必须登记进 state.Policy(值拷贝):state 才是随任务持久化、被运行期读取的那份,
|
||||
// 在这里改局部 policy 不会生效。登记之后压力读数的"系统提示分段"才能把 memory 摊开,
|
||||
// 并与 system 桶合计对齐。
|
||||
cloudAgentRecordMemorySegment(&state.Policy, canonical.SystemPrompt)
|
||||
canonical.PromptCacheKey = cloudAgentPromptCacheKey(req.CanvasID, canonical.SystemPrompt)
|
||||
attachCloudAgentPlan(&canonical, inheritedPlan)
|
||||
input := map[string]any{"mode": "text", "prompt": req.Prompt, "textHistory": history, "textOptions": map[string]any{"stream": true, "thinking": cloudAgentReasoningEnabled(policy.ReasoningMode)}, "cloudAgent": state,
|
||||
|
||||
Reference in New Issue
Block a user