summaryrefslogtreecommitdiffstats
path: root/testing/binghuan/helpers/binghuan.py
diff options
context:
space:
mode:
authorBagus Indrayana <bagusindrayanaindo@gmail.com>2023-07-11 19:13:24 +0200
committerBagus Indrayana <bagusindrayanaindo@gmail.com>2023-07-11 19:13:24 +0200
commit659e2f4ff08b46bdcc2420b705eac47da683a3a4 (patch)
tree398418bf246a9e9a5ea62b66406efcd41253200e /testing/binghuan/helpers/binghuan.py
parentcheck multiple messages (diff)
downloadgpt4free-659e2f4ff08b46bdcc2420b705eac47da683a3a4.tar
gpt4free-659e2f4ff08b46bdcc2420b705eac47da683a3a4.tar.gz
gpt4free-659e2f4ff08b46bdcc2420b705eac47da683a3a4.tar.bz2
gpt4free-659e2f4ff08b46bdcc2420b705eac47da683a3a4.tar.lz
gpt4free-659e2f4ff08b46bdcc2420b705eac47da683a3a4.tar.xz
gpt4free-659e2f4ff08b46bdcc2420b705eac47da683a3a4.tar.zst
gpt4free-659e2f4ff08b46bdcc2420b705eac47da683a3a4.zip
Diffstat (limited to 'testing/binghuan/helpers/binghuan.py')
-rw-r--r--testing/binghuan/helpers/binghuan.py10
1 files changed, 6 insertions, 4 deletions
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