Download AgenticControl/update_email_cli.py from Asad999/Texbase: direct link, hf CLI and curl.
- Browser
- Download file 911 Bytes
-
https://huggingface.co/spaces/Asad999/Texbase/resolve/main/AgenticControl/update_email_cli.py
- Command line
-
hf download hf://spaces/Asad999/Texbase/AgenticControl/update_email_cli.py
-
curl -L -o update_email_cli.py https://huggingface.co/spaces/Asad999/Texbase/resolve/main/AgenticControl/update_email_cli.py
911 Bytes
| import sys | |
| import json | |
| from user_review_email import update_single_email | |
| if __name__ == "__main__": | |
| try: | |
| input_data = sys.stdin.read() | |
| payload = json.loads(input_data) | |
| target_id = payload.get("id") | |
| feedback = payload.get("feedback") | |
| if not target_id or not feedback: | |
| print(json.dumps({"ok": False, "error": "Missing id or feedback"})) | |
| sys.exit(1) | |
| result = update_single_email(db_id=target_id, feedback=feedback) | |
| if result: | |
| new_body, new_subject = result | |
| print(json.dumps({"ok": True, "new_content": new_body, "new_subject": new_subject})) | |
| else: | |
| print(json.dumps({"ok": False, "error": "Unknown error during email update"})) | |
| except Exception as e: | |
| print(json.dumps({"ok": False, "error": str(e)})) | |
| sys.exit(1) | |