Prevent API extension responses from getting cut off with --chat enabled (#1467)
This commit is contained in:
parent
c0b5c09860
commit
b992c9236a
1 changed files with 3 additions and 1 deletions
|
@ -73,10 +73,11 @@ class Handler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
response = json.dumps({
|
response = json.dumps({
|
||||||
'results': [{
|
'results': [{
|
||||||
'text': answer[len(prompt):]
|
'text': answer if shared.args.is_chat() else answer[len(prompt):]
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
self.wfile.write(response.encode('utf-8'))
|
self.wfile.write(response.encode('utf-8'))
|
||||||
|
|
||||||
elif self.path == '/api/v1/token-count':
|
elif self.path == '/api/v1/token-count':
|
||||||
# Not compatible with KoboldAI api
|
# Not compatible with KoboldAI api
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
|
@ -90,6 +91,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
self.wfile.write(response.encode('utf-8'))
|
self.wfile.write(response.encode('utf-8'))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.send_error(404)
|
self.send_error(404)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue