aiden-duplex / scripts /smoke_test.sh
sadmN's picture
Aiden duplex voice: code, checkpoint, base model, scripts
c74e524 verified
Raw History Blame Contribute Delete
1.15 kB
#!/usr/bin/env bash
# Headless check: one text turn must return a reply.
set -euo pipefail
ROOT=$(cd "$(dirname "$0")/.." && pwd)
"$ROOT/.venv-thinker/bin/python" - "$ROOT" <<'PY'
import sys, json, hmac, asyncio, aiohttp
from pathlib import Path
root = Path(sys.argv[1])
code = (root / '.access_code').read_text().strip()
key = hmac.new(code.encode(), b'aiden-demo-cookie-v1', 'sha256').hexdigest()
async def main():
async with aiohttp.ClientSession() as s:
async with s.ws_connect('ws://127.0.0.1:8998/ws',
headers={'Origin': 'http://127.0.0.1:8998',
'Cookie': '__Host-aiden_access=' + key}) as ws:
await ws.send_json({'type': 'text', 'text': 'Tell me a fun fact about the ocean.'})
while True:
m = await ws.receive(timeout=120)
if m.type == aiohttp.WSMsgType.TEXT:
d = json.loads(m.data)
if d['type'] == 'reply':
print('reply:', d['text'][:120]); return
if d['type'] == 'error':
raise SystemExit(d['message'])
asyncio.run(main())
PY