mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:43:57 +01:00
Models endpoint is now free and very quick
This commit is contained in:
parent
a3d51ed92e
commit
f0fee481db
1349
api/models.json
Normal file
1349
api/models.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -86,7 +86,7 @@ async def stream(
|
|||
webhook = dhooks.Webhook(os.getenv('DISCORD_WEBHOOK__API_ISSUE'))
|
||||
|
||||
webhook.send(content=f'API Issue: **`{exc}`**\nhttps://i.imgflip.com/7uv122.jpg')
|
||||
error = errors.yield_error(
|
||||
error = await errors.yield_error(
|
||||
500,
|
||||
'Sorry, the API has no working keys anymore.',
|
||||
'The admins have been messaged automatically.'
|
||||
|
@ -166,7 +166,7 @@ async def stream(
|
|||
|
||||
except Exception as exc:
|
||||
if 'Connection closed' in str(exc):
|
||||
error = errors.yield_error(
|
||||
error = await errors.yield_error(
|
||||
500,
|
||||
'Sorry, there was an issue with the connection.',
|
||||
'Please first check if the issue on your end. If this error repeats, please don\'t heistate to contact the staff!.'
|
||||
|
|
|
@ -14,6 +14,8 @@ from helpers import tokens, errors
|
|||
|
||||
load_dotenv()
|
||||
|
||||
models_list = json.load(open('models.json'))
|
||||
|
||||
with open('config/credits.yml', encoding='utf8') as f:
|
||||
credits_config = yaml.safe_load(f)
|
||||
|
||||
|
@ -65,6 +67,9 @@ async def handle(incoming_request):
|
|||
error = await errors.error(418, 'Your NovaAI account is not active (paused).', 'Simply re-activate your account using a Discord command or the web panel.')
|
||||
return error
|
||||
|
||||
if '/models' in path:
|
||||
return fastapi.responses.JSONResponse(content=models_list)
|
||||
|
||||
# COST
|
||||
costs = credits_config['costs']
|
||||
cost = costs['other']
|
||||
|
|
Loading…
Reference in a new issue