Skip to content

Commit

Permalink
Fixed bug: Fix the bug of Chinese display in log. The json.dumps func…
Browse files Browse the repository at this point in the history
…tion defaults to using ASCII encoding when serializing Chinese, so it will convert Chinese characters to the corresponding ASCII code.
  • Loading branch information
yym68686 committed Dec 17, 2023
1 parent 4ce7a97 commit 29a1954
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/chatgpt2api.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def ask_stream(
self.reset(convo_id=convo_id, system_prompt=self.system_prompt)
self.add_to_conversation(prompt, role, convo_id=convo_id, function_name=function_name)
json_post, message_token = self.truncate_conversation(prompt, role, convo_id, model, pass_history, **kwargs)
print(json.dumps(json_post, indent=4))
print(json.dumps(json_post, indent=4, ensure_ascii=False))
# print(self.conversation[convo_id])

if self.engine == "gpt-4-1106-preview" or self.engine == "gpt-3.5-turbo-1106":
Expand Down

0 comments on commit 29a1954

Please sign in to comment.