INNER CODE UNIT · Python

AssistantHandler

skyportal/skyportal · services/assistant/app.py:709

class AssistantHandler(tornado.web.RequestHandler):
    def post(self):
        try:
            data = tornado.escape.json_decode(self.request.body)
        except json.JSONDecodeError:
            self.set_status(400)
            return self.write({"status": "error", "message": "Malformed JSON"})

        if not BASE_URL:
            self.set_status(503)
            return self.write(
                {"status": "error", "message": "app.assistant.base_url is not set"}
            )

        # Answer out of band: the caller is the API, not a user waiting.
        IOLoop.current().run_in_executor(None, lambda: respond(data["message_id"]))
        return self.write({"status": "success"})

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…