Add system fingerprint to server JSON response

This commit is contained in:
NovaOSS Admins 2023-11-07 00:05:00 +00:00
parent b14383be3d
commit b79ebc05b8
2 changed files with 2 additions and 1 deletions

View file

@ -62,7 +62,7 @@ async def handle(incoming_request: fastapi.Request):
user = await users.user_by_api_key(received_key.split('Bearer ')[1].strip())
if not user or not user['status']['active']:
return await errors.error(418, 'Invalid or inactive NovaAI API key!', 'Create a new NovaOSS API key or reactivate your account.')
return await errors.error(401, 'Invalid or inactive NovaAI API key!', 'Try /resetkey or /credentials.')
ban_reason = user['status']['ban_reason']
if ban_reason:

View file

@ -241,6 +241,7 @@ async def respond(
return
if (not is_stream) and server_json_response:
server_json_response['system_fingerprint'] = f'fp_' + os.urandom(5).hex()
yield json.dumps(server_json_response)
if incoming_request: # not called by other code, but actually a request