mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-06 20:32:44 +08:00
fix: ai_assert screenshot
This commit is contained in:
@@ -1 +1 @@
|
||||
v5.0.0-250710
|
||||
v5.0.0-250711
|
||||
|
||||
207
report.go
207
report.go
@@ -1194,6 +1194,15 @@ const htmlTemplate = `<!DOCTYPE html>
|
||||
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 = `<!DOCTYPE html>
|
||||
.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 = `<!DOCTYPE html>
|
||||
|
||||
/* 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 = `<!DOCTYPE html>
|
||||
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 = `<!DOCTYPE html>
|
||||
<div class="screenshot-display">
|
||||
{{$base64Image := encodeImageBase64 $action.AIResult.ImagePath}}
|
||||
{{if $base64Image}}
|
||||
<div class="screenshot-item-compact">
|
||||
<div class="screenshot-image">
|
||||
<img src="data:image/jpeg;base64,{{$base64Image}}" alt="AI {{title $action.AIResult.Type}} Screenshot" onclick="openImageModal(this.src)" />
|
||||
</div>
|
||||
<div class="screenshot-image">
|
||||
<img src="data:image/jpeg;base64,{{$base64Image}}" alt="AI {{title $action.AIResult.Type}} Screenshot" onclick="openImageModal(this.src)" />
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -3048,53 +2960,60 @@ const htmlTemplate = `<!DOCTYPE html>
|
||||
|
||||
<!-- AI Assertion Results -->
|
||||
{{if $validator.ai_result}}
|
||||
<div class="ai-assertion-section">
|
||||
<h5>🤖 AI Assertion Details</h5>
|
||||
|
||||
<!-- AI Assertion Screenshot -->
|
||||
{{if $validator.ai_result.image_path}}
|
||||
<div class="ai-screenshot-container">
|
||||
<span class="step-name">📸 AI Assertion Screenshot</span>
|
||||
{{if $validator.ai_result.screenshot_elapsed}}
|
||||
<span class="duration">{{formatDuration $validator.ai_result.screenshot_elapsed}}</span>
|
||||
{{end}}
|
||||
<div class="ai-screenshot">
|
||||
{{$base64Image := encodeImageBase64 $validator.ai_result.image_path}}
|
||||
{{if $base64Image}}
|
||||
<img src="data:image/jpeg;base64,{{$base64Image}}" alt="AI Assertion Screenshot" onclick="openImageModal(this.src)" />
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="validator-ai-content">
|
||||
<!-- Display AI Thought -->
|
||||
{{if $validator.ai_result.assertion_result.thought}}
|
||||
<div class="thought">{{$validator.ai_result.assertion_result.thought}}</div>
|
||||
{{end}}
|
||||
|
||||
<!-- AI Model Analysis -->
|
||||
<div class="ai-analysis-container">
|
||||
<span class="step-name">🧠 AI Model Analysis</span>
|
||||
{{if $validator.ai_result.model_call_elapsed}}
|
||||
<span class="duration">{{formatDuration $validator.ai_result.model_call_elapsed}}</span>
|
||||
<!-- AI Assertion Layout: Screenshot left, Analysis right -->
|
||||
<div class="validator-ai-layout">
|
||||
<!-- Left column: Screenshot -->
|
||||
{{if $validator.ai_result.image_path}}
|
||||
<div class="validator-column-screenshot">
|
||||
<div class="validator-step-compact">
|
||||
<div class="step-header-compact">
|
||||
<span class="step-name">📸 AI Assertion Screenshot</span>
|
||||
{{if $validator.ai_result.screenshot_elapsed}}
|
||||
<span class="duration">{{formatDuration $validator.ai_result.screenshot_elapsed}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="screenshot-display">
|
||||
{{$base64Image := encodeImageBase64 $validator.ai_result.image_path}}
|
||||
{{if $base64Image}}
|
||||
<div class="screenshot-image">
|
||||
<img src="data:image/jpeg;base64,{{$base64Image}}" alt="AI Assertion Screenshot" onclick="openImageModal(this.src)" />
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="ai-analysis-content">
|
||||
{{if $validator.ai_result.assertion_result.model_name}}
|
||||
<div class="model-info">🤖 Model: {{$validator.ai_result.assertion_result.model_name}}</div>
|
||||
{{end}}
|
||||
{{if $validator.ai_result.assertion_result.usage}}
|
||||
<div class="usage-info">📊 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</div>
|
||||
{{end}}
|
||||
{{if $validator.ai_result.resolution}}
|
||||
<div class="model-info">📐 Resolution: {{$validator.ai_result.resolution.Width}}x{{$validator.ai_result.resolution.Height}}</div>
|
||||
{{end}}
|
||||
{{if $validator.ai_result.assertion_result.thought}}
|
||||
<div class="ai-thought">
|
||||
<strong>💭 AI Reasoning:</strong>
|
||||
<div class="thought-content">{{$validator.ai_result.assertion_result.thought}}</div>
|
||||
|
||||
<!-- Right column: AI Analysis -->
|
||||
<div class="validator-column-analysis">
|
||||
<div class="validator-step-compact">
|
||||
<div class="step-header-compact">
|
||||
<span class="step-name">🤖 AI Assertion Analysis</span>
|
||||
{{if $validator.ai_result.model_call_elapsed}}
|
||||
<span class="duration">{{formatDuration $validator.ai_result.model_call_elapsed}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="validator-ai-details">
|
||||
{{if $validator.ai_result.assertion_result.model_name}}
|
||||
<div class="model-info">🤖 Model: {{$validator.ai_result.assertion_result.model_name}}</div>
|
||||
{{end}}
|
||||
{{if $validator.ai_result.assertion_result.usage}}
|
||||
<div class="usage-info">📊 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</div>
|
||||
{{end}}
|
||||
{{if $validator.ai_result.resolution}}
|
||||
<div class="model-info">📐 Resolution: {{$validator.ai_result.resolution.Width}}x{{$validator.ai_result.resolution.Height}}</div>
|
||||
{{end}}
|
||||
{{if $validator.ai_result.assertion_result.content}}
|
||||
<div class="model-info">💬 Assertion Result: {{$validator.ai_result.assertion_result.content}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if $validator.ai_result.assertion_result.content}}
|
||||
<div class="ai-raw-response">
|
||||
<strong>📝 Raw Model Response:</strong>
|
||||
<div class="response-content">{{$validator.ai_result.assertion_result.content}}</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user