@lastbrain/ai-ui-core 1.0.21 → 1.0.23
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;AAkGlB,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"}
|
|
@@ -40,9 +40,12 @@ async function fetchWithRetry(url, options, retryConfig) {
|
|
|
40
40
|
* Build URL for API endpoint with proper routing
|
|
41
41
|
* For internal app (baseUrl="/api/ai"): use internal routes like /generate-text, /auth/status
|
|
42
42
|
* For external app (baseUrl="/api/lastbrain"): use proxy routes like /text-ai, /status
|
|
43
|
+
* For public API (baseUrl="/api/public/v1"): use direct public routes
|
|
43
44
|
*/
|
|
44
45
|
function buildUrl(baseUrl, endpoint) {
|
|
45
46
|
const isInternalApp = baseUrl.includes("/api/ai");
|
|
47
|
+
const isPublicApi = baseUrl.includes("/api/public/v1");
|
|
48
|
+
const isExternalProxy = baseUrl.includes("/api/lastbrain");
|
|
46
49
|
// Map endpoints for internal vs external context
|
|
47
50
|
const endpointMap = {
|
|
48
51
|
// Text and image generation
|
|
@@ -57,7 +60,9 @@ function buildUrl(baseUrl, endpoint) {
|
|
|
57
60
|
};
|
|
58
61
|
const mapping = endpointMap[endpoint];
|
|
59
62
|
if (mapping) {
|
|
60
|
-
|
|
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 ? mapping.internal : mapping.external;
|
|
61
66
|
return `${baseUrl}${finalEndpoint}`;
|
|
62
67
|
}
|
|
63
68
|
// Fallback for unmapped endpoints
|
package/package.json
CHANGED
|
@@ -73,9 +73,12 @@ async function fetchWithRetry<T>(
|
|
|
73
73
|
* Build URL for API endpoint with proper routing
|
|
74
74
|
* For internal app (baseUrl="/api/ai"): use internal routes like /generate-text, /auth/status
|
|
75
75
|
* For external app (baseUrl="/api/lastbrain"): use proxy routes like /text-ai, /status
|
|
76
|
+
* For public API (baseUrl="/api/public/v1"): use direct public routes
|
|
76
77
|
*/
|
|
77
78
|
function buildUrl(baseUrl: string, endpoint: string): string {
|
|
78
79
|
const isInternalApp = baseUrl.includes("/api/ai");
|
|
80
|
+
const isPublicApi = baseUrl.includes("/api/public/v1");
|
|
81
|
+
const isExternalProxy = baseUrl.includes("/api/lastbrain");
|
|
79
82
|
|
|
80
83
|
// Map endpoints for internal vs external context
|
|
81
84
|
const endpointMap: Record<string, { internal: string; external: string }> = {
|
|
@@ -92,7 +95,10 @@ function buildUrl(baseUrl: string, endpoint: string): string {
|
|
|
92
95
|
|
|
93
96
|
const mapping = endpointMap[endpoint];
|
|
94
97
|
if (mapping) {
|
|
95
|
-
|
|
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 ? mapping.internal : mapping.external;
|
|
96
102
|
return `${baseUrl}${finalEndpoint}`;
|
|
97
103
|
}
|
|
98
104
|
|