merge master

This commit is contained in:
lilong.129
2025-07-21 14:54:50 +08:00
4 changed files with 3 additions and 40 deletions

View File

@@ -29,10 +29,6 @@ func ParseTouchEvents(data string) ([]types.TouchEvent, error) {
event := types.TouchEvent{}
var err error
// Parse each field
if event.Timestamp, err = strconv.ParseInt(parts[0], 10, 64); err != nil {
return nil, fmt.Errorf("invalid timestamp: %v", err)
}
if event.X, err = strconv.ParseFloat(parts[1], 64); err != nil {
return nil, fmt.Errorf("invalid x coordinate: %v", err)
}
@@ -155,9 +151,6 @@ func TestTouchEventParsing(t *testing.T) {
}
event := events[0]
if event.Timestamp != 1752646457403 {
t.Errorf("Expected timestamp 1752646457403, got %d", event.Timestamp)
}
if event.X != 456.78418 {
t.Errorf("Expected X 456.78418, got %f", event.X)
}
@@ -229,12 +222,5 @@ func TestTouchEventSequenceValidation(t *testing.T) {
}
}
// Validate timestamps are in increasing order
for i := 1; i < len(events); i++ {
if events[i].Timestamp <= events[i-1].Timestamp {
t.Errorf("Event %d: timestamp should be greater than previous event", i)
}
}
t.Logf("Touch sequence validation passed: %d events with correct action sequence", len(events))
}

View File

@@ -346,22 +346,6 @@ func (w *WingsService) extractScreenshotFromMessage(message *schema.Message) (st
// getDeviceInfoFromContext gets device info from context with fallback
func (w *WingsService) getDeviceInfoFromContext(ctx context.Context, screenshot string) WingsDeviceInfo {
// Try to get device info from context
if deviceID, ok := ctx.Value("device_id").(string); ok {
platformType := "android"
if platform, ok := ctx.Value("platform_type").(string); ok {
platformType = platform
}
return WingsDeviceInfo{
DeviceID: deviceID,
NowImage: screenshot,
PreImage: screenshot,
NowLayoutJSON: "",
OperationSystem: platformType,
}
}
// Fallback to default device info
return WingsDeviceInfo{
DeviceID: "default-device",

View File

@@ -24,7 +24,7 @@ func setupADBDriverExt(t *testing.T) *XTDriver {
require.Nil(t, err)
driverExt, err := NewXTDriver(driver,
option.WithCVService(option.CVServiceTypeVEDEM),
// option.WithLLMService(option.DOUBAO_1_5_THINKING_VISION_PRO_250428),
// option.WithLLMService(option.DOUBAO_1_5_UI_TARS_250328),
)
require.Nil(t, err)
return driverExt

View File

@@ -295,32 +295,25 @@ func TestDriverExt_AIAction_CompareWithAIAction(t *testing.T) {
prompt := "点击搜索按钮"
// Test both methods with the same prompt
wingsResult, wingsErr := driver.AIAction(context.Background(), prompt)
aiResult, aiErr := driver.AIAction(context.Background(), prompt)
// Both should execute without critical errors (may have different implementations)
t.Logf("AIAction error: %v", wingsErr)
t.Logf("AIAction error: %v", aiErr)
// If both succeed, compare results
if wingsResult != nil && aiResult != nil {
assert.Equal(t, "action", wingsResult.Type, "AIAction result type should be 'action'")
if aiResult != nil {
assert.Equal(t, "action", aiResult.Type, "AIAction result type should be 'action'")
// Both should have timing information
assert.Greater(t, wingsResult.ModelCallElapsed, int64(0), "AIAction should have model call elapsed time")
assert.Greater(t, aiResult.ModelCallElapsed, int64(0), "AIAction should have model call elapsed time")
// Both should have screenshot information
assert.NotEmpty(t, wingsResult.ImagePath, "AIAction should have image path")
assert.NotEmpty(t, aiResult.ImagePath, "AIAction should have image path")
// Compare model names
if wingsResult.PlanningResult != nil && aiResult.PlanningResult != nil {
t.Logf("AIAction model: %s", wingsResult.PlanningResult.ModelName)
if aiResult.PlanningResult != nil {
t.Logf("AIAction model: %s", aiResult.PlanningResult.ModelName)
assert.Equal(t, "wings-api", wingsResult.PlanningResult.ModelName, "AIAction should use wings-api")
assert.NotEqual(t, "wings-api", aiResult.PlanningResult.ModelName, "AIAction should not use wings-api")
}
}