feat: add instruction summary handling in RuntimeTraceCollector and enhance instruction assembly process

This commit is contained in:
mlogclub
2026-04-11 23:02:09 +08:00
parent be17807152
commit f1f213420d
4 changed files with 81 additions and 4 deletions
@@ -41,6 +41,20 @@ func (c *RuntimeTraceCollector) SetTooling(staticToolCodes []string, dynamicTool
c.Data.Input.ToolSearchEnabled = toolSearchEnabled
}
func (c *RuntimeTraceCollector) SetInstructionSummary(summary InstructionTraceSummary) {
if c == nil {
return
}
c.mu.Lock()
defer c.mu.Unlock()
c.Data.Instruction.SectionTitles = append([]string(nil), summary.SectionTitles...)
c.Data.Instruction.HasProjectRule = summary.HasProjectRule
c.Data.Instruction.HasGovernanceRule = summary.HasGovernanceRule
c.Data.Instruction.HasAgentRule = summary.HasAgentRule
c.Data.Instruction.HasSkillRule = summary.HasSkillRule
c.Data.Instruction.HasToolRule = summary.HasToolRule
}
func (c *RuntimeTraceCollector) AddToolItem(item ToolTraceItem) {
if c == nil {
return
@@ -41,6 +41,15 @@ type RetrieverTraceItem struct {
LatencyMs int64 `json:"latencyMs,omitempty"`
}
type InstructionTraceSummary struct {
SectionTitles []string
HasProjectRule bool
HasGovernanceRule bool
HasAgentRule bool
HasSkillRule bool
HasToolRule bool
}
type RuntimeTraceData struct {
Version string `json:"version"`
Status string `json:"status"`
@@ -54,6 +63,14 @@ type RuntimeTraceData struct {
Provider string `json:"provider,omitempty"`
Name string `json:"name,omitempty"`
} `json:"model"`
Instruction struct {
SectionTitles []string `json:"sectionTitles,omitempty"`
HasProjectRule bool `json:"hasProjectRule,omitempty"`
HasGovernanceRule bool `json:"hasGovernanceRule,omitempty"`
HasAgentRule bool `json:"hasAgentRule,omitempty"`
HasSkillRule bool `json:"hasSkillRule,omitempty"`
HasToolRule bool `json:"hasToolRule,omitempty"`
} `json:"instruction"`
Input struct {
HistoryMessageCount int `json:"historyMessageCount,omitempty"`
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds,omitempty"`