mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:33:57 +01:00
Added /v1/accounts/credits
This commit is contained in:
parent
1384b3add8
commit
d3d9ead8f4
|
@ -71,6 +71,9 @@ async def handle(incoming_request: fastapi.Request):
|
||||||
if ban_reason:
|
if ban_reason:
|
||||||
return await errors.error(403, f'Your NovaAI account has been banned. Reason: \'{ban_reason}\'.', 'Contact the staff for an appeal.')
|
return await errors.error(403, f'Your NovaAI account has been banned. Reason: \'{ban_reason}\'.', 'Contact the staff for an appeal.')
|
||||||
|
|
||||||
|
if 'account/credits' in path:
|
||||||
|
return fastapi.responses.JSONResponse({'credits': user['credits']})
|
||||||
|
|
||||||
costs = config['costs']
|
costs = config['costs']
|
||||||
cost = costs['other']
|
cost = costs['other']
|
||||||
|
|
||||||
|
@ -150,7 +153,7 @@ async def handle(incoming_request: fastapi.Request):
|
||||||
|
|
||||||
media_type = 'text/event-stream' if payload.get('stream', False) else 'application/json'
|
media_type = 'text/event-stream' if payload.get('stream', False) else 'application/json'
|
||||||
|
|
||||||
if payload['model'] not in models:
|
if (model := payload.get('model')) not in models and model is not None:
|
||||||
return await errors.error(404, 'Model not found.', 'Check the model name and try again.')
|
return await errors.error(404, 'Model not found.', 'Check the model name and try again.')
|
||||||
|
|
||||||
return fastapi.responses.StreamingResponse(
|
return fastapi.responses.StreamingResponse(
|
||||||
|
|
Loading…
Reference in a new issue