fix: update invokeToolCall to accept options and refactor action type handling in MarkUIOperation

This commit is contained in:
lilong.129
2025-06-29 15:59:48 +08:00
parent 9794852c1a
commit 5baabee89c
3 changed files with 11 additions and 6 deletions
+3 -2
View File
@@ -470,14 +470,15 @@ func MarkUIOperation(driver IDriver, actionType option.ActionName, actionCoordin
fmt.Sprintf("action_%s_pre_%s.png", timestamp, actionType),
)
if actionType == option.ACTION_TapAbsXY || actionType == option.ACTION_DoubleTapXY {
switch actionType {
case option.ACTION_TapAbsXY, option.ACTION_DoubleTapXY:
if len(actionCoordinates) != 2 {
return fmt.Errorf("invalid tap action coordinates: %v", actionCoordinates)
}
x, y := actionCoordinates[0], actionCoordinates[1]
point := image.Point{X: int(x), Y: int(y)}
err = SaveImageWithCircleMarker(compressedBufSource, point, imagePath)
} else if actionType == option.ACTION_SwipeDirection || actionType == option.ACTION_SwipeCoordinate || actionType == option.ACTION_Drag {
case option.ACTION_SwipeDirection, option.ACTION_SwipeCoordinate, option.ACTION_Drag:
if len(actionCoordinates) != 4 {
return fmt.Errorf("invalid swipe action coordinates: %v", actionCoordinates)
}