Fix comfyui tool https (#11859)

This commit is contained in:
傻笑zz 2024-12-20 09:27:21 +08:00 committed by GitHub
parent 9d93ad1f16
commit 95a7e50137
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,7 +40,10 @@ class ComfyUiClient:
def open_websocket_connection(self) -> tuple[WebSocket, str]:
client_id = str(uuid.uuid4())
ws = WebSocket()
ws_address = f"ws://{self.base_url.authority}/ws?clientId={client_id}"
ws_protocol = "ws"
if self.base_url.scheme == "https":
ws_protocol = "wss"
ws_address = f"{ws_protocol}://{self.base_url.authority}/ws?clientId={client_id}"
ws.connect(ws_address)
return ws, client_id