Image info, endpoint encryption

This commit is contained in:
BarsTiger
2023-02-24 23:41:29 +02:00
parent 846e65e2ce
commit 8f0cd0ac05
19 changed files with 211 additions and 23 deletions

View File

@@ -1,10 +1,10 @@
import aiohttp
from bot.db import db, DBTables
from bot.db import db, DBTables, decrypt
from rich import print
async def get_models():
endpoint = db[DBTables.config].get('endpoint')
endpoint = decrypt(db[DBTables.config].get('endpoint'))
try:
async with aiohttp.ClientSession() as session:
r = await session.get(endpoint + "/sdapi/v1/sd-models")
@@ -17,7 +17,7 @@ async def get_models():
async def set_model(model_name: str):
endpoint = db[DBTables.config].get('endpoint')
endpoint = decrypt(db[DBTables.config].get('endpoint'))
try:
async with aiohttp.ClientSession() as session:
r = await session.post(endpoint + "/sdapi/v1/options", json={

View File

@@ -1,4 +1,4 @@
from bot.db import db, DBTables
from bot.db import db, DBTables, decrypt
import aiohttp
import asyncio
import time
@@ -18,7 +18,7 @@ async def job_exists(endpoint):
async def wait_for_status(ignore_exceptions: bool = False):
endpoint = db[DBTables.config].get('endpoint')
endpoint = decrypt(db[DBTables.config].get('endpoint'))
try:
while await job_exists(endpoint):
while db[DBTables.cooldown].get('_last_time_status_checked', 0) + 5 > time.time():

View File

@@ -1,12 +1,12 @@
import aiohttp
from bot.db import db, DBTables
from bot.db import db, DBTables, decrypt
from .objects.prompt_request import Prompt
import json
import base64
async def txt2img(prompt: Prompt, ignore_exceptions: bool = False) -> list[bytes, dict] | None:
endpoint = db[DBTables.config].get('endpoint')
endpoint = decrypt(db[DBTables.config].get('endpoint'))
try:
async with aiohttp.ClientSession() as session:
r = await session.post(