# TEST STREAMING + BACKGROUND USER_INSIGHT

Write-Host "`n==== STREAMING TEST ====`n" -ForegroundColor Cyan

$query = "Ao khoac nam mua dong"
$deviceId = "test_stream_verify"

Write-Host "Sending request..." -ForegroundColor Green

$timing = Measure-Command {
    $body = '{"user_query":"' + $query + '","device_id":"' + $deviceId + '"}'
    $result = $body | curl.exe -s -X POST "http://localhost:5000/api/agent/chat" -H "Content-Type: application/json" --data-binary "@-"
    $result | Out-Null
}

Write-Host "`nResponse Time: $($timing.TotalMilliseconds) ms" -ForegroundColor Green
Write-Host "`nCheck backend logs for:" -ForegroundColor Yellow
Write-Host "  - Starting LLM streaming" -ForegroundColor Gray
Write-Host "  - Regex matched product_ids" -ForegroundColor Gray
Write-Host "  - BREAKING STREAM NOW" -ForegroundColor Gray
Write-Host "  - Background task extraction" -ForegroundColor Gray
Write-Host "`nDone!" -ForegroundColor Green

