Prevent API extension responses from getting cut off with --chat enabled (#1467)

This commit is contained in:
AICatgirls 2023-04-22 12:06:43 -07:00 committed by GitHub
parent c0b5c09860
commit b992c9236a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)