🔥 refactor(chatModal): remove unused function getWebSocketUrl

The function getWebSocketUrl was not being used in the code and was therefore removed to improve code readability and maintainability.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-15 14:52:26 -03:00
commit 499d5238e3

View file

@ -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 {