
from parlai.core.agents import Agent
from parlai.core.worlds import display_messages

class LocalHumanAgent(Agent):

    def __init__(self, opt, shared=None):
        super().__init__(opt)
        self.id = 'localHuman'

    def observe(self, msg):
        print(display_messages([msg]))

    def act(self):
        obs = self.observation
        reply = {}
        reply['id'] = self.getID()
        reply['text'] = input("Enter Your Reply: ")
        return reply


from parlai.core.agents import Agent
from parlai.core.worlds import display_messages

class LocalHumanAgent(Agent):

    def __init__(self, opt, shared=None):
        super().__init__(opt)
        self.id = 'localHuman'
        self.done = False

    def observe(self, msg):
        print(display_messages([msg]))

    def act(self):
        obs = self.observation
        reply = {}
        reply['id'] = self.getID()
        reply['text'] = input("Enter Your Reply: ")
        if reply_text == '[DONE]':
            reply['episode_done'] = True
            self.done = True
        reply['text'] = reply_text
        return reply

    def epoch_done(self):
        return self.done

Send episode_done=True from local human agent
Send episode_done=True from local human agent

  
  from parlai.core.agents import Agent
  from parlai.core.worlds import display_messages
  
  class LocalHumanAgent(Agent):
  
      def __init__(self, opt, shared=None):
          super().__init__(opt)
          self.id = 'localHuman'
+         self.done = False
  
      def observe(self, msg):
          print(display_messages([msg]))
  
      def act(self):
          obs = self.observation
          reply = {}
          reply['id'] = self.getID()
          reply['text'] = input("Enter Your Reply: ")
+         if reply_text == '[DONE]':
+             reply['episode_done'] = True
+             self.done = True
+         reply['text'] = reply_text
          return reply
  
+     def epoch_done(self):
+         return self.done
+ 
Send episode_done=True from local human agent
## Code Before:

from parlai.core.agents import Agent
from parlai.core.worlds import display_messages

class LocalHumanAgent(Agent):

    def __init__(self, opt, shared=None):
        super().__init__(opt)
        self.id = 'localHuman'

    def observe(self, msg):
        print(display_messages([msg]))

    def act(self):
        obs = self.observation
        reply = {}
        reply['id'] = self.getID()
        reply['text'] = input("Enter Your Reply: ")
        return reply

## Instruction:
Send episode_done=True from local human agent
## Code After:

from parlai.core.agents import Agent
from parlai.core.worlds import display_messages

class LocalHumanAgent(Agent):

    def __init__(self, opt, shared=None):
        super().__init__(opt)
        self.id = 'localHuman'
        self.done = False

    def observe(self, msg):
        print(display_messages([msg]))

    def act(self):
        obs = self.observation
        reply = {}
        reply['id'] = self.getID()
        reply['text'] = input("Enter Your Reply: ")
        if reply_text == '[DONE]':
            reply['episode_done'] = True
            self.done = True
        reply['text'] = reply_text
        return reply

    def epoch_done(self):
        return self.done
