AddStep 添加推理步骤
(step Step)
| 86 | |
| 87 | // AddStep 添加推理步骤 |
| 88 | func (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 更新推理步骤 |
| 105 | func (c *Chain) UpdateStep(stepID string, updates map[string]any) error { |
no outgoing calls