diff --git a/interpreter/core/core.py b/interpreter/core/core.py index a817fcd9c..606994a24 100644 --- a/interpreter/core/core.py +++ b/interpreter/core/core.py @@ -238,9 +238,11 @@ def _streaming_chat(self, message=None, display=True): if self.conversation_history: # If it's the first message, set the conversation name if not self.conversation_filename: - first_few_words = "_".join( - self.messages[0]["content"][:25].split(" ")[:-1] - ) + first_few_words_list = self.messages[0]["content"][:25].split(" ") + if len(first_few_words_list) >= 2: # for languages like English with blank between words + first_few_words = "_".join(first_few_words_list[:-1]) + else: # for languages like Chinese without blank between words + first_few_words = self.messages[0]["content"][:15] for char in '<>:"/\\|?*!': # Invalid characters for filenames first_few_words = first_few_words.replace(char, "")