@bike4mind/cli 0.1.1 → 0.1.2
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.
- package/dist/{chunk-JVPB6BB5.js → chunk-B3YFSFVU.js} +24 -15
- package/dist/{chunk-LM6ZFZT6.js → chunk-KZGZGNHL.js} +1 -1
- package/dist/{chunk-CPNUKQQ3.js → chunk-TPSQ5MIR.js} +1 -1
- package/dist/{chunk-ETEFNJEP.js → chunk-XANFVWI6.js} +1 -1
- package/dist/{create-AYVZNCEH.js → create-DGRMWHIN.js} +2 -2
- package/dist/index.js +4 -4
- package/dist/{mementoService-N5HYIH4Y.js → mementoService-23ROW7I4.js} +2 -2
- package/dist/{src-GTQ5UBCP.js → src-K5MFQICX.js} +1 -1
- package/dist/{subtractCredits-22TZUVZX.js → subtractCredits-YAWCGKMX.js} +2 -2
- package/package.json +1 -1
|
@@ -8450,9 +8450,11 @@ Remember:
|
|
|
8450
8450
|
var AIImageService = class {
|
|
8451
8451
|
apiKey;
|
|
8452
8452
|
logger;
|
|
8453
|
-
|
|
8453
|
+
imageProcessorLambdaName;
|
|
8454
|
+
constructor(apiKey, logger, imageProcessorLambdaName) {
|
|
8454
8455
|
this.apiKey = apiKey;
|
|
8455
8456
|
this.logger = logger;
|
|
8457
|
+
this.imageProcessorLambdaName = imageProcessorLambdaName;
|
|
8456
8458
|
}
|
|
8457
8459
|
};
|
|
8458
8460
|
|
|
@@ -8460,9 +8462,8 @@ var AIImageService = class {
|
|
|
8460
8462
|
import OpenAI5 from "openai";
|
|
8461
8463
|
|
|
8462
8464
|
// ../../b4m-core/packages/utils/dist/src/imageGeneration/imageProcessorUtils.js
|
|
8463
|
-
import { Resource } from "sst";
|
|
8464
8465
|
import { LambdaClient, InvokeCommand } from "@aws-sdk/client-lambda";
|
|
8465
|
-
async function invokeImageProcessor(imageBuffer, maxSizeMB = 4) {
|
|
8466
|
+
async function invokeImageProcessor(imageBuffer, lambdaFunctionName, maxSizeMB = 4) {
|
|
8466
8467
|
try {
|
|
8467
8468
|
const currentSizeMB = imageBuffer.length / (1024 * 1024);
|
|
8468
8469
|
console.log(`[ImageProcessorUtils] Input size: ${currentSizeMB.toFixed(2)}MB, max: ${maxSizeMB}MB`);
|
|
@@ -8472,18 +8473,17 @@ async function invokeImageProcessor(imageBuffer, maxSizeMB = 4) {
|
|
|
8472
8473
|
return imageBuffer;
|
|
8473
8474
|
}
|
|
8474
8475
|
console.log(`[ImageProcessorUtils] Processing needed - isPng: ${isPng}, needsResize: ${currentSizeMB > maxSizeMB}`);
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
throw new Error("ImageProcessor Lambda is not available. Please check your infrastructure configuration.");
|
|
8476
|
+
if (!lambdaFunctionName) {
|
|
8477
|
+
throw new Error("ImageProcessor Lambda function name is required. Please pass the Lambda function name as an argument.");
|
|
8478
8478
|
}
|
|
8479
8479
|
const lambdaClient = new LambdaClient({});
|
|
8480
8480
|
const request = {
|
|
8481
8481
|
imageBuffer: imageBuffer.toString("base64"),
|
|
8482
8482
|
maxSizeMB
|
|
8483
8483
|
};
|
|
8484
|
-
console.log(`[ImageProcessorUtils] Invoking ImageProcessor Lambda
|
|
8484
|
+
console.log(`[ImageProcessorUtils] Invoking ImageProcessor Lambda: ${lambdaFunctionName}`);
|
|
8485
8485
|
const command = new InvokeCommand({
|
|
8486
|
-
FunctionName:
|
|
8486
|
+
FunctionName: lambdaFunctionName,
|
|
8487
8487
|
InvocationType: "RequestResponse",
|
|
8488
8488
|
Payload: JSON.stringify(request)
|
|
8489
8489
|
});
|
|
@@ -8601,7 +8601,10 @@ var OpenAIImageService = class extends AIImageService {
|
|
|
8601
8601
|
if (imagePrompt) {
|
|
8602
8602
|
console.log("RUNNING IMAGE-TO-IMAGE for ", imagePrompt);
|
|
8603
8603
|
const imageBuffer = await downloadImageAsBuffer(imagePrompt);
|
|
8604
|
-
|
|
8604
|
+
if (!this.imageProcessorLambdaName) {
|
|
8605
|
+
throw new Error("ImageProcessor Lambda name is required for image processing. Please provide it when creating the image service.");
|
|
8606
|
+
}
|
|
8607
|
+
const pngBuffer = await invokeImageProcessor(imageBuffer, this.imageProcessorLambdaName, 4);
|
|
8605
8608
|
console.log(`[DEBUG] Image prepared for image-to-image:`, {
|
|
8606
8609
|
originalUrl: imagePrompt.substring(0, 100) + "...",
|
|
8607
8610
|
pngSizeMB: (pngBuffer.length / (1024 * 1024)).toFixed(2),
|
|
@@ -8725,13 +8728,19 @@ Tip: Consider using alternative models like Flux Pro that may have different con
|
|
|
8725
8728
|
const openai = new OpenAI5({ apiKey: this.apiKey });
|
|
8726
8729
|
const cleanImageBase64 = image.replace(/^data:image\/(png|jpeg|jpg);base64,/, "");
|
|
8727
8730
|
const imageBuffer = Buffer.from(cleanImageBase64, "base64");
|
|
8728
|
-
|
|
8731
|
+
if (!this.imageProcessorLambdaName) {
|
|
8732
|
+
throw new Error("ImageProcessor Lambda name is required for image processing. Please provide it when creating the image service.");
|
|
8733
|
+
}
|
|
8734
|
+
const pngBuffer = await invokeImageProcessor(imageBuffer, this.imageProcessorLambdaName, 4);
|
|
8729
8735
|
const imageFile = new File([pngBuffer], "image.png", { type: "image/png" });
|
|
8730
8736
|
let maskFile;
|
|
8731
8737
|
if (mask) {
|
|
8732
8738
|
const cleanMaskBase64 = mask.replace(/^data:image\/(png|jpeg|jpg);base64,/, "");
|
|
8733
8739
|
const maskBuffer = Buffer.from(cleanMaskBase64, "base64");
|
|
8734
|
-
|
|
8740
|
+
if (!this.imageProcessorLambdaName) {
|
|
8741
|
+
throw new Error("ImageProcessor Lambda name is required for image processing. Please provide it when creating the image service.");
|
|
8742
|
+
}
|
|
8743
|
+
const pngMaskBuffer = await invokeImageProcessor(maskBuffer, this.imageProcessorLambdaName, 4);
|
|
8735
8744
|
maskFile = new File([pngMaskBuffer], "mask.png", { type: "image/png" });
|
|
8736
8745
|
}
|
|
8737
8746
|
console.log("[DEBUG] OpenAI Image edit request:", {
|
|
@@ -9469,16 +9478,16 @@ var GeminiImageService = class extends AIImageService {
|
|
|
9469
9478
|
};
|
|
9470
9479
|
|
|
9471
9480
|
// ../../b4m-core/packages/utils/dist/src/imageGeneration/index.js
|
|
9472
|
-
function aiImageService(vendor, apiKey, logger) {
|
|
9481
|
+
function aiImageService(vendor, apiKey, logger, imageProcessorLambdaName) {
|
|
9473
9482
|
switch (vendor) {
|
|
9474
9483
|
case "openai":
|
|
9475
|
-
return new OpenAIImageService(apiKey, logger);
|
|
9484
|
+
return new OpenAIImageService(apiKey, logger, imageProcessorLambdaName);
|
|
9476
9485
|
case "test":
|
|
9477
|
-
return new TestImageService(apiKey, logger);
|
|
9486
|
+
return new TestImageService(apiKey, logger, imageProcessorLambdaName);
|
|
9478
9487
|
case "bfl":
|
|
9479
9488
|
return new BFLImageService(apiKey, logger);
|
|
9480
9489
|
case "xai":
|
|
9481
|
-
return new XAIImageService(apiKey, logger);
|
|
9490
|
+
return new XAIImageService(apiKey, logger, imageProcessorLambdaName);
|
|
9482
9491
|
case "gemini":
|
|
9483
9492
|
return new GeminiImageService(apiKey, logger);
|
|
9484
9493
|
default:
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-KZGZGNHL.js";
|
|
6
|
+
import "./chunk-B3YFSFVU.js";
|
|
7
7
|
import "./chunk-CC67R4RB.js";
|
|
8
8
|
import "./chunk-MKO2KCCS.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-XANFVWI6.js";
|
|
8
|
+
import "./chunk-TPSQ5MIR.js";
|
|
9
|
+
import "./chunk-KZGZGNHL.js";
|
|
10
10
|
import {
|
|
11
11
|
BFLImageService,
|
|
12
12
|
BaseStorage,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
OpenAIBackend,
|
|
16
16
|
OpenAIImageService,
|
|
17
17
|
XAIImageService
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-B3YFSFVU.js";
|
|
19
19
|
import {
|
|
20
20
|
Logger
|
|
21
21
|
} from "./chunk-CC67R4RB.js";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-XANFVWI6.js";
|
|
6
|
+
import "./chunk-B3YFSFVU.js";
|
|
7
7
|
import "./chunk-CC67R4RB.js";
|
|
8
8
|
import "./chunk-MKO2KCCS.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-TPSQ5MIR.js";
|
|
6
|
+
import "./chunk-B3YFSFVU.js";
|
|
7
7
|
import "./chunk-CC67R4RB.js";
|
|
8
8
|
import "./chunk-MKO2KCCS.js";
|
|
9
9
|
import "./chunk-PDX44BCA.js";
|