mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-31 05:19:38 +08:00
Merge branch 'fix-sleep-tool' into 'master'
Fix sleep tool See merge request iesqa/httprunner!120
This commit is contained in:
@@ -167,7 +167,7 @@ func (dExt *XTDriver) StartToGoal(ctx context.Context, prompt string, opts ...op
|
||||
log.Error().Err(err).
|
||||
Str("action", toolCall.Function.Name).
|
||||
Msg("invoke tool call failed")
|
||||
subActionResult.Error = err
|
||||
subActionResult.Error = err.Error()
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -400,7 +400,7 @@ type SubActionResult struct {
|
||||
Arguments interface{} `json:"arguments,omitempty"` // arguments passed to the sub-action
|
||||
StartTime int64 `json:"start_time"` // sub-action start time
|
||||
Elapsed int64 `json:"elapsed_ms"` // sub-action elapsed time(ms)
|
||||
Error error `json:"error,omitempty"` // sub-action execution result
|
||||
Error string `json:"error,omitempty"` // sub-action execution result
|
||||
SessionData
|
||||
}
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ func (t *ToolSleep) Implement() server.ToolHandlerFunc {
|
||||
case <-time.After(duration):
|
||||
// Normal completion
|
||||
case <-ctx.Done():
|
||||
// Interrupted by context cancellation (e.g., CTRL+C)
|
||||
log.Warn().Msg("sleep interrupted by cancellation")
|
||||
return nil, fmt.Errorf("sleep interrupted: %w", ctx.Err())
|
||||
// Interrupted by context cancellation (interrupt signal, timeout, time limit)
|
||||
log.Info().Msg("sleep interrupted by context cancellation")
|
||||
// Don't return error - let the upper layer handle timeout/time limit logic
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("Successfully slept for %v seconds", actualSeconds)
|
||||
@@ -157,9 +157,9 @@ func (t *ToolSleepMS) Implement() server.ToolHandlerFunc {
|
||||
case <-time.After(duration):
|
||||
// Normal completion
|
||||
case <-ctx.Done():
|
||||
// Interrupted by context cancellation (e.g., CTRL+C)
|
||||
log.Warn().Msg("sleep interrupted by cancellation")
|
||||
return nil, fmt.Errorf("sleep interrupted: %w", ctx.Err())
|
||||
// Interrupted by context cancellation (interrupt signal, timeout, time limit)
|
||||
log.Info().Msg("sleep interrupted by context cancellation")
|
||||
// Don't return error - let the upper layer handle timeout/time limit logic
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("Successfully slept for %d milliseconds", actualMilliseconds)
|
||||
|
||||
Reference in New Issue
Block a user