26 lines
788 B
Python
26 lines
788 B
Python
import asyncio
|
|
import json
|
|
from datetime import datetime
|
|
|
|
import websockets
|
|
|
|
|
|
TRANSCRIPT = [
|
|
{"speaker": "Bride", "text": "Add a note that the customer prefers white flowers."},
|
|
{"speaker": "Planner", "text": "Create a task for Maria to confirm the photographer."},
|
|
{"speaker": "Groom", "text": "We should reserve the venue for July 15."},
|
|
{"speaker": "Bride", "text": "I'll call the florist tomorrow."},
|
|
]
|
|
|
|
|
|
async def main() -> None:
|
|
async with websockets.connect("ws://localhost:9000/ws/transcript") as socket:
|
|
for item in TRANSCRIPT:
|
|
await socket.send(json.dumps({**item, "timestamp": datetime.utcnow().isoformat()}))
|
|
print(await socket.recv())
|
|
await asyncio.sleep(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|