UpdateStep 更新推理步骤
(stepID string, updates map[string]any)
| 103 | |
| 104 | // UpdateStep 更新推理步骤 |
| 105 | func (c *Chain) UpdateStep(stepID string, updates map[string]any) error { |
| 106 | for i, step := range c.Steps { |
| 107 | if step.ID == stepID { |
| 108 | if result, ok := updates["result"].(string); ok { |
| 109 | c.Steps[i].Result = result |
| 110 | } |
| 111 | if status, ok := updates["status"].(StepStatus); ok { |
| 112 | c.Steps[i].Status = status |
| 113 | } |
| 114 | if confidence, ok := updates["confidence"].(float64); ok { |
| 115 | c.Steps[i].Confidence = confidence |
| 116 | } |
| 117 | if nextAction, ok := updates["next_action"].(NextAction); ok { |
| 118 | c.Steps[i].NextAction = nextAction |
| 119 | } |
| 120 | c.Steps[i].UpdatedAt = time.Now() |
| 121 | c.UpdatedAt = time.Now() |
| 122 | return nil |
| 123 | } |
| 124 | } |
| 125 | return fmt.Errorf("step not found: %s", stepID) |
| 126 | } |
| 127 | |
| 128 | // GetCurrentStep 获取当前步骤 |
| 129 | func (c *Chain) GetCurrentStep() *Step { |
no outgoing calls