test
This commit is contained in:
parent
4c2c164ce1
commit
90adffaec8
|
@ -120,7 +120,7 @@ def openai_chat_completions(model_name=None):
|
||||||
timestamp = int(stream_index.decode('utf-8').split('-')[0])
|
timestamp = int(stream_index.decode('utf-8').split('-')[0])
|
||||||
data = ujson.loads(item[b'data'])
|
data = ujson.loads(item[b'data'])
|
||||||
if data['error']:
|
if data['error']:
|
||||||
print(data['error'])
|
print('OAI streaming error:', data['error'])
|
||||||
yield 'data: [DONE]\n\n'
|
yield 'data: [DONE]\n\n'
|
||||||
return
|
return
|
||||||
elif data['new']:
|
elif data['new']:
|
||||||
|
|
|
@ -164,7 +164,7 @@ def openai_completions(model_name=None):
|
||||||
timestamp = int(stream_index.decode('utf-8').split('-')[0])
|
timestamp = int(stream_index.decode('utf-8').split('-')[0])
|
||||||
data = ujson.loads(item[b'data'])
|
data = ujson.loads(item[b'data'])
|
||||||
if data['error']:
|
if data['error']:
|
||||||
print(data['error'])
|
print('OAI streaming error:', data['error'])
|
||||||
yield 'data: [DONE]\n\n'
|
yield 'data: [DONE]\n\n'
|
||||||
return
|
return
|
||||||
elif data['new']:
|
elif data['new']:
|
||||||
|
|
|
@ -66,6 +66,7 @@ def inference_do_stream(stream_name: str, msg_to_backend: dict, backend_url: str
|
||||||
json_obj = json.loads(json_str.decode())
|
json_obj = json.loads(json_str.decode())
|
||||||
new = json_obj['text'][0].split(prompt + generated_text)[1]
|
new = json_obj['text'][0].split(prompt + generated_text)[1]
|
||||||
generated_text = generated_text + new
|
generated_text = generated_text + new
|
||||||
|
print(new)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
# ????
|
# ????
|
||||||
continue
|
continue
|
||||||
|
|
Reference in New Issue