MCPcopy Create free account
hub / github.com/astercloud/aster / AddStep

Method AddStep

pkg/reasoning/reasoning.go:88–102  ·  view source on GitHub ↗

AddStep 添加推理步骤

(step Step)

Source from the content-addressed store, hash-verified

86
87// AddStep 添加推理步骤
88func (c *Chain) AddStep(step Step) error {
89 if len(c.Steps) >= c.MaxSteps {
90 return fmt.Errorf("reached max steps: %d", c.MaxSteps)
91 }
92
93 step.ID = fmt.Sprintf("step-%d", len(c.Steps)+1)
94 step.CreatedAt = time.Now()
95 step.UpdatedAt = time.Now()
96
97 c.Steps = append(c.Steps, step)
98 c.Current = len(c.Steps) - 1
99 c.UpdatedAt = time.Now()
100
101 return nil
102}
103
104// UpdateStep 更新推理步骤
105func (c *Chain) UpdateStep(stepID string, updates map[string]any) error {

Callers 15

ReasonMethod · 0.95
TestChainAddStepFunction · 0.95
TestChainMaxStepsFunction · 0.95
TestChainShouldContinueFunction · 0.95
TestChainSummaryFunction · 0.95
TestChainToJSONFunction · 0.95
TestUpdateStepFunction · 0.95
TestStepLifecycleFunction · 0.95
mainFunction · 0.45
demoComplexWorkflowFunction · 0.45
demoWorkflowAgentFunction · 0.45
testBasicWorkflowFunction · 0.45

Calls

no outgoing calls

Tested by 7

TestChainAddStepFunction · 0.76
TestChainMaxStepsFunction · 0.76
TestChainShouldContinueFunction · 0.76
TestChainSummaryFunction · 0.76
TestChainToJSONFunction · 0.76
TestUpdateStepFunction · 0.76
TestStepLifecycleFunction · 0.76