@lastbrain/ai-ui-core 1.0.20 → 1.0.22
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;AA+FlB,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,11 @@ 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");
|
|
46
48
|
// Map endpoints for internal vs external context
|
|
47
49
|
const endpointMap = {
|
|
48
50
|
// Text and image generation
|
|
@@ -57,7 +59,8 @@ function buildUrl(baseUrl, endpoint) {
|
|
|
57
59
|
};
|
|
58
60
|
const mapping = endpointMap[endpoint];
|
|
59
61
|
if (mapping) {
|
|
60
|
-
|
|
62
|
+
// For public API, treat as external (use proxy-style routes)
|
|
63
|
+
const finalEndpoint = (isInternalApp && !isPublicApi) ? mapping.internal : mapping.external;
|
|
61
64
|
return `${baseUrl}${finalEndpoint}`;
|
|
62
65
|
}
|
|
63
66
|
// Fallback for unmapped endpoints
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface AiTextRequest {
|
|
|
21
21
|
temperature?: number;
|
|
22
22
|
promptId?: string;
|
|
23
23
|
actionType?: "generate-text" | "generate-recipe-text" | "autocomplete";
|
|
24
|
+
storeOutputs?: boolean;
|
|
25
|
+
artifactTitle?: string;
|
|
24
26
|
}
|
|
25
27
|
export interface AiTextResponse {
|
|
26
28
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,M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AE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/package.json
CHANGED
|
@@ -73,9 +73,11 @@ 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");
|
|
79
81
|
|
|
80
82
|
// Map endpoints for internal vs external context
|
|
81
83
|
const endpointMap: Record<string, { internal: string; external: string }> = {
|
|
@@ -92,7 +94,8 @@ function buildUrl(baseUrl: string, endpoint: string): string {
|
|
|
92
94
|
|
|
93
95
|
const mapping = endpointMap[endpoint];
|
|
94
96
|
if (mapping) {
|
|
95
|
-
|
|
97
|
+
// For public API, treat as external (use proxy-style routes)
|
|
98
|
+
const finalEndpoint = (isInternalApp && !isPublicApi) ? mapping.internal : mapping.external;
|
|
96
99
|
return `${baseUrl}${finalEndpoint}`;
|
|
97
100
|
}
|
|
98
101
|
|
package/src/types/index.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface AiTextRequest {
|
|
|
22
22
|
temperature?: number;
|
|
23
23
|
promptId?: string; // Track which prompt was used
|
|
24
24
|
actionType?: "generate-text" | "generate-recipe-text" | "autocomplete"; // Billing action type
|
|
25
|
+
storeOutputs?: boolean; // Whether to store outputs in database
|
|
26
|
+
artifactTitle?: string; // Title for stored artifacts
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export interface AiTextResponse {
|