| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- # Probe POST /workflow/simulate and print diagnosis fields.
- # Usage:
- # .\probe-simulate-dialogue.ps1 -Token "Bearer xxx" -TemplateId 123
- # .\probe-simulate-dialogue.ps1 -BaseUrl "http://127.0.0.1:8004" -Token "Bearer xxx" -TemplateId 123
- param(
- [string]$BaseUrl = "http://127.0.0.1:8004",
- [Parameter(Mandatory = $true)][string]$Token,
- [Parameter(Mandatory = $true)][long]$TemplateId,
- [string]$Content = "你好,芹菜能治疗糖尿病吗?对糖尿病有好处么?"
- )
- $uri = "$BaseUrl/workflow/simulate"
- $body = @{
- templateId = $TemplateId
- content = $Content
- } | ConvertTo-Json -Compress
- $headers = @{
- Authorization = $Token
- "Content-Type" = "application/json"
- }
- Write-Host "POST $uri"
- Write-Host "Body: $body"
- Write-Host ""
- try {
- $resp = Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Body $body -TimeoutSec 120
- } catch {
- Write-Host "HTTP ERROR: $($_.Exception.Message)" -ForegroundColor Red
- if ($_.ErrorDetails.Message) { Write-Host $_.ErrorDetails.Message }
- exit 1
- }
- Write-Host "=== RAW RESPONSE ===" -ForegroundColor Cyan
- $resp | ConvertTo-Json -Depth 6
- $data = $resp.data
- if ($null -eq $data) {
- Write-Host "`n[WARN] response.data is empty" -ForegroundColor Yellow
- exit 2
- }
- Write-Host "`n=== DIAGNOSIS ===" -ForegroundColor Cyan
- $mode = $data.mode
- Write-Host ("mode : {0}" -f $mode)
- Write-Host ("intent : {0}" -f $data.intent)
- Write-Host ("surfaceQuestionType: {0}" -f $data.surfaceQuestionType)
- Write-Host ("shouldProbe : {0}" -f $data.shouldProbe)
- Write-Host ("probeQuestion : {0}" -f $data.probeQuestion)
- Write-Host ("uddUsed : {0}" -f $data.uddUsed)
- Write-Host ("instanceId : {0}" -f $data.instanceId)
- Write-Host ("nodeCode : {0}" -f $data.nodeCode)
- Write-Host ("reply (first 200) : {0}" -f ($(if ($data.reply) { $data.reply.Substring(0, [Math]::Min(200, $data.reply.Length)) } else { "" })))
- if ($mode -eq "legacy") {
- Write-Host "`n[ROOT CAUSE] Still legacy FastGPT path -> no intent/UDD probe." -ForegroundColor Red
- Write-Host "engineHint: $($data.engineHint)"
- exit 3
- }
- if (-not $data.intent) {
- Write-Host "`n[WARN] engine mode but intent is null -> check DynamicNodeAdjuster/semantic." -ForegroundColor Yellow
- }
- if ($data.shouldProbe -ne $true) {
- Write-Host "`n[WARN] shouldProbe=false -> UDD plan did not enable follow-up." -ForegroundColor Yellow
- } elseif ($data.reply -and $data.probeQuestion -and ($data.reply -notlike "*$($data.probeQuestion.Substring(0, [Math]::Min(8, $data.probeQuestion.Length)))*")) {
- Write-Host "`n[WARN] probe planned but reply missing probe text -> check quality regen strip." -ForegroundColor Yellow
- } else {
- Write-Host "`n[OK] Engine path with follow-up probe." -ForegroundColor Green
- }
- exit 0
|