diff --git a/internal/version/VERSION b/internal/version/VERSION index 552c255e..76fd650b 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0-250710 +v5.0.0-250711 diff --git a/report.go b/report.go index 18b44d5f..bb72904b 100644 --- a/report.go +++ b/report.go @@ -1194,6 +1194,15 @@ const htmlTemplate = ` padding: 12px; } + .screenshot-display .screenshot-image { + min-height: 300px; + padding: 15px 0; + } + + .screenshot-display .screenshot-image img { + max-height: 350px; + } + .screenshot-item-compact { text-align: center; } @@ -1212,7 +1221,7 @@ const htmlTemplate = ` .screenshot-item-compact .screenshot-image img { width: 100%; height: auto; - max-height: 500px; + max-height: 350px; border-radius: 4px; cursor: pointer; transition: transform 0.2s; @@ -1223,7 +1232,7 @@ const htmlTemplate = ` /* Handle very tall screenshots */ .screenshot-item-compact .screenshot-image img[style*="height"] { - max-height: 400px; + max-height: 350px; width: auto; max-width: 100%; } @@ -1838,101 +1847,6 @@ const htmlTemplate = ` word-wrap: break-word; } - /* AI Assertion Styles */ - .ai-assertion-section { - margin-top: 15px; - padding: 15px; - background: linear-gradient(135deg, #f0f8ff 0%, #f5f5ff 100%); - border: 2px solid #4169e1; - border-radius: 12px; - box-shadow: 0 4px 8px rgba(65, 105, 225, 0.15); - } - - .ai-assertion-section h5 { - margin: 0 0 15px 0; - color: #4169e1; - font-size: 1.1em; - font-weight: 600; - } - - .ai-screenshot-container { - background: white; - border: 1px solid #dee2e6; - border-radius: 8px; - padding: 12px; - margin-bottom: 15px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); - } - - .ai-screenshot { - text-align: center; - margin-top: 10px; - } - - .ai-screenshot img { - max-width: 100%; - height: auto; - border-radius: 8px; - border: 1px solid #dee2e6; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - cursor: pointer; - transition: transform 0.2s; - } - - .ai-screenshot img:hover { - transform: scale(1.02); - } - - .ai-analysis-container { - background: white; - border: 1px solid #dee2e6; - border-radius: 8px; - padding: 12px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); - } - - .ai-analysis-content { - margin-top: 10px; - } - - .ai-thought { - background: linear-gradient(135deg, #e8f4fd 0%, #f0f8ff 100%); - border: 1px solid #4169e1; - border-radius: 8px; - padding: 12px; - margin: 10px 0; - color: #2c3e50; - } - - .ai-thought .thought-content { - margin-top: 8px; - font-style: italic; - color: #34495e; - white-space: pre-wrap; - word-wrap: break-word; - } - - .ai-raw-response { - background: #f8f9fa; - border: 1px solid #dee2e6; - border-radius: 8px; - padding: 12px; - margin: 10px 0; - color: #2c3e50; - } - - .ai-raw-response .response-content { - margin-top: 8px; - font-family: monospace; - font-size: 0.9em; - background: white; - padding: 8px; - border-radius: 4px; - border: 1px solid #e9ecef; - white-space: pre-wrap; - word-wrap: break-word; - } - @media screen and (max-width: 768px) { .validator-ai-layout { flex-direction: column; @@ -2891,10 +2805,8 @@ const htmlTemplate = `
{{$base64Image := encodeImageBase64 $action.AIResult.ImagePath}} {{if $base64Image}} -
-
- AI {{title $action.AIResult.Type}} Screenshot -
+
+ AI {{title $action.AIResult.Type}} Screenshot
{{end}}
@@ -3048,53 +2960,60 @@ const htmlTemplate = ` {{if $validator.ai_result}} -
-
🤖 AI Assertion Details
- - - {{if $validator.ai_result.image_path}} -
- 📸 AI Assertion Screenshot - {{if $validator.ai_result.screenshot_elapsed}} - {{formatDuration $validator.ai_result.screenshot_elapsed}} - {{end}} -
- {{$base64Image := encodeImageBase64 $validator.ai_result.image_path}} - {{if $base64Image}} - AI Assertion Screenshot - {{end}} -
-
+
+ + {{if $validator.ai_result.assertion_result.thought}} +
{{$validator.ai_result.assertion_result.thought}}
{{end}} - -
- 🧠 AI Model Analysis - {{if $validator.ai_result.model_call_elapsed}} - {{formatDuration $validator.ai_result.model_call_elapsed}} + +
+ + {{if $validator.ai_result.image_path}} +
+
+
+ 📸 AI Assertion Screenshot + {{if $validator.ai_result.screenshot_elapsed}} + {{formatDuration $validator.ai_result.screenshot_elapsed}} + {{end}} +
+
+ {{$base64Image := encodeImageBase64 $validator.ai_result.image_path}} + {{if $base64Image}} +
+ AI Assertion Screenshot +
+ {{end}} +
+
+
{{end}} -
- {{if $validator.ai_result.assertion_result.model_name}} -
🤖 Model: {{$validator.ai_result.assertion_result.model_name}}
- {{end}} - {{if $validator.ai_result.assertion_result.usage}} -
📊 Tokens: {{$validator.ai_result.assertion_result.usage.PromptTokens}} in / {{$validator.ai_result.assertion_result.usage.CompletionTokens}} out / {{$validator.ai_result.assertion_result.usage.TotalTokens}} total
- {{end}} - {{if $validator.ai_result.resolution}} -
📐 Resolution: {{$validator.ai_result.resolution.Width}}x{{$validator.ai_result.resolution.Height}}
- {{end}} - {{if $validator.ai_result.assertion_result.thought}} -
- 💭 AI Reasoning: -
{{$validator.ai_result.assertion_result.thought}}
+ + +
+
+
+ 🤖 AI Assertion Analysis + {{if $validator.ai_result.model_call_elapsed}} + {{formatDuration $validator.ai_result.model_call_elapsed}} + {{end}} +
+
+ {{if $validator.ai_result.assertion_result.model_name}} +
🤖 Model: {{$validator.ai_result.assertion_result.model_name}}
+ {{end}} + {{if $validator.ai_result.assertion_result.usage}} +
📊 Tokens: {{$validator.ai_result.assertion_result.usage.PromptTokens}} in / {{$validator.ai_result.assertion_result.usage.CompletionTokens}} out / {{$validator.ai_result.assertion_result.usage.TotalTokens}} total
+ {{end}} + {{if $validator.ai_result.resolution}} +
📐 Resolution: {{$validator.ai_result.resolution.Width}}x{{$validator.ai_result.resolution.Height}}
+ {{end}} + {{if $validator.ai_result.assertion_result.content}} +
💬 Assertion Result: {{$validator.ai_result.assertion_result.content}}
+ {{end}} +
- {{end}} - {{if $validator.ai_result.assertion_result.content}} -
- 📝 Raw Model Response: -
{{$validator.ai_result.assertion_result.content}}
-
- {{end}}
diff --git a/uixt/sdk.go b/uixt/sdk.go index 8ea1c609..32f153b0 100644 --- a/uixt/sdk.go +++ b/uixt/sdk.go @@ -156,9 +156,13 @@ func (dExt *XTDriver) ExecuteAction(ctx context.Context, action option.MobileAct // For regular actions, collect session data and return it directly sessionData := dExt.GetSession().GetData(true) // reset after getting data - log.Debug().Str("tool", string(tool.Name())). - Interface("result", result.Content). - Msg("executed action via MCP tool") + // Log execution result, but avoid printing base64 data for screenshot tools + logger := log.Debug().Str("tool", string(tool.Name())) + if tool.Name() != option.ACTION_ScreenShot { + logger.Interface("result", result.Content) + } + logger.Msg("executed action via MCP tool") + return sessionData, nil } @@ -241,22 +245,27 @@ func (dExt *XTDriver) CallMCPTool(ctx context.Context, log.Debug().Err(err). Str("server", serverName). Str("tool", toolName). - Msg("MCP hook call failed") + Msg("call MCP tool failed") return nil, err } if result.IsError { - log.Debug(). + logger := log.Debug(). Str("server", serverName). - Str("tool", toolName). - Interface("content", result.Content). - Msg("MCP hook returned error") - return nil, fmt.Errorf("MCP hook returned error") + Str("tool", toolName) + + // Avoid printing base64 data for screenshot tools + if toolName != string(option.ACTION_ScreenShot) { + logger.Interface("content", result.Content) + } + logger.Msg("call MCP tool failed") + + return nil, fmt.Errorf("call MCP tool %s failed", toolName) } log.Debug(). Str("server", serverName). Str("tool", toolName). - Msg("MCP hook called successfully") + Msg("call MCP tool successfully") return result, nil }