mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 06:23:52 +08:00
fix: ensure extracted thought is not empty before displaying in report
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0-beta-2506242108
|
v5.0.0-beta-2506242222
|
||||||
|
|||||||
13
report.go
13
report.go
@@ -541,7 +541,7 @@ func (g *HTMLReportGenerator) GenerateReport(outputFile string) error {
|
|||||||
// Try to parse as JSON to extract thought field
|
// Try to parse as JSON to extract thought field
|
||||||
var data map[string]interface{}
|
var data map[string]interface{}
|
||||||
if err := json.Unmarshal([]byte(content), &data); err == nil {
|
if err := json.Unmarshal([]byte(content), &data); err == nil {
|
||||||
if thought, ok := data["thought"].(string); ok {
|
if thought, ok := data["thought"].(string); ok && thought != "" {
|
||||||
return thought
|
return thought
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2325,8 +2325,15 @@ const htmlTemplate = `<!DOCTYPE html>
|
|||||||
{{if $planning.Error}}<span class="error">Error: {{$planning.Error}}</span>{{end}}
|
{{if $planning.Error}}<span class="error">Error: {{$planning.Error}}</span>{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $planning.Thought}}
|
{{$extractedThought := extractThought $planning.Content}}
|
||||||
<div class="thought">{{$planning.Thought}}</div>
|
{{if or $planning.Thought $extractedThought}}
|
||||||
|
<div class="thought">
|
||||||
|
{{if $planning.Thought}}
|
||||||
|
{{$planning.Thought}}
|
||||||
|
{{else}}
|
||||||
|
{{$extractedThought}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<!-- Three-column layout: screenshot left, model output and actions right -->
|
<!-- Three-column layout: screenshot left, model output and actions right -->
|
||||||
|
|||||||
Reference in New Issue
Block a user