@simpleplatform/sdk 1.2.0 → 1.2.1
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/ai.js +1 -21
- package/package.json +1 -1
package/dist/ai.js
CHANGED
|
@@ -266,21 +266,6 @@ export async function transcribe(input, options, context) {
|
|
|
266
266
|
// ============================================================================
|
|
267
267
|
// Face Recognition API
|
|
268
268
|
// ============================================================================
|
|
269
|
-
let _collectionEnsured = false;
|
|
270
|
-
/**
|
|
271
|
-
* Internal helper to ensure the face collection exists before making face operations.
|
|
272
|
-
* Caches the result per Javascript isolate execution to minimize RPC overhead over
|
|
273
|
-
* sequential calls in the same logic.
|
|
274
|
-
*/
|
|
275
|
-
async function _ensureFaceCollection(context) {
|
|
276
|
-
if (_collectionEnsured)
|
|
277
|
-
return;
|
|
278
|
-
const response = await hostExecute('action:ai/face/ensure-collection', {}, context);
|
|
279
|
-
if (!response.ok) {
|
|
280
|
-
throw new Error(response.error?.message || 'Failed to ensure face collection.');
|
|
281
|
-
}
|
|
282
|
-
_collectionEnsured = true;
|
|
283
|
-
}
|
|
284
269
|
/**
|
|
285
270
|
* Enrolls a face for a subject. The face is associated with the given `subjectId`
|
|
286
271
|
* within the tenant's secure collection.
|
|
@@ -298,9 +283,7 @@ export async function enrollFace(subjectId, image, context) {
|
|
|
298
283
|
if (!image) {
|
|
299
284
|
throw new Error('The `image` parameter is required for `enrollFace`.');
|
|
300
285
|
}
|
|
301
|
-
//
|
|
302
|
-
await _ensureFaceCollection(context);
|
|
303
|
-
// Upload pending documents if given handles
|
|
286
|
+
// Upload pending DocumentHandles to ephemeral storage
|
|
304
287
|
const processedImage = await _uploadPendingFiles(image, context);
|
|
305
288
|
const payload = {
|
|
306
289
|
image: processedImage,
|
|
@@ -325,8 +308,6 @@ export async function searchFace(image, options = {}, context) {
|
|
|
325
308
|
if (!image) {
|
|
326
309
|
throw new Error('The `image` parameter is required for `searchFace`.');
|
|
327
310
|
}
|
|
328
|
-
// Ensure collection exists before searching
|
|
329
|
-
await _ensureFaceCollection(context);
|
|
330
311
|
const processedImage = await _uploadPendingFiles(image, context);
|
|
331
312
|
// Map JS property names to Elixir convention if needed, though they are passed as options
|
|
332
313
|
// and parsed correctly in simple_logic if expected.
|
|
@@ -358,7 +339,6 @@ export async function deleteFace(faceIds, context) {
|
|
|
358
339
|
if (!faceIds || !Array.isArray(faceIds) || faceIds.length === 0) {
|
|
359
340
|
throw new Error('The `faceIds` parameter must be a non-empty array for `deleteFace`.');
|
|
360
341
|
}
|
|
361
|
-
await _ensureFaceCollection(context);
|
|
362
342
|
const payload = {
|
|
363
343
|
face_ids: faceIds,
|
|
364
344
|
};
|