From b992c9236a3f0882989b0741775b9047f79e7475 Mon Sep 17 00:00:00 2001 From: AICatgirls <130926942+AICatgirls@users.noreply.github.com> Date: Sat, 22 Apr 2023 12:06:43 -0700 Subject: [PATCH] Prevent API extension responses from getting cut off with --chat enabled (#1467) --- extensions/api/script.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/api/script.py b/extensions/api/script.py index 5e429130..64e58aab 100644 --- a/extensions/api/script.py +++ b/extensions/api/script.py @@ -73,10 +73,11 @@ class Handler(BaseHTTPRequestHandler): response = json.dumps({ 'results': [{ - 'text': answer[len(prompt):] + 'text': answer if shared.args.is_chat() else answer[len(prompt):] }] }) self.wfile.write(response.encode('utf-8')) + elif self.path == '/api/v1/token-count': # Not compatible with KoboldAI api self.send_response(200) @@ -90,6 +91,7 @@ class Handler(BaseHTTPRequestHandler): }] }) self.wfile.write(response.encode('utf-8')) + else: self.send_error(404)