From 659e2f4ff08b46bdcc2420b705eac47da683a3a4 Mon Sep 17 00:00:00 2001 From: Bagus Indrayana Date: Wed, 12 Jul 2023 01:13:24 +0800 Subject: emojin encoding problem idk how to fix it --- testing/binghuan/helpers/binghuan.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'testing/binghuan/helpers/binghuan.py') diff --git a/testing/binghuan/helpers/binghuan.py b/testing/binghuan/helpers/binghuan.py index 2aabc4b6..203bbe45 100644 --- a/testing/binghuan/helpers/binghuan.py +++ b/testing/binghuan/helpers/binghuan.py @@ -210,10 +210,12 @@ async def run(optionSets, messages): prompt = messages[-1]['content'] if(len(messages) > 1): prompt = convert(messages) - async for value in AsyncCompletion.create(prompt=prompt, - optionSets=optionSets): - - print(value, flush=True, end = '') + async for value in AsyncCompletion.create(prompt=prompt, optionSets=optionSets): + try: + print(value, flush=True, end='') + except UnicodeEncodeError as e: + # emoji encoding problem + print(value.encode('utf-8'), flush=True, end='') optionSet = conversationstyles[config['model']] asyncio.run(run(optionSet, config['messages'])) \ No newline at end of file -- cgit v1.2.3