Skip to content

Commit

Permalink
fix: validate request after style apply
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Nov 9, 2024
1 parent 2fd0106 commit c78fbc4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions horde/apis/v2/kobold.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions horde/apis/v2/stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion horde/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
1 change: 1 addition & 0 deletions horde/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c78fbc4

Please sign in to comment.