Merge branch 'dev' into gpt4

This commit is contained in:
Ibis Prevedello 2023-03-20 10:10:25 -03:00
commit 0ed7c4d948
6 changed files with 23 additions and 13 deletions

View file

@ -7,6 +7,9 @@ from langflow.main import create_app
import typer
from fastapi.staticfiles import StaticFiles
from pathlib import Path
import logging
logger = logging.getLogger(__name__)
def get_number_of_workers(workers=None):
@ -23,7 +26,14 @@ def replace_port(static_files_dir, host, port):
# we need to set the base url to the port that the server is running on
# so that the frontend can make requests to the backend
# This is a hacky way to do it, but it works
new_string = f'setItem("port","http://{host}:{port}")'
# Check if the host is http or https
logger.info(f"host: {host}")
logger.info(f"port: {port}")
url = f"{host}:{port}" if "http" in host else f"http://{host}:{port}"
logger.info(f"url: {url}")
new_string = f'setItem("port","{url}")'
with open(static_files_dir / "index.html", "r") as f:
index_html = f.read()
# using regex to replace the port