From 499d5238e31469ca74ea73d437c8ac1276c527a3 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 15 Jun 2023 14:52:26 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20refactor(chatModal):=20remove=20?= =?UTF-8?q?unused=20function=20getWebSocketUrl=20The=20function=20getWebSo?= =?UTF-8?q?cketUrl=20was=20not=20being=20used=20in=20the=20code=20and=20wa?= =?UTF-8?q?s=20therefore=20removed=20to=20improve=20code=20readability=20a?= =?UTF-8?q?nd=20maintainability.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/modals/chatModal/index.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/frontend/src/modals/chatModal/index.tsx b/src/frontend/src/modals/chatModal/index.tsx index 670e66202..428bda5f3 100644 --- a/src/frontend/src/modals/chatModal/index.tsx +++ b/src/frontend/src/modals/chatModal/index.tsx @@ -1,9 +1,9 @@ import { Dialog, Transition } from "@headlessui/react"; import { ChatBubbleOvalLeftEllipsisIcon } from "@heroicons/react/24/outline"; import { Fragment, useContext, useEffect, useRef, useState } from "react"; -import { FlowType, NodeType } from "../../types/flow"; +import { FlowType } from "../../types/flow"; import { alertContext } from "../../contexts/alertContext"; -import { toNormalCase, validateNodes } from "../../utils"; +import { validateNodes } from "../../utils"; import { typesContext } from "../../contexts/typesContext"; import ChatMessage from "./chatMessage"; import { FaEraser } from "react-icons/fa"; @@ -174,16 +174,6 @@ export default function ChatModal({ updateLastMessage({ str: data.message }); } } - 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 connectWS() { try {