We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Feature Request]: Where is the save style button?
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

Is it possible to make the old implementation of save style as well?
Not being able to save the currently typed prompt is very troublesome.
Why do we have to open the edit screen and copy/paste the prompt?

### Proposed workflow

Restore old implementation of save styles button

### Additional information

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `modules/ui_prompt_styles.py`
Content:
```
1 import gradio as gr
2 
3 from modules import shared, ui_common, ui_components, styles
4 
5 styles_edit_symbol = '\U0001f58c\uFE0F'  # 🖌️
6 styles_materialize_symbol = '\U0001f4cb'  # 📋
7 
8 
9 def select_style(name):
10     style = shared.prompt_styles.styles.get(name)
11     existing = style is not None
12     empty = not name
13 
14     prompt = style.prompt if style else gr.update()
15     negative_prompt = style.negative_prompt if style else gr.update()
16 
17     return prompt, negative_prompt, gr.update(visible=existing), gr.update(visible=not empty)
18 
19 
20 def save_style(name, prompt, negative_prompt):
21     if not name:
22         return gr.update(visible=False)
23 
24     style = styles.PromptStyle(name, prompt, negative_prompt)
25     shared.prompt_styles.styles[style.name] = style
26     shared.prompt_styles.save_styles(shared.styles_filename)
27 
28     return gr.update(visible=True)
29 
30 
31 def delete_style(name):
32     if name == "":
33         return
34 
35     shared.prompt_styles.styles.pop(name, None)
36     shared.prompt_styles.save_styles(shared.styles_filename)
37 
38     return '', '', ''
39 
40 
41 def materialize_styles(prompt, negative_prompt, styles):
42     prompt = shared.prompt_styles.apply_styles_to_prompt(prompt, styles)
43     negative_prompt = shared.prompt_styles.apply_negative_styles_to_prompt(negative_prompt, styles)
44 
45     return [gr.Textbox.update(value=prompt), gr.Textbox.update(value=negative_prompt), gr.Dropdown.update(value=[])]
46 
47 
48 def refresh_styles():
49     return gr.update(choices=list(shared.prompt_styles.styles)), gr.update(choices=list(shared.prompt_styles.styles))
50 
51 
52 class UiPromptStyles:
53     def __init__(self, tabname, main_ui_prompt, main_ui_negative_prompt):
54         self.tabname = tabname
55 
56         with gr.Row(elem_id=f"{tabname}_styles_row"):
57             self.dropdown = gr.Dropdown(label="Styles", show_label=False, elem_id=f"{tabname}_styles", choices=list(shared.prompt_styles.styles), value=[], multiselect=True, tooltip="Styles")
58             edit_button = ui_components.ToolButton(value=styles_edit_symbol, elem_id=f"{tabname}_styles_edit_button", tooltip="Edit styles")
59 
60         with gr.Box(elem_id=f"{tabname}_styles_dialog", elem_classes="popup-dialog") as styles_dialog:
61             with gr.Row():
62                 self.selection = gr.Dropdown(label="Styles", elem_id=f"{tabname}_styles_edit_select", choices=list(shared.prompt_styles.styles), value=[], allow_custom_value=True, info="Styles allow you to add custom text to prompt. Use the {prompt} token in style text, and it will be replaced with user's prompt when applying style. Otherwise, style's text will be added to the end of the prompt.")
63                 ui_common.create_refresh_button([self.dropdown, self.selection], shared.prompt_styles.reload, lambda: {"choices": list(shared.prompt_styles.styles)}, f"refresh_{tabname}_styles")
64                 self.materialize = ui_components.ToolButton(value=styles_materialize_symbol, elem_id=f"{tabname}_style_apply", tooltip="Apply all selected styles from the style selction dropdown in main UI to the prompt.")
65 
66             with gr.Row():
67                 self.prompt = gr.Textbox(label="Prompt", show_label=True, elem_id=f"{tabname}_edit_style_prompt", lines=3)
68 
69             with gr.Row():
70                 self.neg_prompt = gr.Textbox(label="Negative prompt", show_label=True, elem_id=f"{tabname}_edit_style_neg_prompt", lines=3)
71 
72             with gr.Row():
73                 self.save = gr.Button('Save', variant='primary', elem_id=f'{tabname}_edit_style_save', visible=False)
74                 self.delete = gr.Button('Delete', variant='primary', elem_id=f'{tabname}_edit_style_delete', visible=False)
75                 self.close = gr.Button('Close', variant='secondary', elem_id=f'{tabname}_edit_style_close')
76 
77         self.selection.change(
78             fn=select_style,
79             inputs=[self.selection],
80             outputs=[self.prompt, self.neg_prompt, self.delete, self.save],
81             show_progress=False,
82         )
83 
84         self.save.click(
85             fn=save_style,
86             inputs=[self.selection, self.prompt, self.neg_prompt],
87             outputs=[self.delete],
88             show_progress=False,
89         ).then(refresh_styles, outputs=[self.dropdown, self.selection], show_progress=False)
90 
91         self.delete.click(
92             fn=delete_style,
93             _js='function(name){ if(name == "") return ""; return confirm("Delete style " + name + "?") ? name : ""; }',
94             inputs=[self.selection],
95             outputs=[self.selection, self.prompt, self.neg_prompt],
96             show_progress=False,
97         ).then(refresh_styles, outputs=[self.dropdown, self.selection], show_progress=False)
98 
99         self.materialize.click(
100             fn=materialize_styles,
101             inputs=[main_ui_prompt, main_ui_negative_prompt, self.dropdown],
102             outputs=[main_ui_prompt, main_ui_negative_prompt, self.dropdown],
103             show_progress=False,
104         ).then(fn=None, _js="function(){update_"+tabname+"_tokens(); closePopup();}", show_progress=False)
105 
106         ui_common.setup_dialog(button_show=edit_button, dialog=styles_dialog, button_close=self.close)
107 
108 
109 
110 
111
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/modules/ui_prompt_styles.py b/modules/ui_prompt_styles.py
--- a/modules/ui_prompt_styles.py
+++ b/modules/ui_prompt_styles.py
@@ -4,6 +4,7 @@
 
 styles_edit_symbol = '\U0001f58c\uFE0F'  # 🖌️
 styles_materialize_symbol = '\U0001f4cb'  # 📋
+styles_copy_symbol = '\U0001f4dd'  # 📝
 
 
 def select_style(name):
@@ -62,6 +63,7 @@
                 self.selection = gr.Dropdown(label="Styles", elem_id=f"{tabname}_styles_edit_select", choices=list(shared.prompt_styles.styles), value=[], allow_custom_value=True, info="Styles allow you to add custom text to prompt. Use the {prompt} token in style text, and it will be replaced with user's prompt when applying style. Otherwise, style's text will be added to the end of the prompt.")
                 ui_common.create_refresh_button([self.dropdown, self.selection], shared.prompt_styles.reload, lambda: {"choices": list(shared.prompt_styles.styles)}, f"refresh_{tabname}_styles")
                 self.materialize = ui_components.ToolButton(value=styles_materialize_symbol, elem_id=f"{tabname}_style_apply", tooltip="Apply all selected styles from the style selction dropdown in main UI to the prompt.")
+                self.copy = ui_components.ToolButton(value=styles_copy_symbol, elem_id=f"{tabname}_style_copy", tooltip="Copy main UI prompt to style.")
 
             with gr.Row():
                 self.prompt = gr.Textbox(label="Prompt", show_label=True, elem_id=f"{tabname}_edit_style_prompt", lines=3)
@@ -103,6 +105,13 @@
             show_progress=False,
         ).then(fn=None, _js="function(){update_"+tabname+"_tokens(); closePopup();}", show_progress=False)
 
+        self.copy.click(
+            fn=lambda p, n: (p, n),
+            inputs=[main_ui_prompt, main_ui_negative_prompt],
+            outputs=[self.prompt, self.neg_prompt],
+            show_progress=False,
+        )
+
         ui_common.setup_dialog(button_show=edit_button, dialog=styles_dialog, button_close=self.close)

{"golden_diff": "diff --git a/modules/ui_prompt_styles.py b/modules/ui_prompt_styles.py\n--- a/modules/ui_prompt_styles.py\n+++ b/modules/ui_prompt_styles.py\n@@ -4,6 +4,7 @@\n \r\n styles_edit_symbol = '\\U0001f58c\\uFE0F'  # \ud83d\udd8c\ufe0f\r\n styles_materialize_symbol = '\\U0001f4cb'  # \ud83d\udccb\r\n+styles_copy_symbol = '\\U0001f4dd'  # \ud83d\udcdd\r\n \r\n \r\n def select_style(name):\r\n@@ -62,6 +63,7 @@\n                 self.selection = gr.Dropdown(label=\"Styles\", elem_id=f\"{tabname}_styles_edit_select\", choices=list(shared.prompt_styles.styles), value=[], allow_custom_value=True, info=\"Styles allow you to add custom text to prompt. Use the {prompt} token in style text, and it will be replaced with user's prompt when applying style. Otherwise, style's text will be added to the end of the prompt.\")\r\n                 ui_common.create_refresh_button([self.dropdown, self.selection], shared.prompt_styles.reload, lambda: {\"choices\": list(shared.prompt_styles.styles)}, f\"refresh_{tabname}_styles\")\r\n                 self.materialize = ui_components.ToolButton(value=styles_materialize_symbol, elem_id=f\"{tabname}_style_apply\", tooltip=\"Apply all selected styles from the style selction dropdown in main UI to the prompt.\")\r\n+                self.copy = ui_components.ToolButton(value=styles_copy_symbol, elem_id=f\"{tabname}_style_copy\", tooltip=\"Copy main UI prompt to style.\")\r\n \r\n             with gr.Row():\r\n                 self.prompt = gr.Textbox(label=\"Prompt\", show_label=True, elem_id=f\"{tabname}_edit_style_prompt\", lines=3)\r\n@@ -103,6 +105,13 @@\n             show_progress=False,\r\n         ).then(fn=None, _js=\"function(){update_\"+tabname+\"_tokens(); closePopup();}\", show_progress=False)\r\n \r\n+        self.copy.click(\r\n+            fn=lambda p, n: (p, n),\r\n+            inputs=[main_ui_prompt, main_ui_negative_prompt],\r\n+            outputs=[self.prompt, self.neg_prompt],\r\n+            show_progress=False,\r\n+        )\r\n+\r\n         ui_common.setup_dialog(button_show=edit_button, dialog=styles_dialog, button_close=self.close)\n", "issue": "[Feature Request]: Where is the save style button?\n### Is there an existing issue for this?\n\n- [X] I have searched the existing issues and checked the recent builds/commits\n\n### What would your feature do ?\n\nIs it possible to make the old implementation of save style as well?\r\nNot being able to save the currently typed prompt is very troublesome.\r\nWhy do we have to open the edit screen and copy/paste the prompt?\n\n### Proposed workflow\n\nRestore old implementation of save styles button\n\n### Additional information\n\n_No response_\n", "before_files": [{"content": "import gradio as gr\r\n\r\nfrom modules import shared, ui_common, ui_components, styles\r\n\r\nstyles_edit_symbol = '\\U0001f58c\\uFE0F'  # \ud83d\udd8c\ufe0f\r\nstyles_materialize_symbol = '\\U0001f4cb'  # \ud83d\udccb\r\n\r\n\r\ndef select_style(name):\r\n    style = shared.prompt_styles.styles.get(name)\r\n    existing = style is not None\r\n    empty = not name\r\n\r\n    prompt = style.prompt if style else gr.update()\r\n    negative_prompt = style.negative_prompt if style else gr.update()\r\n\r\n    return prompt, negative_prompt, gr.update(visible=existing), gr.update(visible=not empty)\r\n\r\n\r\ndef save_style(name, prompt, negative_prompt):\r\n    if not name:\r\n        return gr.update(visible=False)\r\n\r\n    style = styles.PromptStyle(name, prompt, negative_prompt)\r\n    shared.prompt_styles.styles[style.name] = style\r\n    shared.prompt_styles.save_styles(shared.styles_filename)\r\n\r\n    return gr.update(visible=True)\r\n\r\n\r\ndef delete_style(name):\r\n    if name == \"\":\r\n        return\r\n\r\n    shared.prompt_styles.styles.pop(name, None)\r\n    shared.prompt_styles.save_styles(shared.styles_filename)\r\n\r\n    return '', '', ''\r\n\r\n\r\ndef materialize_styles(prompt, negative_prompt, styles):\r\n    prompt = shared.prompt_styles.apply_styles_to_prompt(prompt, styles)\r\n    negative_prompt = shared.prompt_styles.apply_negative_styles_to_prompt(negative_prompt, styles)\r\n\r\n    return [gr.Textbox.update(value=prompt), gr.Textbox.update(value=negative_prompt), gr.Dropdown.update(value=[])]\r\n\r\n\r\ndef refresh_styles():\r\n    return gr.update(choices=list(shared.prompt_styles.styles)), gr.update(choices=list(shared.prompt_styles.styles))\r\n\r\n\r\nclass UiPromptStyles:\r\n    def __init__(self, tabname, main_ui_prompt, main_ui_negative_prompt):\r\n        self.tabname = tabname\r\n\r\n        with gr.Row(elem_id=f\"{tabname}_styles_row\"):\r\n            self.dropdown = gr.Dropdown(label=\"Styles\", show_label=False, elem_id=f\"{tabname}_styles\", choices=list(shared.prompt_styles.styles), value=[], multiselect=True, tooltip=\"Styles\")\r\n            edit_button = ui_components.ToolButton(value=styles_edit_symbol, elem_id=f\"{tabname}_styles_edit_button\", tooltip=\"Edit styles\")\r\n\r\n        with gr.Box(elem_id=f\"{tabname}_styles_dialog\", elem_classes=\"popup-dialog\") as styles_dialog:\r\n            with gr.Row():\r\n                self.selection = gr.Dropdown(label=\"Styles\", elem_id=f\"{tabname}_styles_edit_select\", choices=list(shared.prompt_styles.styles), value=[], allow_custom_value=True, info=\"Styles allow you to add custom text to prompt. Use the {prompt} token in style text, and it will be replaced with user's prompt when applying style. Otherwise, style's text will be added to the end of the prompt.\")\r\n                ui_common.create_refresh_button([self.dropdown, self.selection], shared.prompt_styles.reload, lambda: {\"choices\": list(shared.prompt_styles.styles)}, f\"refresh_{tabname}_styles\")\r\n                self.materialize = ui_components.ToolButton(value=styles_materialize_symbol, elem_id=f\"{tabname}_style_apply\", tooltip=\"Apply all selected styles from the style selction dropdown in main UI to the prompt.\")\r\n\r\n            with gr.Row():\r\n                self.prompt = gr.Textbox(label=\"Prompt\", show_label=True, elem_id=f\"{tabname}_edit_style_prompt\", lines=3)\r\n\r\n            with gr.Row():\r\n                self.neg_prompt = gr.Textbox(label=\"Negative prompt\", show_label=True, elem_id=f\"{tabname}_edit_style_neg_prompt\", lines=3)\r\n\r\n            with gr.Row():\r\n                self.save = gr.Button('Save', variant='primary', elem_id=f'{tabname}_edit_style_save', visible=False)\r\n                self.delete = gr.Button('Delete', variant='primary', elem_id=f'{tabname}_edit_style_delete', visible=False)\r\n                self.close = gr.Button('Close', variant='secondary', elem_id=f'{tabname}_edit_style_close')\r\n\r\n        self.selection.change(\r\n            fn=select_style,\r\n            inputs=[self.selection],\r\n            outputs=[self.prompt, self.neg_prompt, self.delete, self.save],\r\n            show_progress=False,\r\n        )\r\n\r\n        self.save.click(\r\n            fn=save_style,\r\n            inputs=[self.selection, self.prompt, self.neg_prompt],\r\n            outputs=[self.delete],\r\n            show_progress=False,\r\n        ).then(refresh_styles, outputs=[self.dropdown, self.selection], show_progress=False)\r\n\r\n        self.delete.click(\r\n            fn=delete_style,\r\n            _js='function(name){ if(name == \"\") return \"\"; return confirm(\"Delete style \" + name + \"?\") ? name : \"\"; }',\r\n            inputs=[self.selection],\r\n            outputs=[self.selection, self.prompt, self.neg_prompt],\r\n            show_progress=False,\r\n        ).then(refresh_styles, outputs=[self.dropdown, self.selection], show_progress=False)\r\n\r\n        self.materialize.click(\r\n            fn=materialize_styles,\r\n            inputs=[main_ui_prompt, main_ui_negative_prompt, self.dropdown],\r\n            outputs=[main_ui_prompt, main_ui_negative_prompt, self.dropdown],\r\n            show_progress=False,\r\n        ).then(fn=None, _js=\"function(){update_\"+tabname+\"_tokens(); closePopup();}\", show_progress=False)\r\n\r\n        ui_common.setup_dialog(button_show=edit_button, dialog=styles_dialog, button_close=self.close)\r\n\r\n\r\n\r\n\r\n", "path": "modules/ui_prompt_styles.py"}], "after_files": [{"content": "import gradio as gr\r\n\r\nfrom modules import shared, ui_common, ui_components, styles\r\n\r\nstyles_edit_symbol = '\\U0001f58c\\uFE0F'  # \ud83d\udd8c\ufe0f\r\nstyles_materialize_symbol = '\\U0001f4cb'  # \ud83d\udccb\r\nstyles_copy_symbol = '\\U0001f4dd'  # \ud83d\udcdd\r\n\r\n\r\ndef select_style(name):\r\n    style = shared.prompt_styles.styles.get(name)\r\n    existing = style is not None\r\n    empty = not name\r\n\r\n    prompt = style.prompt if style else gr.update()\r\n    negative_prompt = style.negative_prompt if style else gr.update()\r\n\r\n    return prompt, negative_prompt, gr.update(visible=existing), gr.update(visible=not empty)\r\n\r\n\r\ndef save_style(name, prompt, negative_prompt):\r\n    if not name:\r\n        return gr.update(visible=False)\r\n\r\n    style = styles.PromptStyle(name, prompt, negative_prompt)\r\n    shared.prompt_styles.styles[style.name] = style\r\n    shared.prompt_styles.save_styles(shared.styles_filename)\r\n\r\n    return gr.update(visible=True)\r\n\r\n\r\ndef delete_style(name):\r\n    if name == \"\":\r\n        return\r\n\r\n    shared.prompt_styles.styles.pop(name, None)\r\n    shared.prompt_styles.save_styles(shared.styles_filename)\r\n\r\n    return '', '', ''\r\n\r\n\r\ndef materialize_styles(prompt, negative_prompt, styles):\r\n    prompt = shared.prompt_styles.apply_styles_to_prompt(prompt, styles)\r\n    negative_prompt = shared.prompt_styles.apply_negative_styles_to_prompt(negative_prompt, styles)\r\n\r\n    return [gr.Textbox.update(value=prompt), gr.Textbox.update(value=negative_prompt), gr.Dropdown.update(value=[])]\r\n\r\n\r\ndef refresh_styles():\r\n    return gr.update(choices=list(shared.prompt_styles.styles)), gr.update(choices=list(shared.prompt_styles.styles))\r\n\r\n\r\nclass UiPromptStyles:\r\n    def __init__(self, tabname, main_ui_prompt, main_ui_negative_prompt):\r\n        self.tabname = tabname\r\n\r\n        with gr.Row(elem_id=f\"{tabname}_styles_row\"):\r\n            self.dropdown = gr.Dropdown(label=\"Styles\", show_label=False, elem_id=f\"{tabname}_styles\", choices=list(shared.prompt_styles.styles), value=[], multiselect=True, tooltip=\"Styles\")\r\n            edit_button = ui_components.ToolButton(value=styles_edit_symbol, elem_id=f\"{tabname}_styles_edit_button\", tooltip=\"Edit styles\")\r\n\r\n        with gr.Box(elem_id=f\"{tabname}_styles_dialog\", elem_classes=\"popup-dialog\") as styles_dialog:\r\n            with gr.Row():\r\n                self.selection = gr.Dropdown(label=\"Styles\", elem_id=f\"{tabname}_styles_edit_select\", choices=list(shared.prompt_styles.styles), value=[], allow_custom_value=True, info=\"Styles allow you to add custom text to prompt. Use the {prompt} token in style text, and it will be replaced with user's prompt when applying style. Otherwise, style's text will be added to the end of the prompt.\")\r\n                ui_common.create_refresh_button([self.dropdown, self.selection], shared.prompt_styles.reload, lambda: {\"choices\": list(shared.prompt_styles.styles)}, f\"refresh_{tabname}_styles\")\r\n                self.materialize = ui_components.ToolButton(value=styles_materialize_symbol, elem_id=f\"{tabname}_style_apply\", tooltip=\"Apply all selected styles from the style selction dropdown in main UI to the prompt.\")\r\n                self.copy = ui_components.ToolButton(value=styles_copy_symbol, elem_id=f\"{tabname}_style_copy\", tooltip=\"Copy main UI prompt to style.\")\r\n\r\n            with gr.Row():\r\n                self.prompt = gr.Textbox(label=\"Prompt\", show_label=True, elem_id=f\"{tabname}_edit_style_prompt\", lines=3)\r\n\r\n            with gr.Row():\r\n                self.neg_prompt = gr.Textbox(label=\"Negative prompt\", show_label=True, elem_id=f\"{tabname}_edit_style_neg_prompt\", lines=3)\r\n\r\n            with gr.Row():\r\n                self.save = gr.Button('Save', variant='primary', elem_id=f'{tabname}_edit_style_save', visible=False)\r\n                self.delete = gr.Button('Delete', variant='primary', elem_id=f'{tabname}_edit_style_delete', visible=False)\r\n                self.close = gr.Button('Close', variant='secondary', elem_id=f'{tabname}_edit_style_close')\r\n\r\n        self.selection.change(\r\n            fn=select_style,\r\n            inputs=[self.selection],\r\n            outputs=[self.prompt, self.neg_prompt, self.delete, self.save],\r\n            show_progress=False,\r\n        )\r\n\r\n        self.save.click(\r\n            fn=save_style,\r\n            inputs=[self.selection, self.prompt, self.neg_prompt],\r\n            outputs=[self.delete],\r\n            show_progress=False,\r\n        ).then(refresh_styles, outputs=[self.dropdown, self.selection], show_progress=False)\r\n\r\n        self.delete.click(\r\n            fn=delete_style,\r\n            _js='function(name){ if(name == \"\") return \"\"; return confirm(\"Delete style \" + name + \"?\") ? name : \"\"; }',\r\n            inputs=[self.selection],\r\n            outputs=[self.selection, self.prompt, self.neg_prompt],\r\n            show_progress=False,\r\n        ).then(refresh_styles, outputs=[self.dropdown, self.selection], show_progress=False)\r\n\r\n        self.materialize.click(\r\n            fn=materialize_styles,\r\n            inputs=[main_ui_prompt, main_ui_negative_prompt, self.dropdown],\r\n            outputs=[main_ui_prompt, main_ui_negative_prompt, self.dropdown],\r\n            show_progress=False,\r\n        ).then(fn=None, _js=\"function(){update_\"+tabname+\"_tokens(); closePopup();}\", show_progress=False)\r\n\r\n        self.copy.click(\r\n            fn=lambda p, n: (p, n),\r\n            inputs=[main_ui_prompt, main_ui_negative_prompt],\r\n            outputs=[self.prompt, self.neg_prompt],\r\n            show_progress=False,\r\n        )\r\n\r\n        ui_common.setup_dialog(button_show=edit_button, dialog=styles_dialog, button_close=self.close)\r\n\r\n\r\n\r\n\r\n", "path": "modules/ui_prompt_styles.py"}]}