diff --git a/api-examples/api-example-chat-stream.py b/api-examples/api-example-chat-stream.py index cccd5b2..c8dbbc5 100644 --- a/api-examples/api-example-chat-stream.py +++ b/api-examples/api-example-chat-stream.py @@ -1,4 +1,5 @@ import asyncio +import html import json import sys @@ -91,7 +92,7 @@ async def print_response_stream(user_input, history): async for new_history in run(user_input, history): cur_message = new_history['visible'][-1][1][cur_len:] cur_len += len(cur_message) - print(cur_message, end='') + print(html.unescape(cur_message), end='') sys.stdout.flush() # If we don't flush, we won't see tokens in realtime. diff --git a/api-examples/api-example-chat.py b/api-examples/api-example-chat.py index c197a58..e179696 100644 --- a/api-examples/api-example-chat.py +++ b/api-examples/api-example-chat.py @@ -1,3 +1,4 @@ +import html import json import requests @@ -72,7 +73,7 @@ def run(user_input, history): result = response.json()['results'][0]['history'] print(json.dumps(result, indent=4)) print() - print(result['visible'][-1][1]) + print(html.unescape(result['visible'][-1][1])) if __name__ == '__main__':