Spaces:
Runtime error
Runtime error
Download crazy_functions/agent_fns/echo_agent.py from adminstr/gpt-academic: direct link, hf CLI and curl.
- Browser
- Download file 879 Bytes
-
https://huggingface.co/spaces/adminstr/gpt-academic/resolve/main/crazy_functions/agent_fns/echo_agent.py
- Command line
-
hf download hf://spaces/adminstr/gpt-academic/crazy_functions/agent_fns/echo_agent.py
-
curl -L -o echo_agent.py https://huggingface.co/spaces/adminstr/gpt-academic/resolve/main/crazy_functions/agent_fns/echo_agent.py
879 Bytes
| from crazy_functions.agent_fns.pipe import PluginMultiprocessManager, PipeCom | |
| class EchoDemo(PluginMultiprocessManager): | |
| def subprocess_worker(self, child_conn): | |
| # ⭐⭐ 子进程 | |
| self.child_conn = child_conn | |
| while True: | |
| msg = self.child_conn.recv() # PipeCom | |
| if msg.cmd == "user_input": | |
| # wait futher user input | |
| self.child_conn.send(PipeCom("show", msg.content)) | |
| wait_success = self.subprocess_worker_wait_user_feedback(wait_msg="我准备好处理下一个问题了.") | |
| if not wait_success: | |
| # wait timeout, terminate this subprocess_worker | |
| break | |
| elif msg.cmd == "terminate": | |
| self.child_conn.send(PipeCom("done", "")) | |
| break | |
| print('[debug] subprocess_worker terminated') |