7bc34c79ed
- Removed all cloud-related functionalities, including login prompts and token handling. - Disabled Laxis cloud features, ensuring no data is sent to external servers. - Updated manifest to reflect the new local-only functionality. - Added a new Python server to handle transcripts locally, including WebSocket support. - Implemented storage management for transcripts, including deduplication and file writing. - Created a smoke test for the WebSocket server to simulate transcript updates. - Updated README with setup instructions and usage details for the new local server.
38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
"""تست سریع بدون Chrome: شبیهسازی چیزی که افزونه میفرستد (با startedAt/endedAt).
|
|
|
|
اول سرور را بالا بیاور: python ws_server.py
|
|
بعد: python _smoke_test.py
|
|
باید PONG + چند ACK بگیری و فایلهای transcripts/meeting-abc123.{srt,txt,json} ساخته شوند.
|
|
"""
|
|
import asyncio
|
|
import json
|
|
import websockets
|
|
|
|
|
|
async def main():
|
|
base = 1_700_000_000_000 # epoch ms
|
|
async with websockets.connect("ws://127.0.0.1:8765") as ws:
|
|
await ws.send(json.dumps({"type": "PING", "ts": 1}))
|
|
print("PONG:", await ws.recv())
|
|
|
|
# حرف ۱: سه snapshotِ روبهرشد با startedAt ثابت → باید در یک segment جمع شوند
|
|
for end, txt in [(1200, "سلام"), (2600, "سلام به همه"), (4000, "سلام به همه خوش آمدید")]:
|
|
await ws.send(json.dumps({
|
|
"type": "TRANSCRIPT_UPDATE", "sessionId": "meeting-abc123",
|
|
"speaker": "Arash", "text": txt,
|
|
"startedAt": base, "endedAt": base + end,
|
|
}))
|
|
print("ACK:", await ws.recv())
|
|
|
|
# حرف ۲: speaker دیگر، startedAt جدید
|
|
for end, txt in [(7000, "ممنون"), (8500, "ممنون از دعوت")]:
|
|
await ws.send(json.dumps({
|
|
"type": "TRANSCRIPT_UPDATE", "sessionId": "meeting-abc123",
|
|
"speaker": "Vahid", "text": txt,
|
|
"startedAt": base + 6000, "endedAt": base + end,
|
|
}))
|
|
print("ACK:", await ws.recv())
|
|
|
|
|
|
asyncio.run(main())
|