Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
[Bug]: Error when hitting ♻️ recycle button
### Checklist

- [ ] The issue exists after disabling all extensions
- [ ] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [ ] The issue exists in the current version of the webui
- [ ] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

When I click reuse seed button nothing happens in the UI.
It still happens when I disabled all extentions.

### Steps to reproduce the problem

1. Generate an image
2. Click reuse see button

### What should have happened?

The see field should populate with the seed from the previous generation.

### What browsers do you use to access the UI ?

Chrome

### Sysinfo

```
{
    "Platform": "Windows-10-10.0.22631-SP0",
    "Python": "3.10.6",
    "Version": "v1.8.0",
    "Commit": "bef51aed032c0aaa5cfd80445bc4cf0d85b408b5",
    "Script path": "E:\\AI\\A1111",
    "Data path": "E:\\AI\\A1111",
    "Extensions dir": "E:\\AI\\A1111\\extensions",
    "Checksum": "87a450ec99b96a8109df61d99e5ea59b78d567b91848137f0fcd476b5f87864a",
    "Commandline": [
        "launch.py",
        "--listen",
        "--port",
        "7799",
        "--api",
        "--update-check",
        "--xformers",
        "--cors-allow-origins=https://www.painthua.com",
        "--medvram-sdxl",
        "--enable-insecure-extension-access",
        "--styles-file",
        "E:\\AI\\MODELS\\styles-full.csv",
        "--ckpt-dir",
        "E:\\AI\\MODELS\\Stable-diffusion",
        "--lora-dir",
        "E:\\AI\\MODELS\\LoRA",
        "--embeddings-dir",
        "E:\\AI\\MODELS\\Embeddings"
    ],
    "Torch env info": {
        "torch_version": "2.1.2+cu121",
        "is_debug_build": "False",
        "cuda_compiled_version": "12.1",
        "gcc_version": null,
        "clang_version": null,
        "cmake_version": "version 3.28.3",
        "os": "Microsoft Windows 11 Pro",
        "libc_version": "N/A",
        "python_version": "3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] (64-bit runtime)",
        "python_platform": "Windows-10-10.0.22631-SP0",
        "is_cuda_available": "True",
        "cuda_runtime_version": "11.7.99\r",
        "cuda_module_loading": "LAZY",
        "nvidia_driver_version": "551.52",
        "nvidia_gpu_models": "GPU 0: NVIDIA GeForce RTX 3080",
        "cudnn_version": null,
        "pip_version": "pip3",
        "pip_packages": [
            "numpy==1.26.2",
            "open-clip-torch==2.20.0",
            "pytorch-lightning==1.9.4",
            "torch==2.1.2+cu121",
            "torchdiffeq==0.2.3",
            "torchmetrics==0.11.0",
            "torchsde==0.2.6",
            "torchvision==0.16.2+cu121"
        ],
        "conda_packages": "",
        "hip_compiled_version": "N/A",
        "hip_runtime_version": "N/A",
        "miopen_runtime_version": "N/A",
        "caching_allocator_config": "",
        "is_xnnpack_available": "True",
        "cpu_info": [
            "Architecture=9",
            "CurrentClockSpeed=3901",
            "DeviceID=CPU0",
            "Family=107",
            "L2CacheSize=4096",
            "L2CacheSpeed=",
            "Manufacturer=AuthenticAMD",
            "MaxClockSpeed=3901",
            "Name=AMD Ryzen 7 3800X 8-Core Processor             ",
            "ProcessorType=3",
            "Revision=28928"
        ]
    },
    "Exceptions": [],
    "CPU": {
        "model": "AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD",
        "count logical": 16,
        "count physical": 8
    },
    "RAM": {
        "total": "64GB",
        "used": "26GB",
        "free": "38GB"
    },
```
    

### Console logs

```Shell
*** Error retrieving seed from generation info: {"prompt": "tree", "all_prompts": ["tree"], "negative_prompt": "", "all_negative_prompts": [""], "seed": 2117452332, "all_seeds": [2117452332], "subseed": 1569315522, "all_subseeds": [1569315522], "subseed_strength": 0, "width": 512, "height": 704, "sampler_name": "Euler a", "cfg_scale": 7, "steps": 20, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_name": "Soft Realistic 155 Xxx", "sd_model_hash": "48de823bb4", "sd_vae_name": null, "sd_vae_hash": null, "seed_resize_from_w": -1, "seed_resize_from_h": -1, "denoising_strength": 0.35, "extra_generation_params": {}, "index_of_first_image": 0, "infotexts": ["tree\nSteps: 20, Sampler: Euler a, CFG scale: 7, Seed: 2117452332, Size: 512x704, Model: Soft Realistic 155 Xxx, ENSD: 31337, Version: v1.8.0"], "styles": [], "job_timestamp": "20240304154958", "clip_skip": 1, "is_using_inpainting_conditioning": false, "version": "v1.8.0"}
    Traceback (most recent call last):
      File "E:\AI\A1111\modules/processing_scripts\seed.py", line 91, in copy_seed
        gen_parameters = infotext_utils.parse_generation_parameters(infotext, [])
      File "E:\AI\A1111\modules\infotext_utils.py", line 269, in parse_generation_parameters
        found_styles, prompt, negative_prompt = shared.prompt_styles.extract_styles_from_prompt(prompt, negative_prompt)
      File "E:\AI\A1111\modules\styles.py", line 218, in extract_styles_from_prompt
        is_match, new_prompt, new_neg_prompt = extract_original_prompts(
      File "E:\AI\A1111\modules\styles.py", line 70, in extract_original_prompts
        match_positive, extracted_positive = extract_style_text_from_prompt(style.prompt, prompt)
      File "E:\AI\A1111\modules\styles.py", line 45, in extract_style_text_from_prompt
        left, right = stripped_style_text.split("{prompt}", 2)
    ValueError: too many values to unpack (expected 2)

---
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.8.0
```


### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/modules/styles.py b/modules/styles.py
--- a/modules/styles.py
+++ b/modules/styles.py
@@ -42,7 +42,7 @@ def extract_style_text_from_prompt(style_text, prompt):
     stripped_style_text = style_text.strip()
 
     if "{prompt}" in stripped_style_text:
-        left, right = stripped_style_text.split("{prompt}", 2)
+        left, _, right = stripped_style_text.partition("{prompt}")
         if stripped_prompt.startswith(left) and stripped_prompt.endswith(right):
             prompt = stripped_prompt[len(left):len(stripped_prompt)-len(right)]
             return True, prompt


Test patch: