Spaces:
Configuration error
Configuration error
Download plugin/scripts/stop.py from Yash030/agentcache: direct link, hf CLI and curl.
- Browser
- Download file 647 Bytes
-
https://huggingface.co/spaces/Yash030/agentcache/resolve/main/plugin/scripts/stop.py
- Command line
-
hf download hf://spaces/Yash030/agentcache/plugin/scripts/stop.py
-
curl -L -o stop.py https://huggingface.co/spaces/Yash030/agentcache/resolve/main/plugin/scripts/stop.py
647 Bytes
| #!/usr/bin/env python | |
| import sys | |
| import json | |
| import time | |
| from hook_utils import is_sdk_child, api_call_bg | |
| def main(): | |
| try: | |
| input_data = sys.stdin.read() | |
| if not input_data: | |
| return | |
| data = json.loads(input_data) | |
| except Exception: | |
| return | |
| if is_sdk_child(data): | |
| return | |
| session_id = data.get("session_id") or data.get("sessionId") or "unknown" | |
| api_call_bg("summarize", {"sessionId": session_id}) | |
| api_call_bg("session/end", {"sessionId": session_id}) | |
| # Allow the background threads to start their socket sends | |
| time.sleep(1.5) | |
| if __name__ == "__main__": | |
| main() | |