refactor(instruction): remove project instruction handling and related tests
This commit is contained in:
@@ -48,7 +48,6 @@ func (c *RuntimeTraceCollector) SetInstructionSummary(summary InstructionTraceSu
|
||||
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
|
||||
|
||||
@@ -71,7 +71,6 @@ type RetrieverPolicyTraceItem struct {
|
||||
|
||||
type InstructionTraceSummary struct {
|
||||
SectionTitles []string
|
||||
HasProjectRule bool
|
||||
HasGovernanceRule bool
|
||||
HasAgentRule bool
|
||||
HasSkillRule bool
|
||||
@@ -93,7 +92,6 @@ type RuntimeTraceData struct {
|
||||
} `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"`
|
||||
|
||||
@@ -56,7 +56,7 @@ func NewAgentFactory() *AgentFactory {
|
||||
return &AgentFactory{
|
||||
chatModelFactory: NewChatModelFactory(),
|
||||
toolFactory: NewToolFactory(),
|
||||
instructionService: runtimeinstruction.NewService(nil, nil, nil, nil, nil),
|
||||
instructionService: runtimeinstruction.NewService(nil, nil, nil, nil),
|
||||
handlerService: NewAgentHandlerService(nil),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@ func TestAgentHandlerServiceBuildWithCollectorOnly(t *testing.T) {
|
||||
handlers, err := service.Build(context.Background(), BuildAgentHandlersInput{
|
||||
Collector: collector,
|
||||
InstructionSummary: einocallbacks.InstructionTraceSummary{
|
||||
SectionTitles: []string{"项目级规则", "系统治理规则"},
|
||||
HasProjectRule: true,
|
||||
SectionTitles: []string{"系统治理规则"},
|
||||
HasGovernanceRule: true,
|
||||
},
|
||||
})
|
||||
@@ -25,10 +24,10 @@ func TestAgentHandlerServiceBuildWithCollectorOnly(t *testing.T) {
|
||||
if len(handlers) != 1 {
|
||||
t.Fatalf("expected 1 handler, got %d", len(handlers))
|
||||
}
|
||||
if !collector.Data.Instruction.HasProjectRule || !collector.Data.Instruction.HasGovernanceRule {
|
||||
if !collector.Data.Instruction.HasGovernanceRule {
|
||||
t.Fatalf("instruction summary was not written to collector: %#v", collector.Data.Instruction)
|
||||
}
|
||||
if len(collector.Data.Instruction.SectionTitles) != 2 {
|
||||
if len(collector.Data.Instruction.SectionTitles) != 1 {
|
||||
t.Fatalf("unexpected section titles: %#v", collector.Data.Instruction.SectionTitles)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
func buildInstructionTraceSummary(summary runtimeinstruction.AssemblySummary) einocallbacks.InstructionTraceSummary {
|
||||
return einocallbacks.InstructionTraceSummary{
|
||||
SectionTitles: append([]string(nil), summary.SectionTitles...),
|
||||
HasProjectRule: summary.HasProjectRule,
|
||||
HasGovernanceRule: summary.HasGovernanceRule,
|
||||
HasAgentRule: summary.HasAgentRule,
|
||||
HasSkillRule: summary.HasSkillRule,
|
||||
|
||||
@@ -8,8 +8,7 @@ import (
|
||||
|
||||
func TestBuildInstructionTraceSummary(t *testing.T) {
|
||||
got := buildInstructionTraceSummary(runtimeinstruction.AssemblySummary{
|
||||
SectionTitles: []string{"项目级规则", "当前技能上下文"},
|
||||
HasProjectRule: true,
|
||||
SectionTitles: []string{"系统治理规则", "当前技能上下文"},
|
||||
HasGovernanceRule: true,
|
||||
HasAgentRule: true,
|
||||
HasSkillRule: true,
|
||||
@@ -19,7 +18,7 @@ func TestBuildInstructionTraceSummary(t *testing.T) {
|
||||
if len(got.SectionTitles) != 2 {
|
||||
t.Fatalf("unexpected section titles: %#v", got.SectionTitles)
|
||||
}
|
||||
if !got.HasProjectRule || !got.HasGovernanceRule || !got.HasAgentRule || !got.HasSkillRule {
|
||||
if !got.HasGovernanceRule || !got.HasAgentRule || !got.HasSkillRule {
|
||||
t.Fatalf("unexpected summary flags: %#v", got)
|
||||
}
|
||||
if got.HasToolRule {
|
||||
|
||||
Reference in New Issue
Block a user