mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac/fix: automatic1111 params
This commit is contained in:
parent
1b0bce529f
commit
9370b263f5
2 changed files with 16 additions and 12 deletions
|
|
@ -3184,10 +3184,9 @@ try:
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
automatic1111_params = {}
|
automatic1111_params = {}
|
||||||
|
|
||||||
|
|
||||||
AUTOMATIC1111_PARAMS = PersistentConfig(
|
AUTOMATIC1111_PARAMS = PersistentConfig(
|
||||||
"AUTOMATIC1111_PARAMS",
|
"AUTOMATIC1111_PARAMS",
|
||||||
"image_generation.automatic1111.api_auth",
|
"image_generation.automatic1111.api_params",
|
||||||
automatic1111_params,
|
automatic1111_params,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ def set_image_model(request: Request, model: str):
|
||||||
request.app.state.config.IMAGE_GENERATION_MODEL = model
|
request.app.state.config.IMAGE_GENERATION_MODEL = model
|
||||||
if request.app.state.config.IMAGE_GENERATION_ENGINE in ["", "automatic1111"]:
|
if request.app.state.config.IMAGE_GENERATION_ENGINE in ["", "automatic1111"]:
|
||||||
api_auth = get_automatic1111_api_auth(request)
|
api_auth = get_automatic1111_api_auth(request)
|
||||||
|
|
||||||
|
try:
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
url=f"{request.app.state.config.AUTOMATIC1111_BASE_URL}/sdapi/v1/options",
|
url=f"{request.app.state.config.AUTOMATIC1111_BASE_URL}/sdapi/v1/options",
|
||||||
headers={"authorization": api_auth},
|
headers={"authorization": api_auth},
|
||||||
|
|
@ -56,6 +58,9 @@ def set_image_model(request: Request, model: str):
|
||||||
json=options,
|
json=options,
|
||||||
headers={"authorization": api_auth},
|
headers={"authorization": api_auth},
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
log.debug(f"{e}")
|
||||||
|
|
||||||
return request.app.state.config.IMAGE_GENERATION_MODEL
|
return request.app.state.config.IMAGE_GENERATION_MODEL
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -108,7 +113,7 @@ class ImagesConfig(BaseModel):
|
||||||
IMAGES_OPENAI_API_VERSION: str
|
IMAGES_OPENAI_API_VERSION: str
|
||||||
|
|
||||||
AUTOMATIC1111_BASE_URL: str
|
AUTOMATIC1111_BASE_URL: str
|
||||||
AUTOMATIC1111_API_AUTH: str
|
AUTOMATIC1111_API_AUTH: Optional[dict | str]
|
||||||
AUTOMATIC1111_PARAMS: Optional[dict | str]
|
AUTOMATIC1111_PARAMS: Optional[dict | str]
|
||||||
|
|
||||||
COMFYUI_BASE_URL: str
|
COMFYUI_BASE_URL: str
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue