allow overriding Core API URL

This commit is contained in:
josc146
2023-12-12 22:37:36 +08:00
parent 0c796c8cfc
commit b8f8837a8f
9 changed files with 27 additions and 7 deletions

View File

@@ -303,7 +303,11 @@ export function bytesToReadable(size: number) {
else return bytesToGb(size) + ' GB';
}
export function getServerRoot(defaultLocalPort: number) {
export function getServerRoot(defaultLocalPort: number, isCore: boolean = false) {
const coreCustomApiUrl = commonStore.settings.coreApiUrl.trim().replace(/\/$/, '');
if (isCore && coreCustomApiUrl)
return coreCustomApiUrl;
const defaultRoot = `http://127.0.0.1:${defaultLocalPort}`;
if (commonStore.status.status !== ModelStatus.Offline)
return defaultRoot;