class_docstr: Compiles the results of Wizard of Internet crowdsourcing task into a json dataset.
class_docstr_tok: ["Compiles","the","results","of","Wizard","of","Internet","crowdsourcing","task","into","a","json","dataset","."]
code: def format_chat_data(self, dialog_history):
      data_dict = {"apprentice_persona": "", DIALOG_HISTORY_KEY: []}
  
      for message in dialog_history:
          if message["id"] == "PersonaAgent":
              data_dict["apprentice_persona"] = message["task_data"][
                  "apprentice_persona"
              ]
              continue
  
          if is_persona_form_response(message) or not get_human_sender(
              message
          ):
              continue
  
          if chat_interruption(message):
              # There was interruption (could be a clean Finish)
              # Ignoring the rest of messages
              break
  
          else:
              compiled_message = ChatMessage(message).compile_message()
              data_dict[DIALOG_HISTORY_KEY].append(compiled_message)
  
      return data_dict
  
imports: from typing import Dict, Union
  import parlai.utils.logging
  from parlai.crowdsourcing.projects.wizard_of_internet.wizard_internet_blueprint import WIZARD_INTERNET_PARLAICHAT_BLUEPRINT
  from parlai.crowdsourcing.utils.analysis import AbstractResultsCompiler
  from mephisto.abstractions.blueprint import AgentState
label_desc: Use image node_id 2 for calling the WizardOfInternetResultsCompiler obj's underlying member method code with example usage: obj.format_chat_data(dialog_history) and returns: data_dict