mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
fix: add direction parameter support for scroll operations in UI-TARS parser
- Handle direction parameter in convertProcessedArgs for scroll actions - Ensure scroll operations map to swipe with both coordinates and direction - Add comprehensive test coverage for scroll action parsing - Fix issue where scroll direction was missing from tool call arguments
This commit is contained in:
@@ -290,6 +290,26 @@ func convertProcessedArgs(processedArgs map[string]interface{}, actionType strin
|
||||
return options.ToMap(), nil
|
||||
}
|
||||
|
||||
// For scroll operations, handle both coordinates and direction
|
||||
if actionType == "scroll" && hasStartBox {
|
||||
startCoords, ok := startBox.([]float64)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid coordinate format for scroll operation")
|
||||
}
|
||||
|
||||
options := option.ActionOptions{
|
||||
X: builtin.RoundToOneDecimal(startCoords[0]),
|
||||
Y: builtin.RoundToOneDecimal(startCoords[1]),
|
||||
}
|
||||
|
||||
// Add direction parameter if present
|
||||
if direction, hasDirection := processedArgs["direction"]; hasDirection {
|
||||
options.Direction = direction.(string)
|
||||
}
|
||||
|
||||
return options.ToMap(), nil
|
||||
}
|
||||
|
||||
// For single coordinate operations, return the coordinate array directly
|
||||
if hasStartBox {
|
||||
startCoords, ok := startBox.([]float64)
|
||||
|
||||
Reference in New Issue
Block a user