diff --git a/ui/src/stores/modules/application.ts b/ui/src/stores/modules/application.ts index 0709b2e293a..470abef82d8 100644 --- a/ui/src/stores/modules/application.ts +++ b/ui/src/stores/modules/application.ts @@ -1,9 +1,18 @@ import { defineStore } from 'pinia' const useApplicationStore = defineStore('application', { state: () => ({ - location: `${window.location.origin}${window.MaxKB.chatPrefix ? window.MaxKB.chatPrefix : window.MaxKB.prefix}/`, + location: `${getChatOrigin()}${ + window.MaxKB.chatPrefix ? window.MaxKB.chatPrefix : window.MaxKB.prefix + }/`, }), actions: {}, }) +function getChatOrigin() { + if (import.meta.env.DEV && window.location.port === '3000') { + return `${window.location.protocol}//${window.location.hostname}:3001` + } + return window.location.origin +} + export default useApplicationStore