Files
ai-customer-service/guest-cs-stack/_debug_guest_chat.py
T
2026-08-15 14:51:51 +08:00

27 lines
1.0 KiB
Python

import os
import paramiko
pw = os.environ["DEPLOY_PASSWORD"]
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("20.191.152.26", username="wakka", password=pw, timeout=30)
cmds = [
"curl -s http://127.0.0.1:7777/guest-customer-service | grep -E 'guest_new_path|base_url|csrf' | head -3",
"curl -s -X POST http://127.0.0.1:7777/guest-chat/new -H 'Content-Type: application/json' -d '{}' -w '\\nHTTP:%{http_code}\\n'",
"sudo docker logs guest-chat --tail 80 2>&1",
"sudo docker exec guest-chat curl -sI http://127.0.0.1:3000 2>&1 | head -5",
"sudo docker exec guest-chat curl -s http://127.0.0.1:3000/api/v1/widget/conversations -X POST -H 'Content-Type: application/json' -d '{}' 2>&1 | head -c 300",
]
for cmd in cmds:
print("===", cmd[:100])
_, o, e = c.exec_command(cmd, timeout=60)
out = o.read().decode(errors="replace")
err = e.read().decode(errors="replace")
print(out[:2000])
if err.strip():
print("ERR:", err[:300])
c.close()