Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

[Chat Services] Browser Chat Bug Fix #3050

Merged
merged 1 commit into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions parlai/chat_service/services/browser_chat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ def do_POST(self):
json_str = json.dumps(model_response)
self.wfile.write(bytes(json_str, 'utf-8'))
elif self.path == '/reset':
self._interactive_running(b"[RESET]")
self.send_response(200)
self.send_header('Content-type', 'application/json')
self.end_headers()
self.wfile.write(bytes("{}", 'utf-8'))
message_available.wait()
message_available.clear()
else:
return self._respond({'status': 500})

Expand Down
5 changes: 4 additions & 1 deletion parlai/chat_service/tasks/chatbot/worlds.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ def parley(self):
'id': 'World',
'text': 'Welcome to the ParlAI Chatbot demo. '
'You are now paired with a bot - feel free to send a message.'
'Type [DONE] to finish the chat.',
'Type [DONE] to finish the chat, or [RESET] to reset the dialogue history.',
}
)
self.first_time = False
a = self.agent.act()
if a is not None:
if '[DONE]' in a['text']:
self.episodeDone = True
elif '[RESET]' in a['text']:
self.model.reset()
self.agent.observe({"text": "[History Cleared]", "episode_done": False})
else:
print("===act====")
print(a)
Expand Down