class_docstr: Handle HTTP requests.
class_docstr_tok: ["Handle","HTTP","requests","."]
docstr: Handle POST request, especially replying to a chat message.
docstr_tok: ["Handle","POST","request",",","especially","replying","to","a","chat","message","."]
code: def do_POST(self):
      """
      Handle POST request, especially replying to a chat message.
      """
      if self.path == "/interact":
          content_length = int(self.headers["Content-Length"])
          body = self.rfile.read(content_length)
          model_response = self._interactive_running(
              SHARED.get("opt"), body.decode("utf-8")
          )
          self.send_response(200)
          self.send_header("Content-type", "application/json")
          self.end_headers()
          json_str = json.dumps(model_response.json_safe_payload())
          self.wfile.write(bytes(json_str, "utf-8"))
      elif self.path == "/reset":
          self.send_response(200)
          self.send_header("Content-type", "application/json")
          self.end_headers()
          SHARED["agent"].reset()
          self.wfile.write(bytes("{}", "utf-8"))
      else:
          return self._respond({"status": 500})
  
imports: from http.server import BaseHTTPRequestHandler, HTTPServer
  from parlai.scripts.interactive import setup_args
  from parlai.core.agents import create_agent
  from parlai.core.worlds import create_task
  from typing import Dict, Any
  from parlai.core.script import ParlaiScript, register_script
  import parlai.utils.logging
  import json
  import time
  from parlai.agents.local_human.local_human import LocalHumanAgent
label_desc: Use image node_id 3 for calling the MyHandler obj's underlying member method code with example usage: obj.do_POST() and returns: self