Merge remote-tracking branch 'origin/https_fix' into dev
This commit is contained in:
commit
b86972eab7
4 changed files with 16 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -53,5 +53,6 @@
|
|||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
},
|
||||
"proxy": "http://localhost:7860"
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
|
||||
<title>LangFLow</title>
|
||||
<script>
|
||||
window.sessionStorage.setItem("port","http://localhost:7860")
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import axios, { AxiosResponse } from "axios";
|
|||
const backendUrl = window.sessionStorage.getItem('port') || "http://localhost:7860";
|
||||
|
||||
export async function getAll():Promise<AxiosResponse<APIObjectType>> {
|
||||
return await axios.get(`${backendUrl}/all`);
|
||||
return await axios.get(`/all`);
|
||||
}
|
||||
|
||||
export async function sendAll(data:sendAllProps) {
|
||||
console.log(data);
|
||||
return await axios.post(`${backendUrl}/predict`, data);
|
||||
return await axios.post(`/predict`, data);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue