Skip to content

Commit

Permalink
Merge pull request ahmadfaizalbh#15 from realpacific/fix
Browse files Browse the repository at this point in the history
Fixed IndexError
  • Loading branch information
ahmadfaizalbh authored Mar 5, 2020
2 parents 35e4cad + f7b3718 commit 021ca31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chatbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,10 @@ def respond(self, text, session_id="general"):
:rtype: str
"""
text = self.__normalize(text)
previous_text = self.__normalize(self.conversation[session_id][-2])
try:
previous_text = self.__normalize(self.conversation[session_id][-2])
except IndexError:
previous_text = ""
text_correction = self.__correction(text)
current_topic = self.topic[session_id]
current_topic_order = current_topic.split(".")
Expand Down

0 comments on commit 021ca31

Please sign in to comment.