Setting model, /status command for pinging host
This commit is contained in:
1 parent
8e3e6929d8
commit
a5ce82f148
11 files changed
+171
-3
No files matched your search
@@ -2,7 +2,7 @@ import aiohttp
|
||||
from bot.db import db, DBTables, decrypt
|
||||
|
||||
|
||||
async def get_models():
|
||||
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")
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import aiohttp
|
||||
from bot.db import db, DBTables, decrypt
|
||||
|
||||
|
||||
async def ping():
|
||||
endpoint = decrypt(db[DBTables.config].get('endpoint'))
|
||||
try:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
r = await session.head(endpoint)
|
||||
if r.status != 200:
|
||||
return False
|
||||
return True
|
||||
except aiohttp.ClientConnectorError:
|
||||
return False
|
||||
Reference in new issue
Block a user