From 683bdf762311c71226d8274fa31eed4b0c74b593 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Fri, 21 Jul 2023 00:57:35 +0300 Subject: [PATCH] Release 3.38 (#4991) * release * changelog * changelog * changelog * chatbot * remove test * Add code * add min width to submit button --------- Co-authored-by: freddyaboulton --- CHANGELOG.md | 21 +++++++++++++++++---- gradio/chat_interface.py | 5 ++++- gradio/themes/base.py | 23 +++++++++-------------- gradio/themes/default.py | 2 +- gradio/version.txt | 2 +- js/chatbot/src/static/ChatBot.svelte | 2 +- scripts/copy_demos.py | 1 + test/test_analytics.py | 10 ---------- 8 files changed, 34 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b04cf3c7c6..edc77b877a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,35 @@ # Upcoming Release +## New Features: + No changes to highlight. +## Bug Fixes: + +No changes to highlight. + +## Breaking Changes: + +No changes to highlight. + +## Other Changes: + +No changes to highlight. + +# Version 3.38 + ## New Features: - Provide a parameter `animate` (`False` by default) in `gr.make_waveform()` which animates the overlayed waveform by [@dawoodkhan82](https://github.com/dawoodkhan82) in [PR 4918](https://github.com/gradio-app/gradio/pull/4918) - Add `show_download_button` param to allow the download button in static Image components to be hidden by [@hannahblair](https://github.com/hannahblair) in [PR 4959](https://github.com/gradio-app/gradio/pull/4959) - Added autofocus argument to Textbox by [@aliabid94](https://github.com/aliabid94) in [PR 4978](https://github.com/gradio-app/gradio/pull/4978) - The `gr.ChatInterface` UI now converts the "Submit" button to a "Stop" button in ChatInterface while streaming, which can be used to pause generation. By [@abidlabs](https://github.com/abidlabs) in [PR 4971](https://github.com/gradio-app/gradio/pull/4971). +- Add a `border_color_accent_subdued` theme variable to add a subdued border color to accented items. This is used by chatbot user messages. Set the value of this variable in `Default` theme to `*primary_200`. By [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4989](https://github.com/gradio-app/gradio/pull/4989) ## Bug Fixes: - Fixes `cancels` for generators so that if a generator is canceled before it is complete, subsequent runs of the event do not continue from the previous iteration, but rather start from the beginning. By [@abidlabs](https://github.com/abidlabs) in [PR 4969](https://github.com/gradio-app/gradio/pull/4969). - Use `gr.State` in `gr.ChatInterface` to reduce latency by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4976](https://github.com/gradio-app/gradio/pull/4976) -- Add a `chatbot_user_message_border_color_accent` theme variable to control the border color of user messages in a chatbot by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4989](https://github.com/gradio-app/gradio/pull/4989). Set the value of this variable in `Default` theme to `*primary_200`. - -## Bug Fixes: - - Fix bug with `gr.Interface` where component labels inferred from handler parameters were including special args like `gr.Request` or `gr.EventData`. By [@cbensimon](https://github.com/cbensimon) in [PR 4956](https://github.com/gradio-app/gradio/pull/4956) ## Breaking Changes: diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index 87cbd86600..0c9fc3b85c 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -139,7 +139,10 @@ class ChatInterface(Blocks): submit_btn.render() elif isinstance(submit_btn, str): submit_btn = Button( - submit_btn, variant="primary", scale=1, min_width=0 + submit_btn, + variant="primary", + scale=1, + min_width=150, ) else: raise ValueError( diff --git a/gradio/themes/base.py b/gradio/themes/base.py index 93bc1d0c94..a5159301ed 100644 --- a/gradio/themes/base.py +++ b/gradio/themes/base.py @@ -487,6 +487,8 @@ class Base(ThemeClass): background_fill_secondary_dark=None, border_color_accent=None, border_color_accent_dark=None, + border_color_accent_subdued=None, + border_color_accent_subdued_dark=None, border_color_primary=None, border_color_primary_dark=None, color_accent=None, @@ -566,8 +568,6 @@ class Base(ThemeClass): # Component Atoms: These set the style for elements within components. chatbot_code_background_color=None, chatbot_code_background_color_dark=None, - chatbot_user_message_border_color_accent=None, - chatbot_user_message_border_color_accent_dark=None, checkbox_background_color=None, checkbox_background_color_dark=None, checkbox_background_color_focus=None, @@ -729,6 +729,8 @@ class Base(ThemeClass): background_fill_secondary_dark: The background primarily used for items placed on top of another item in dark mode. border_color_accent: The border color used for accented items. border_color_accent_dark: The border color used for accented items in dark mode. + border_color_accent_subdued: The subdued border color for accented items. + border_color_accent_subdued_dark: The subdued border color for accented items in dark mode. border_color_primary: The border color primarily used for items placed directly on the page. border_color_primary_dark: The border color primarily used for items placed directly on the page in dark mode. color_accent: The color used for accented items. @@ -1204,19 +1206,12 @@ class Base(ThemeClass): self.section_header_text_weight = section_header_text_weight or getattr( self, "section_header_text_weight", "400" ) - self.chatbot_user_message_border_color_accent = ( - chatbot_user_message_border_color_accent - or getattr( - self, "chatbot_user_message_border_color_accent", "*border_color_accent" - ) + self.border_color_accent_subdued = border_color_accent_subdued or getattr( + self, "border_color_accent_subdued", "*border_color_accent" ) - self.chatbot_user_message_border_color_accent_dark = ( - chatbot_user_message_border_color_accent_dark - or getattr( - self, - "chatbot_user_message_border_color_accent_dark", - "*border_color_accent", - ) + self.border_color_accent_subdued_dark = ( + border_color_accent_subdued_dark + or getattr(self, "border_color_accent_subdued_dark", "*border_color_accent") ) # Component Atoms self.chatbot_code_background_color = chatbot_code_background_color or getattr( diff --git a/gradio/themes/default.py b/gradio/themes/default.py index 0dfe6e3ebe..5861d02fdc 100644 --- a/gradio/themes/default.py +++ b/gradio/themes/default.py @@ -92,5 +92,5 @@ class Default(Base): button_cancel_border_color_dark=colors.red.c600, button_cancel_text_color=colors.red.c600, button_cancel_text_color_dark="white", - chatbot_user_message_border_color_accent="*primary_200", + border_color_accent_subdued="*primary_200", ) diff --git a/gradio/version.txt b/gradio/version.txt index c03c47aa89..4f7d6a223d 100644 --- a/gradio/version.txt +++ b/gradio/version.txt @@ -1 +1 @@ -3.37.0 +3.38.0 diff --git a/js/chatbot/src/static/ChatBot.svelte b/js/chatbot/src/static/ChatBot.svelte index 6c85d9728f..6928cbf99d 100644 --- a/js/chatbot/src/static/ChatBot.svelte +++ b/js/chatbot/src/static/ChatBot.svelte @@ -236,7 +236,7 @@ background: var(--background-fill-secondary); } .user { - border-color: var(--chatbot-user-message-border-color-accent); + border-color: var(--border-color-accent-subdued); background-color: var(--color-accent-soft); } .feedback { diff --git a/scripts/copy_demos.py b/scripts/copy_demos.py index 5c959975c9..1ed67a31cf 100644 --- a/scripts/copy_demos.py +++ b/scripts/copy_demos.py @@ -19,6 +19,7 @@ def copy_all_demos(source_dir: str, dest_dir: str): "calculator", "cancel_events", "chatbot_multimodal", + "chatinterface_streaming_echo", "clear_components", "code", "fake_gan", diff --git a/test/test_analytics.py b/test/test_analytics.py index 214267256b..d8b88a38d8 100644 --- a/test/test_analytics.py +++ b/test/test_analytics.py @@ -27,16 +27,6 @@ class TestAnalytics: == "unable to parse version details from package URL." ) - @mock.patch("requests.Response.json") - def test_should_warn_url_not_having_version(self, mock_json, monkeypatch): - monkeypatch.setenv("GRADIO_ANALYTICS_ENABLED", "True") - mock_json.return_value = {"foo": "bar"} - - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - analytics.version_check() - assert str(w[-1].message) == "package URL does not contain version info." - @mock.patch("requests.post") def test_error_analytics_doesnt_crash_on_connection_error( self, mock_post, monkeypatch