File size: 357 Bytes
19b3da3
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import re
from typing import Dict


def apply_style_args(data: Dict):
    prompt = data.get("prompt", None)
    if prompt is None:
        return
    result = re.match(r"\[style:(.*?)\]", prompt)
    if result is not None:
        style = result.group(1)
        data["style"] = style
        data["prompt"] = prompt.replace(f"[style:{style}]", "").strip()