mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-19 08:18:48 +00:00
Merge 728919f7bf
into e6b87f89ec
This commit is contained in:
@ -377,11 +377,16 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
|||||||
const [isReady, setIsReady] = useState(false);
|
const [isReady, setIsReady] = useState(false);
|
||||||
|
|
||||||
const [isWSReady, setIsWSReady] = useState(false);
|
const [isWSReady, setIsWSReady] = useState(false);
|
||||||
const ws = useSocket(
|
|
||||||
process.env.NEXT_PUBLIC_WS_URL!,
|
let websocketUrl = process.env.NEXT_PUBLIC_WS_URL!;
|
||||||
setIsWSReady,
|
if (websocketUrl.startsWith('/')) {
|
||||||
setHasError,
|
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
||||||
);
|
const host = window.location.host;
|
||||||
|
const path = websocketUrl;
|
||||||
|
websocketUrl = `${protocol}${host}${path}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ws = useSocket(websocketUrl, setIsWSReady, setHasError);
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [messageAppeared, setMessageAppeared] = useState(false);
|
const [messageAppeared, setMessageAppeared] = useState(false);
|
||||||
|
Reference in New Issue
Block a user