Spaces:
Sleeping
Sleeping
Create frontend_modifier.py
Browse files- frontend_modifier.py +17 -0
frontend_modifier.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def modify_dashboard(dashboard_html, backend_url):
|
| 2 |
+
"""Modify dashboard HTML to interact with backend"""
|
| 3 |
+
# Update API endpoints to point to backend_url
|
| 4 |
+
modified_html = dashboard_html.replace(
|
| 5 |
+
"const API_ENDPOINT = '';",
|
| 6 |
+
f"const API_ENDPOINT = '{backend_url}';"
|
| 7 |
+
)
|
| 8 |
+
return modified_html
|
| 9 |
+
|
| 10 |
+
def modify_chat_interface(chat_interface_html, backend_url):
|
| 11 |
+
"""Modify chat interface HTML to interact with backend"""
|
| 12 |
+
# Update API endpoints to point to backend_url
|
| 13 |
+
modified_html = chat_interface_html.replace(
|
| 14 |
+
"const API_ENDPOINT = '';",
|
| 15 |
+
f"const API_ENDPOINT = '{backend_url}';"
|
| 16 |
+
)
|
| 17 |
+
return modified_html
|