mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-07 06:12:43 +08:00
fix: 修复 StartToGoal 命令无法通过 CTRL+C 中断的问题
- 为 AI 相关方法添加 context.Context 参数支持中断 - 在重试循环中添加上下文取消检查 - 创建可取消的上下文并监听中断信号 - 更新 MCP 工具调用使用带上下文的方法 现在用户可以通过 CTRL+C 正常中断长时间运行的 AI 自动化任务
This commit is contained in:
@@ -282,8 +282,8 @@ func runStepRequest(r *SessionRunner, step IStep) (stepResult *StepResult, err e
|
||||
stepRequest := step.(*StepRequestWithOptionalArgs)
|
||||
start := time.Now()
|
||||
stepResult = &StepResult{
|
||||
Name: stepRequest.StepName,
|
||||
StepType: StepTypeRequest,
|
||||
Name: step.Name(),
|
||||
StepType: step.Type(),
|
||||
Success: false,
|
||||
ContentSize: 0,
|
||||
StartTime: start.Unix(),
|
||||
@@ -925,7 +925,7 @@ func (s *StepRequestWithOptionalArgs) Name() string {
|
||||
}
|
||||
|
||||
func (s *StepRequestWithOptionalArgs) Type() StepType {
|
||||
return StepType(fmt.Sprintf("request-%v", s.Request.Method))
|
||||
return StepType(fmt.Sprintf("%s-%v", StepTypeRequest, s.Request.Method))
|
||||
}
|
||||
|
||||
func (s *StepRequestWithOptionalArgs) Config() *StepConfig {
|
||||
@@ -959,7 +959,7 @@ func (s *StepRequestExtraction) Name() string {
|
||||
}
|
||||
|
||||
func (s *StepRequestExtraction) Type() StepType {
|
||||
stepType := StepType(fmt.Sprintf("request-%v", s.Request.Method))
|
||||
stepType := StepType(fmt.Sprintf("%s-%v", StepTypeRequest, s.Request.Method))
|
||||
return stepType + stepTypeSuffixExtraction
|
||||
}
|
||||
|
||||
@@ -987,7 +987,7 @@ func (s *StepRequestValidation) Name() string {
|
||||
}
|
||||
|
||||
func (s *StepRequestValidation) Type() StepType {
|
||||
stepType := StepType(fmt.Sprintf("request-%v", s.Request.Method))
|
||||
stepType := StepType(fmt.Sprintf("%s-%v", StepTypeRequest, s.Request.Method))
|
||||
return stepType + stepTypeSuffixValidation
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user