@lastbrain/ai-ui-core 1.0.11 → 1.0.12
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":"enhanced-gateway.d.ts","sourceRoot":"","sources":["../../../src/route-handlers/nextjs/enhanced-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"enhanced-gateway.d.ts","sourceRoot":"","sources":["../../../src/route-handlers/nextjs/enhanced-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAmJxD,wBAAsB,GAAG,CACvB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD;AAED,wBAAsB,GAAG,CACvB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,8BAGjD"}
|
|
@@ -17,6 +17,10 @@ if (!LB_API_KEY) {
|
|
|
17
17
|
function mapAuthRouteToPublicRoute(path) {
|
|
18
18
|
// Remove leading 'ai/' if present
|
|
19
19
|
const cleanPath = path.startsWith("ai/") ? path.slice(3) : path;
|
|
20
|
+
// Si le path contient déjà api/public/v1, le retourner tel quel
|
|
21
|
+
if (cleanPath.includes("api/public/v1")) {
|
|
22
|
+
return cleanPath;
|
|
23
|
+
}
|
|
20
24
|
// Route mapping for auth routes -> public routes
|
|
21
25
|
const routeMappings = {
|
|
22
26
|
// Prompts
|
|
@@ -32,8 +36,8 @@ function mapAuthRouteToPublicRoute(path) {
|
|
|
32
36
|
// Image generation
|
|
33
37
|
"auth/generate-image": "api/public/v1/image-ai",
|
|
34
38
|
// Status and provider (with and without public prefix)
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
status: "api/public/v1/status",
|
|
40
|
+
provider: "api/public/v1/provider",
|
|
37
41
|
"public/gateway-models": "api/public/v1/provider",
|
|
38
42
|
"public/status": "api/public/v1/status",
|
|
39
43
|
};
|
|
@@ -47,7 +51,7 @@ function mapAuthRouteToPublicRoute(path) {
|
|
|
47
51
|
return target + cleanPath.slice(pattern.length);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
// Default:
|
|
54
|
+
// Default: if already a public route, return as-is
|
|
51
55
|
if (cleanPath.startsWith("api/public/")) {
|
|
52
56
|
return cleanPath;
|
|
53
57
|
}
|
package/package.json
CHANGED
|
@@ -24,6 +24,11 @@ function mapAuthRouteToPublicRoute(path: string): string {
|
|
|
24
24
|
// Remove leading 'ai/' if present
|
|
25
25
|
const cleanPath = path.startsWith("ai/") ? path.slice(3) : path;
|
|
26
26
|
|
|
27
|
+
// Si le path contient déjà api/public/v1, le retourner tel quel
|
|
28
|
+
if (cleanPath.includes("api/public/v1")) {
|
|
29
|
+
return cleanPath;
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
// Route mapping for auth routes -> public routes
|
|
28
33
|
const routeMappings: Record<string, string> = {
|
|
29
34
|
// Prompts
|
|
@@ -43,8 +48,8 @@ function mapAuthRouteToPublicRoute(path: string): string {
|
|
|
43
48
|
"auth/generate-image": "api/public/v1/image-ai",
|
|
44
49
|
|
|
45
50
|
// Status and provider (with and without public prefix)
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
status: "api/public/v1/status",
|
|
52
|
+
provider: "api/public/v1/provider",
|
|
48
53
|
"public/gateway-models": "api/public/v1/provider",
|
|
49
54
|
"public/status": "api/public/v1/status",
|
|
50
55
|
};
|
|
@@ -61,7 +66,7 @@ function mapAuthRouteToPublicRoute(path: string): string {
|
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
// Default:
|
|
69
|
+
// Default: if already a public route, return as-is
|
|
65
70
|
if (cleanPath.startsWith("api/public/")) {
|
|
66
71
|
return cleanPath;
|
|
67
72
|
}
|