@lastbrain/ai-ui-core 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/client/createClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,QAAQ,EACT,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/client/createClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,QAAQ,EACT,MAAM,UAAU,CAAC;AAoGlB,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY;qBAsBnB,OAAO,CAAC,QAAQ,EAAE,CAAC;wBAqCd,aAAa,KAAG,OAAO,CAAC,cAAc,CAAC;yBAoCtC,cAAc,KAAG,OAAO,CAAC,eAAe,CAAC;iBAqDjD,cAAc,KAAG,OAAO,CAAC,eAAe,CAAC;qBAkBvC,OAAO,CAAC,QAAQ,CAAC;EAyB9C"}
|
|
@@ -45,6 +45,7 @@ async function fetchWithRetry(url, options, retryConfig) {
|
|
|
45
45
|
function buildUrl(baseUrl, endpoint) {
|
|
46
46
|
const isInternalApp = baseUrl.includes("/api/ai");
|
|
47
47
|
const isPublicApi = baseUrl.includes("/api/public/v1");
|
|
48
|
+
const isExternalProxy = baseUrl.includes("/api/lastbrain");
|
|
48
49
|
// Map endpoints for internal vs external context
|
|
49
50
|
const endpointMap = {
|
|
50
51
|
// Text and image generation
|
|
@@ -59,8 +60,11 @@ function buildUrl(baseUrl, endpoint) {
|
|
|
59
60
|
};
|
|
60
61
|
const mapping = endpointMap[endpoint];
|
|
61
62
|
if (mapping) {
|
|
62
|
-
// For public API,
|
|
63
|
-
|
|
63
|
+
// For public API or external proxy, use external routes (without /auth/ prefix)
|
|
64
|
+
// Only internal app uses internal routes (with /auth/ prefix)
|
|
65
|
+
const finalEndpoint = isInternalApp && !isPublicApi && !isExternalProxy
|
|
66
|
+
? mapping.internal
|
|
67
|
+
: mapping.external;
|
|
64
68
|
return `${baseUrl}${finalEndpoint}`;
|
|
65
69
|
}
|
|
66
70
|
// Fallback for unmapped endpoints
|
package/package.json
CHANGED
|
@@ -78,6 +78,7 @@ async function fetchWithRetry<T>(
|
|
|
78
78
|
function buildUrl(baseUrl: string, endpoint: string): string {
|
|
79
79
|
const isInternalApp = baseUrl.includes("/api/ai");
|
|
80
80
|
const isPublicApi = baseUrl.includes("/api/public/v1");
|
|
81
|
+
const isExternalProxy = baseUrl.includes("/api/lastbrain");
|
|
81
82
|
|
|
82
83
|
// Map endpoints for internal vs external context
|
|
83
84
|
const endpointMap: Record<string, { internal: string; external: string }> = {
|
|
@@ -94,8 +95,12 @@ function buildUrl(baseUrl: string, endpoint: string): string {
|
|
|
94
95
|
|
|
95
96
|
const mapping = endpointMap[endpoint];
|
|
96
97
|
if (mapping) {
|
|
97
|
-
// For public API,
|
|
98
|
-
|
|
98
|
+
// For public API or external proxy, use external routes (without /auth/ prefix)
|
|
99
|
+
// Only internal app uses internal routes (with /auth/ prefix)
|
|
100
|
+
const finalEndpoint =
|
|
101
|
+
isInternalApp && !isPublicApi && !isExternalProxy
|
|
102
|
+
? mapping.internal
|
|
103
|
+
: mapping.external;
|
|
99
104
|
return `${baseUrl}${finalEndpoint}`;
|
|
100
105
|
}
|
|
101
106
|
|