diff --git a/extensions/api/blocking_api.py b/extensions/api/blocking_api.py index e84e68e..edc6d8f 100644 --- a/extensions/api/blocking_api.py +++ b/extensions/api/blocking_api.py @@ -72,7 +72,6 @@ class Handler(BaseHTTPRequestHandler): self.end_headers() user_input = body['user_input'] - history = body['history'] regenerate = body.get('regenerate', False) _continue = body.get('_continue', False) @@ -80,9 +79,9 @@ class Handler(BaseHTTPRequestHandler): generate_params['stream'] = False generator = generate_chat_reply( - user_input, history, generate_params, regenerate=regenerate, _continue=_continue, loading_message=False) + user_input, generate_params, regenerate=regenerate, _continue=_continue, loading_message=False) - answer = history + answer = generate_params['history'] for a in generator: answer = a diff --git a/extensions/api/streaming_api.py b/extensions/api/streaming_api.py index e544066..2a7fb62 100644 --- a/extensions/api/streaming_api.py +++ b/extensions/api/streaming_api.py @@ -55,14 +55,13 @@ async def _handle_connection(websocket, path): body = json.loads(message) user_input = body['user_input'] - history = body['history'] generate_params = build_parameters(body, chat=True) generate_params['stream'] = True regenerate = body.get('regenerate', False) _continue = body.get('_continue', False) generator = generate_chat_reply( - user_input, history, generate_params, regenerate=regenerate, _continue=_continue, loading_message=False) + user_input, generate_params, regenerate=regenerate, _continue=_continue, loading_message=False) message_num = 0 for a in generator: diff --git a/extensions/api/util.py b/extensions/api/util.py index d575c60..6896c29 100644 --- a/extensions/api/util.py +++ b/extensions/api/util.py @@ -65,6 +65,7 @@ def build_parameters(body, chat=False): 'context_instruct': context_instruct, 'turn_template': turn_template, 'chat-instruct_command': str(body.get('chat-instruct_command', shared.settings['chat-instruct_command'])), + 'history': body.get('history', {'internal': [], 'visible': []}) }) return generate_params