update make file to prevent binding bug on make frontend (#694)

This pull request addresses a critical issue related to a binding bug
that has been affecting the make_frontend command. The existing Makefile
was susceptible to this bug, causing unexpected behaviors and
disruptions during the build process.
This commit is contained in:
anovazzi1 2023-08-16 17:40:35 -03:00 committed by GitHub
commit 826c62c6fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 4 deletions

View file

@ -32,7 +32,10 @@ lint:
poetry run ruff . --fix
install_frontend:
cd src/frontend && npm install
cd src/frontend && npm install;
install_frontendc:
cd src/frontend && npm ci;
run_frontend:
cd src/frontend && npm start
@ -40,6 +43,10 @@ run_frontend:
frontend:
make install_frontend
make run_frontend
frontendc:
make install_frontendc
make run_frontend
install_backend:
poetry install

View file

@ -49,7 +49,13 @@ const ApiModal = forwardRef(
const pythonCode = getPythonCode(flow, tweak.current, tabsState);
const widgetCode = getWidgetCode(flow, tabsState);
const tweaksCode = buildTweaks(flow);
const codesArray = [curl_code, pythonApiCode, pythonCode, widgetCode, pythonCode];
const codesArray = [
curl_code,
pythonApiCode,
pythonCode,
widgetCode,
pythonCode,
];
const [tabs, setTabs] = useState(tabsArray(codesArray, 0));
function startState() {

View file

@ -160,7 +160,8 @@ export default function FormModal({
}
function getWebSocketUrl(chatId, isDevelopment = false) {
const isSecureProtocol = window.location.protocol === "https:" || window.location.port === "443";
const isSecureProtocol =
window.location.protocol === "https:" || window.location.port === "443";
const webSocketProtocol = isSecureProtocol ? "wss" : "ws";
const host = isDevelopment ? "localhost:7860" : window.location.host;
const chatEndpoint = `/api/v1/chat/${chatId}`;

View file

@ -6,7 +6,7 @@ const apiRoutes = ["^/api/v1/", "/health"];
// Use environment variable to determine the target.
const target = process.env.VITE_PROXY_TARGET || "http://127.0.0.1:7860";
// Use environment variable to determine the UI server port
// Use environment variable to determine the UI server port
const port = process.env.VITE_PORT || 3000;
const proxyTargets = apiRoutes.reduce((proxyObj, route) => {