This commit is contained in:
@@ -9,7 +9,7 @@ const defaultSdkTimeoutMs = 5000
|
||||
const defaultApiBaseUrl = '/app-api'
|
||||
const defaultSgsMapId = '1'
|
||||
const defaultGuideStaticDataBaseUrl = '/static/guide-data'
|
||||
const defaultAudioApiBaseUrl = '/yudao-server'
|
||||
const defaultAudioApiBaseUrl = '/app-api'
|
||||
|
||||
const normalizeMode = (mode: string | undefined): DataSourceMode => {
|
||||
if (mode && allowedModes.has(mode as DataSourceMode)) {
|
||||
@@ -24,9 +24,13 @@ const normalizeGuideContentMode = (mode: string | undefined): GuideContentDataSo
|
||||
return mode as GuideContentDataSourceMode
|
||||
}
|
||||
|
||||
return 'static'
|
||||
return 'remote'
|
||||
}
|
||||
|
||||
const normalizeBoolean = (value: string | undefined) => (
|
||||
['1', 'true', 'yes', 'on'].includes(value?.trim().toLowerCase() || '')
|
||||
)
|
||||
|
||||
const normalizeUrl = (url: string | undefined, fallback: string) => {
|
||||
const normalized = url?.trim()
|
||||
return normalized || fallback
|
||||
@@ -50,6 +54,8 @@ const inferOrigin = (url: string) => {
|
||||
export const dataSourceConfig = {
|
||||
mode: normalizeMode(import.meta.env.VITE_DATA_SOURCE_MODE),
|
||||
guideContentMode: normalizeGuideContentMode(import.meta.env.VITE_GUIDE_CONTENT_SOURCE_MODE),
|
||||
allowExplainStaticFallback: import.meta.env.DEV
|
||||
&& normalizeBoolean(import.meta.env.VITE_EXPLAIN_ALLOW_STATIC_FALLBACK),
|
||||
guideStaticDataBaseUrl: normalizeUrl(
|
||||
import.meta.env.VITE_GUIDE_STATIC_DATA_BASE_URL,
|
||||
defaultGuideStaticDataBaseUrl
|
||||
|
||||
Reference in New Issue
Block a user