fciannella commited on
Commit
12cfb7b
·
1 Parent(s): b246683

Support for https due to CORS issues

Browse files
examples/voice_agent_webrtc_langgraph/ui/src/config.ts CHANGED
@@ -2,12 +2,12 @@
2
  // SPDX-License-Identifier: BSD 2-Clause License
3
 
4
  export const RTC_CONFIG = {};
 
 
5
 
6
- const host = window.location.hostname;
7
-
8
- export const RTC_OFFER_URL = `ws://${host}:7860/ws`;
9
- export const POLL_PROMPT_URL = `http://${host}:7860/get_prompt`;
10
- export const ASSISTANTS_URL = `http://${host}:7860/assistants`;
11
 
12
  // Set to true to use dynamic prompt mode, false for default mode
13
  export const DYNAMIC_PROMPT = false;
 
2
  // SPDX-License-Identifier: BSD 2-Clause License
3
 
4
  export const RTC_CONFIG = {};
5
+ const { protocol, host } = window.location;
6
+ const wsProto = protocol === "https:" ? "wss" : "ws";
7
 
8
+ export const RTC_OFFER_URL = `${wsProto}://${host}/ws`;
9
+ export const POLL_PROMPT_URL = `/get_prompt`;
10
+ export const ASSISTANTS_URL = `/assistants`;
 
 
11
 
12
  // Set to true to use dynamic prompt mode, false for default mode
13
  export const DYNAMIC_PROMPT = false;