Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate history conversation filenames in Chinese properly. #1150

Merged
Merged
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
8 changes: 5 additions & 3 deletions interpreter/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")

Expand Down
Loading