Fixed changing models. Changed cooldown for changing models to 30m

This commit is contained in:
seel2304
2023-05-03 17:09:25 +00:00
parent 2dda780d3f
commit 75f6404e94
2 changed files with 6 additions and 4 deletions

View File

@@ -1,14 +1,16 @@
import aiohttp
import json
from bot.db import db, DBTables, decrypt
async def get_models() -> list | None:
endpoint = decrypt(db[DBTables.config].get('endpoint'))
async with aiohttp.ClientSession() as session:
r = await session.get(endpoint + "/sdapi/v1/sd-models")
r = await session.get(endpoint + '/sdapi/v1/sd-models')
if r.status != 200:
return None
return [x["title"] for x in await r.json()]
json_data = await r.json()
return [x["title"] for x in json_data]
async def set_model(model_name: str):