From a62d50a011924aed8d807da7ce43ca07fa090291 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 15 Jun 2023 15:46:53 -0300 Subject: [PATCH 1/2] feat: Add error message for invalid nodes in BuildTrigger --- .../src/components/chatComponent/buildTrigger/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/frontend/src/components/chatComponent/buildTrigger/index.tsx b/src/frontend/src/components/chatComponent/buildTrigger/index.tsx index 228cdc453..2fed77529 100644 --- a/src/frontend/src/components/chatComponent/buildTrigger/index.tsx +++ b/src/frontend/src/components/chatComponent/buildTrigger/index.tsx @@ -46,6 +46,12 @@ export default function BuildTrigger({ const allNodesValid = await streamNodeData(flow); await enforceMinimumLoadingTime(startTime, minimumLoadingTime); setIsBuilt(allNodesValid); + if(!allNodesValid) { + setErrorData({ + title: "Oops! Looks like you missed something", + list: ["Check nodes and retry. Hover over 🔴 node for status."], + }); + } } catch (error) { console.error("Error:", error); } finally { From 3653f5eefcd558e2f767c420cde3c464a6ed4a36 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 15 Jun 2023 15:53:56 -0300 Subject: [PATCH 2/2] feat(chatModal): add getWebSocketUrl function to generate WebSocket URL based on chatId and environment This commit adds a new function called getWebSocketUrl to the ChatModal component. This function generates a WebSocket URL based on the chatId and environment. It determines whether to use the "ws" or "wss" protocol based on whether the current protocol is secure or not. It also determines the host based on whether the environment is development or production. This function will be used to establish a WebSocket connection to the server. --- src/frontend/src/modals/chatModal/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/frontend/src/modals/chatModal/index.tsx b/src/frontend/src/modals/chatModal/index.tsx index 428bda5f3..7c4a9e5db 100644 --- a/src/frontend/src/modals/chatModal/index.tsx +++ b/src/frontend/src/modals/chatModal/index.tsx @@ -111,6 +111,17 @@ export default function ChatModal({ } } + function getWebSocketUrl(chatId, isDevelopment = false) { + const isSecureProtocol = window.location.protocol === "https:"; + const webSocketProtocol = isSecureProtocol ? "wss" : "ws"; + const host = isDevelopment ? "localhost:7860" : window.location.host; + const chatEndpoint = `/api/v1/chat/${chatId}`; + + return `${ + isDevelopment ? "ws" : webSocketProtocol + }://${host}${chatEndpoint}`; + } + function handleWsMessage(data: any) { if (Array.isArray(data)) { //set chat history