From c78fbc481733e4426d88a214d97b0ed03ac821d3 Mon Sep 17 00:00:00 2001 From: db0 Date: Sat, 9 Nov 2024 21:58:12 +0100 Subject: [PATCH] fix: validate request after style apply --- CHANGELOG.md | 5 +++++ horde/apis/v2/kobold.py | 4 ++-- horde/apis/v2/stable.py | 4 ++-- horde/consts.py | 2 +- horde/validation.py | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c930a053..03b645bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ SPDX-License-Identifier: AGPL-3.0-or-later # Changelog +# 4.44.3 + +* Fix image validation warnings being sent to the wrong requests +* Validate request with styles, only after style is applied + # 4.44.2 * Allow trusted users to also create styles diff --git a/horde/apis/v2/kobold.py b/horde/apis/v2/kobold.py index 0fabd71d..731cbf0f 100644 --- a/horde/apis/v2/kobold.py +++ b/horde/apis/v2/kobold.py @@ -95,8 +95,6 @@ def post(self): return (ret_dict, 202) def initiate_waiting_prompt(self): - self.prompt = self.args.prompt - self.apply_style() self.wp = TextWaitingPrompt( worker_ids=self.workers, models=self.models, @@ -169,6 +167,8 @@ def get_size_too_big_message(self): ) def validate(self): + self.prompt = self.args.prompt + self.apply_style() super().validate() param_validator = ParamValidator(self.args.prompt, self.args.models, self.params, self.user) self.warnings = param_validator.validate_text_params() diff --git a/horde/apis/v2/stable.py b/horde/apis/v2/stable.py index c2247ec1..fde80e02 100644 --- a/horde/apis/v2/stable.py +++ b/horde/apis/v2/stable.py @@ -115,6 +115,8 @@ def get_size_too_big_message(self): ) def validate(self): + self.prompt = self.args.prompt + self.apply_style() super().validate() param_validator = ParamValidator(prompt=self.args.prompt, models=self.args.models, params=self.params, user=self.user) self.warnings = param_validator.validate_image_params() @@ -223,8 +225,6 @@ def initiate_waiting_prompt(self): shared = True else: shared = False - self.prompt = self.args.prompt - self.apply_style() self.wp = ImageWaitingPrompt( worker_ids=self.workers, models=self.models, diff --git a/horde/consts.py b/horde/consts.py index 939c8de5..81cfea97 100644 --- a/horde/consts.py +++ b/horde/consts.py @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: AGPL-3.0-or-later -HORDE_VERSION = "4.44.2" +HORDE_VERSION = "4.44.3" HORDE_API_VERSION = "2.5" WHITELISTED_SERVICE_IPS = { diff --git a/horde/validation.py b/horde/validation.py index 22bb3eaf..9492986c 100644 --- a/horde/validation.py +++ b/horde/validation.py @@ -24,6 +24,7 @@ def __init__(self, prompt, models, params, user): self.models = models self.params = params self.user = user + self.warnings = set() def validate_base_params(self): pass