Repository: gradio-app/gradio

Issue:
It is possible to create a PWA version of the app by using pwa=True in the launch() function. For use with FastApi, we use mount_gradio_app() instead of launch(), and it is not possible to use the "pwa" parameter.
It would be better to make it possible to use **pwa=True** with the **gr.mount_gradio_app**() function as well as with **demo.launch**().

There might be some way around this with **demo.launch**(), but if **gr.mount_gradio_app**() was introduced, then **PWA** functionality would probably need to be used with it.

Hints from issue comments:

Solution patch:
diff --git a/.changeset/common-nails-divide.md b/.changeset/common-nails-divide.md
new file mode 100644
index 000000000..90acfdb63
--- /dev/null
+++ b/.changeset/common-nails-divide.md
@@ -0,0 +1,5 @@
+---
+"gradio": patch
+---
+
+fix: Check for Node.js path only if SSR mode is true.
diff --git a/.changeset/khaki-pillows-send.md b/.changeset/khaki-pillows-send.md
new file mode 100644
index 000000000..970e954af
--- /dev/null
+++ b/.changeset/khaki-pillows-send.md
@@ -0,0 +1,6 @@
+---
+"@gradio/chatbot": patch
+"gradio": patch
+---
+
+fix:Fix Chatbot avatar image position
diff --git a/.changeset/pink-snails-arrive.md b/.changeset/pink-snails-arrive.md
new file mode 100644
index 000000000..50a36ad56
--- /dev/null
+++ b/.changeset/pink-snails-arrive.md
@@ -0,0 +1,5 @@
+---
+"gradio": minor
+---
+
+feat:Add `pwa` and `enable_monitoring` parameters to `mount_gradio_app`
diff --git a/gradio/blocks.py b/gradio/blocks.py
index 4dccd587f..78ed259a3 100644
--- a/gradio/blocks.py
+++ b/gradio/blocks.py
@@ -2556,10 +2556,10 @@ Received inputs:
                 else os.getenv("GRADIO_SSR_MODE", "False").lower() == "true"
             )
         )
-        self.node_path = os.environ.get(
-            "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
-        )
         if self.ssr_mode:
+            self.node_path = os.environ.get(
+                "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
+            )
             self.node_server_name, self.node_process, self.node_port = (
                 start_node_server(
                     server_name=node_server_name,
diff --git a/gradio/routes.py b/gradio/routes.py
index 4c9d9b40f..4f759376d 100644
--- a/gradio/routes.py
+++ b/gradio/routes.py
@@ -1646,6 +1646,8 @@ def mount_gradio_app(
     ssr_mode: bool | None = None,
     node_server_name: str | None = None,
     node_port: int | None = None,
+    enable_monitoring: bool | None = None,
+    pwa: bool | None = None,
 ) -> fastapi.FastAPI:
     """Mount a gradio.Blocks to an existing FastAPI application.
 
@@ -1695,6 +1697,9 @@ def mount_gradio_app(
     blocks.custom_mount_path = path
     blocks.server_port = server_port
     blocks.server_name = server_name
+    blocks.enable_monitoring = enable_monitoring
+    if pwa is not None:
+        blocks.pwa = pwa
 
     if auth is not None and auth_dependency is not None:
         raise ValueError(
@@ -1733,14 +1738,13 @@ def mount_gradio_app(
         )
     )
 
-    blocks.node_path = os.environ.get(
-        "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
-    )
-
-    blocks.node_server_name = node_server_name
-    blocks.node_port = node_port
-
     if blocks.ssr_mode:
+        blocks.node_path = os.environ.get(
+            "GRADIO_NODE_PATH", "" if wasm_utils.IS_WASM else get_node_path()
+        )
+
+        blocks.node_server_name = node_server_name
+        blocks.node_port = node_port
         blocks.node_server_name, blocks.node_process, blocks.node_port = (
             start_node_server(
                 server_name=blocks.node_server_name,
diff --git a/js/chatbot/shared/Message.svelte b/js/chatbot/shared/Message.svelte
index 67e8fb163..6ee2c046f 100644
--- a/js/chatbot/shared/Message.svelte
+++ b/js/chatbot/shared/Message.svelte
@@ -496,7 +496,7 @@
 		height: 100%;
 		object-fit: cover;
 		border-radius: 50%;
-		padding: 6px;
+		padding: var(--size-1-5);
 	}
 
 	.selectable {
diff --git a/js/chatbot/shared/Pending.svelte b/js/chatbot/shared/Pending.svelte
index 8bd8888f2..f3946d183 100644
--- a/js/chatbot/shared/Pending.svelte
+++ b/js/chatbot/shared/Pending.svelte
@@ -84,6 +84,14 @@
 		margin-right: var(--spacing-xxl);
 	}
 
+	.avatar-container:not(.thumbnail-item) :global(img) {
+		width: 100%;
+		height: 100%;
+		object-fit: cover;
+		border-radius: 50%;
+		padding: var(--size-1-5);
+	}
+
 	.message-content {
 		padding: var(--spacing-sm) var(--spacing-xl);
 		min-height: var(--size-8);


Test patch:
diff --git a/test/test_routes.py b/test/test_routes.py
index b4d5c66fa..dd4c51a79 100644
--- a/test/test_routes.py
+++ b/test/test_routes.py
@@ -1,6 +1,7 @@
 """Contains tests for networking.py and app.py"""
 
 import functools
+import inspect
 import json
 import os
 import pickle
@@ -1671,3 +1672,42 @@ def test_file_without_meta_key_not_moved():
             assert req.status_code == 500
     finally:
         demo.close()
+
+
+def test_mount_gradio_app_args_match_launch_args():
+    """Test that all arguments in Blocks.launch() are also valid in mount_gradio_app()."""
+    # Get the parameters from both functions
+    launch_params = inspect.signature(gr.Blocks.launch).parameters
+    mount_params = inspect.signature(routes.mount_gradio_app).parameters
+
+    # Parameters that are intentionally not included in mount_gradio_app
+    exception_list = {
+        "inline",
+        "inbrowser",
+        "prevent_thread_lock",
+        "debug",
+        "quiet",
+        "height",
+        "width",
+        "ssl_keyfile",
+        "ssl_certfile",
+        "ssl_keyfile_password",
+        "ssl_verify",
+        "share",
+        "share_server_address",
+        "share_server_protocol",
+        "state_session_capacity",
+        "_frontend",
+        "self",
+        "strict_cors",
+        "max_threads",
+    }
+
+    missing_params = []
+    for param_name in launch_params:
+        if param_name not in exception_list and param_name not in mount_params:
+            missing_params.append(param_name)
+
+    assert not missing_params, (
+        f"Parameters in launch() but missing in mount_gradio_app(): {missing_params}"
+    )