Spaces:
Paused
Paused
Download patch_sse_transport.py from bep40/Space-Control: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/bep40/Space-Control/resolve/main/patch_sse_transport.py
- Command line
-
hf download hf://spaces/bep40/Space-Control/patch_sse_transport.py
-
curl -L -o patch_sse_transport.py https://huggingface.co/spaces/bep40/Space-Control/resolve/main/patch_sse_transport.py
1.04 kB
| """Patch sse-chat-transport.ts - handle task_incomplete event.""" | |
| SSE_TRANSPORT = "/source/frontend/src/lib/sse-chat-transport.ts" | |
| def patch(): | |
| import os | |
| if not os.path.exists(SSE_TRANSPORT): | |
| print(f"SKIP: {SSE_TRANSPORT} not found") | |
| return | |
| with open(SSE_TRANSPORT, "r", encoding="utf-8") as f: | |
| content = f.read() | |
| # Add task_incomplete case in createEventToChunkStream | |
| if "case 'task_incomplete'" not in content: | |
| task_incomplete_case = ''' case 'task_incomplete': | |
| sideChannel.onTaskIncomplete( | |
| (event.data?.incomplete_plan as Array<{ id: string; content: string; status: string }>) || [], | |
| ); | |
| break; | |
| ''' | |
| content = content.replace( | |
| "case 'turn_complete':", | |
| task_incomplete_case + "\n case 'turn_complete':" | |
| ) | |
| with open(SSE_TRANSPORT, "w", encoding="utf-8") as f: | |
| f.write(content) | |
| print(f"OK: Patched {SSE_TRANSPORT}") | |
| if __name__ == "__main__": | |
| patch() |