Skip to content

Commit b250f76

Browse files
authored
Merge pull request #57 from logspace-ai/dev
Release 0.0.45
2 parents 15a5e99 + d8c1eac commit b250f76

File tree

2 files changed

+1
-40
lines changed

2 files changed

+1
-40
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "langflow"
3-
version = "0.0.44"
3+
version = "0.0.45"
44
description = "A Python package with a built-in web application"
55
authors = ["Logspace <contact@logspace.ai>"]
66
packages = [

src/backend/langflow/__main__.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,6 @@ def get_number_of_workers(workers=None):
1818
return workers
1919

2020

21-
def replace_port(static_files_dir, host, port):
22-
# Load index.html from frontend directory
23-
# In it there is a script tag that sets the base url
24-
# like so setItem("port", "http://localhost:7860")
25-
# localhost could be anything so we need to verify for string
26-
# we need to set the base url to the port that the server is running on
27-
# so that the frontend can make requests to the backend
28-
# This is a hacky way to do it, but it works
29-
30-
# Check if the host is http or https
31-
logger.info(f"host: {host}")
32-
logger.info(f"port: {port}")
33-
url = f"{host}:{port}" if "http" in host else f"http://{host}:{port}"
34-
logger.info(f"url: {url}")
35-
new_string = f'setItem("port","{url}")'
36-
37-
with open(static_files_dir / "index.html", "r") as f:
38-
index_html = f.read()
39-
# using regex to replace the port
40-
index_html = re.sub(
41-
r"setItem\(\"port\",.*\)",
42-
new_string,
43-
index_html,
44-
)
45-
with open(static_files_dir / "index.html", "w") as f:
46-
f.write(index_html)
47-
# Verify that the port was replaced
48-
with open(static_files_dir / "index.html", "r") as f:
49-
index_html = f.read()
50-
if new_string not in index_html:
51-
raise ValueError(
52-
"The port was not replaced in index.html. "
53-
"Please check the regex in main.py"
54-
)
55-
56-
5721
def serve(
5822
host: str = "127.0.0.1", workers: int = 1, timeout: int = 60, port: int = 7860
5923
):
@@ -73,9 +37,6 @@ def serve(
7337
"timeout": timeout,
7438
}
7539

76-
# Replace the port in index.html
77-
replace_port(static_files_dir, host, port)
78-
7940
if platform.system() in ["Darwin", "Windows"]:
8041
# Run using uvicorn on MacOS and Windows
8142
# Windows doesn't support gunicorn

0 commit comments

Comments
 (0)