Sampling: Fix override for DRY sequence breakers

The common type should be an array of strings.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-09-07 21:32:46 -04:00
parent 4f5ca7a4c7
commit 9c4a0e650f
2 changed files with 6 additions and 2 deletions

View file

@ -159,7 +159,7 @@ class BaseSamplerRequest(BaseModel):
description=("Aliases: dry_penalty_last_n"),
)
dry_sequence_breakers: Optional[str] = Field(
dry_sequence_breakers: Optional[Union[str, List[str]]] = Field(
default_factory=lambda: get_default_sampler_value("dry_sequence_breakers", [])
)
@ -330,7 +330,7 @@ class BaseSamplerRequest(BaseModel):
# Convert sequence breakers into an array of strings
# NOTE: This sampler sucks to parse.
if self.dry_sequence_breakers:
if self.dry_sequence_breakers and isinstance(self.dry_sequence_breakers, str):
if not self.dry_sequence_breakers.startswith("["):
self.dry_sequence_breakers = f"[{self.dry_sequence_breakers}]"