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)