diff --git a/css/html_instruct_style.css b/css/html_instruct_style.css index dcc19c29..fcd0558f 100644 --- a/css/html_instruct_style.css +++ b/css/html_instruct_style.css @@ -48,12 +48,14 @@ .chat .user-message { background: #f4f4f4; padding: 1.5rem 1rem; + padding-bottom: 2rem; border-radius: 0; border-bottom-right-radius: 0; } .chat .assistant-message { padding: 1.5rem 1rem; + padding-bottom: 2rem; border-radius: 0; border: 0; } diff --git a/css/main.css b/css/main.css index 9d99a876..48c6727a 100644 --- a/css/main.css +++ b/css/main.css @@ -1142,7 +1142,6 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* { } .dark svg { - fill: white; color: white; } @@ -1221,3 +1220,55 @@ div.svelte-362y77>*, div.svelte-362y77>.form>* { background: var(--light-theme-gray); } } + +/* ---------------------------------------------- + Copy button for chat messages +---------------------------------------------- */ +.message .text, +.message .text-you, +.message .text-bot, +.user-message .text, +.assistant-message .text { + position: relative; +} + +.message, .user-message, .assistant-message { + position: relative; +} + +.copy-button { + position: absolute; + bottom: -23px; + left: 0; + padding: 0; + border: none; + border-radius: 3px; + cursor: pointer; + opacity: 0; + display: flex; + align-items: center; + transition: opacity 0.2s; +} + +.message:hover .copy-button, +.user-message:hover .copy-button, +.assistant-message:hover .copy-button { + opacity: 1; +} + +.copy-button svg { + stroke: rgb(156 163 175); + transition: stroke 0.2s; +} + +.copy-button:hover svg { + stroke: rgb(107 114 128); +} + +.dark .copy-button svg { + stroke: rgb(156 163 175); +} + +.dark .copy-button:hover svg { + stroke: rgb(209 213 219); +} diff --git a/modules/block_requests.py b/modules/block_requests.py index 35f983cf..29fc6633 100644 --- a/modules/block_requests.py +++ b/modules/block_requests.py @@ -3,7 +3,7 @@ import io import requests -from modules import shared +from modules import shared, ui from modules.logging_colors import logger original_open = open @@ -58,6 +58,7 @@ def my_open(*args, **kwargs): '\n ' f'\n ' '\n ' + f'\n ' '\n ' ) diff --git a/modules/html_generator.py b/modules/html_generator.py index e3550ed5..b565c63a 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -292,24 +292,34 @@ def get_image_cache(path): return image_cache[path][1] +copy_svg = '''''' +copy_button = f'' + def generate_instruct_html(history): output = f'