@sogni-ai/sogni-intelligence-client 4.7.1 → 4.7.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/public-skill-runtime/index.d.ts +1 -2
- package/dist/public-skill-runtime/index.d.ts.map +1 -1
- package/dist/public-skill-runtime/index.js +3 -71
- package/dist/public-skill-runtime/index.js.map +1 -1
- package/dist/tools/shared/promptSanitizer.d.ts.map +1 -1
- package/dist/tools/shared/promptSanitizer.js +1 -67
- package/dist/tools/shared/promptSanitizer.js.map +1 -1
- package/dist-esm/public-skill-runtime/index.js +1 -69
- package/dist-esm/public-skill-runtime/index.js.map +1 -1
- package/dist-esm/tools/shared/promptSanitizer.js +1 -67
- package/dist-esm/tools/shared/promptSanitizer.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptSanitizer.d.ts","sourceRoot":"","sources":["../../../src/tools/shared/promptSanitizer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promptSanitizer.d.ts","sourceRoot":"","sources":["../../../src/tools/shared/promptSanitizer.ts"],"names":[],"mappings":"AAOA,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
|
@@ -1,73 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sanitizeBatchPrompt = sanitizeBatchPrompt;
|
|
4
|
-
const GRID_PATTERNS = [
|
|
5
|
-
/\b(?:different|various|varying|multiple|several|many|diverse|assorted|all|range of|variety of|array of|series of|set of|collection of)\s+(?:facial\s+)?(?:expressions?|poses?|angles?|versions?|variations?|looks?|smiles?|moods?|emotions?|faces?|views?|shots?|styles?|options?|takes?|scenes?|settings?|environments?|worlds?)\b/gi,
|
|
6
|
-
/\b\d+\s+(?:completely\s+|totally\s+|very\s+)?(?:different|unique|distinct|varying|varied|separate|individual)?\s*(?:facial\s+)?(?:expressions?|poses?|angles?|versions?|variations?|looks?|smiles?|moods?|emotions?|faces?|views?|shots?|styles?|options?|takes?|images?|photos?|pictures?|portraits?|copies|duplicates|scenes?|settings?|environments?|worlds?)\b/gi,
|
|
7
|
-
/\b(?:grid|collage|montage|composite|triptych|diptych|side[- ]by[- ]side|side[- ]to[- ]side|split[- ]?screen|photo[- ]?sheet|contact[- ]?sheet|mood[- ]?board|lineup|line[- ]?up|tile[ds]?|tiling|rows?\s+(?:of|and)\s+columns?|columns?\s+(?:of|and)\s+rows?)\b/gi,
|
|
8
|
-
/\beach\s+(?:with|showing|featuring|displaying|having|in)\s+(?:a\s+)?(?:different|unique|distinct|its own)\b/gi,
|
|
9
|
-
/\beach\s+(?:one|version|variation|image|copy)\b/gi,
|
|
10
|
-
/\b(?:show|display|create|generate|make|render|produce)\s+(?:multiple|different|various|several|all)\b/gi,
|
|
11
|
-
/\b(?:switch(?:ing)?|mix(?:ing)?)\s+up\b/gi,
|
|
12
|
-
/\b\d+\s+of\s+(?:them|these|those)\b/gi,
|
|
13
|
-
/\b(?:multiple|several|many)\s+(?:copies|duplicates|instances|repeats)\b/gi,
|
|
14
|
-
/\b\d+\s+(?:versions?|variations?|renditions?|interpretations?|depictions?|iterations?)\b/gi,
|
|
15
|
-
/\b(?:repeated|repeating|repeat)\s+\d*\s*(?:times?)?\b/gi,
|
|
16
|
-
/\b(?:put|place|fit|arrange)\s+(?:them|these|those|it)\s+(?:all\s+)?(?:together|into one|in one)\b/gi,
|
|
17
|
-
/\ball\s+(?:together|in\s+one\s+(?:image|frame|picture|photo))\b/gi,
|
|
18
|
-
];
|
|
19
|
-
const SINGULARIZE_PATTERNS = [
|
|
20
|
-
[
|
|
21
|
-
/\b(create|generate|make|render|produce)\s+\d+\s+(?:completely\s+|totally\s+|very\s+)?(?:different|unique|distinct|varying|varied|separate|individual)?\s*(scenes?|settings?|environments?|worlds?)\s+(featuring|with|of)\b/gi,
|
|
22
|
-
'$1 a single scene $3',
|
|
23
|
-
],
|
|
24
|
-
[
|
|
25
|
-
/\b(create|generate|make|render|produce)\s+\d+\s+(?:completely\s+|totally\s+|very\s+)?(?:different|unique|distinct|varying|varied|separate|individual)?\s*(images?|photos?|pictures?|portraits?)\s+(featuring|with|of)\b/gi,
|
|
26
|
-
'$1 a single image $3',
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
/\b(?:in|across)\s+(?:different|various|varying|multiple|several|many|diverse|assorted)\s+(?:scenes?|settings?|environments?|worlds?)\s*:/gi,
|
|
30
|
-
'in this setting:',
|
|
31
|
-
],
|
|
32
|
-
[
|
|
33
|
-
/\bfor\s+all\s+(?:scenes?|settings?|environments?|worlds?|images?|photos?|pictures?|portraits?)\b/gi,
|
|
34
|
-
'for the image',
|
|
35
|
-
],
|
|
36
|
-
];
|
|
37
|
-
function countPatternReplacement(match, ...args) {
|
|
38
|
-
const offset = typeof args[args.length - 2] === 'number' ? args[args.length - 2] : 0;
|
|
39
|
-
const source = typeof args[args.length - 1] === 'string' ? args[args.length - 1] : '';
|
|
40
|
-
const before = source.slice(Math.max(0, offset - 8), offset);
|
|
41
|
-
const after = source.slice(offset + match.length, offset + match.length + 8);
|
|
42
|
-
const touchesAspectOrDimension = /(?:\d\s*[:/x×]\s*|\bby\s*)$/i.test(before)
|
|
43
|
-
|| /^\s*(?::|\/|x|×|\bby\b)\s*\d/i.test(after);
|
|
44
|
-
return touchesAspectOrDimension ? match : '';
|
|
45
|
-
}
|
|
46
4
|
function sanitizeBatchPrompt(prompt) {
|
|
47
|
-
|
|
48
|
-
const PLACEHOLDER_PREFIX = '\x00DP';
|
|
49
|
-
const placeholder = (i) => `${PLACEHOLDER_PREFIX}${i}\x00`;
|
|
50
|
-
let shielded = prompt.replace(/\{[^{}]+\}/g, (match) => {
|
|
51
|
-
if (match.includes('|')) {
|
|
52
|
-
groups.push(match);
|
|
53
|
-
return placeholder(groups.length - 1);
|
|
54
|
-
}
|
|
55
|
-
return match;
|
|
56
|
-
});
|
|
57
|
-
for (const [pattern, replacement] of SINGULARIZE_PATTERNS) {
|
|
58
|
-
pattern.lastIndex = 0;
|
|
59
|
-
shielded = shielded.replace(pattern, replacement);
|
|
60
|
-
}
|
|
61
|
-
for (const pattern of GRID_PATTERNS) {
|
|
62
|
-
pattern.lastIndex = 0;
|
|
63
|
-
shielded = shielded.replace(pattern, countPatternReplacement);
|
|
64
|
-
}
|
|
65
|
-
shielded = shielded.replace(/\s{2,}/g, ' ').replace(/\s+([.,;!?])/g, '$1').trim();
|
|
66
|
-
shielded = shielded.replace(/^[,.\s]+/, '').replace(/[,.\s]+$/, '').trim();
|
|
67
|
-
let result = shielded;
|
|
68
|
-
for (let i = 0; i < groups.length; i++) {
|
|
69
|
-
result = result.replace(placeholder(i), groups[i]);
|
|
70
|
-
}
|
|
71
|
-
return result;
|
|
5
|
+
return prompt;
|
|
72
6
|
}
|
|
73
7
|
//# sourceMappingURL=promptSanitizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptSanitizer.js","sourceRoot":"","sources":["../../../src/tools/shared/promptSanitizer.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"promptSanitizer.js","sourceRoot":"","sources":["../../../src/tools/shared/promptSanitizer.ts"],"names":[],"mappings":";;AAOA,kDAEC;AAFD,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -7394,73 +7394,5 @@ export function resolveVideoSteps(modelId, modelDefaults, explicitSteps) {
|
|
|
7394
7394
|
return defaultSteps;
|
|
7395
7395
|
return inferDefaultVideoSteps(modelId);
|
|
7396
7396
|
}
|
|
7397
|
-
|
|
7398
|
-
/\b(?:different|various|varying|multiple|several|many|diverse|assorted|all|range of|variety of|array of|series of|set of|collection of)\s+(?:facial\s+)?(?:expressions?|poses?|angles?|versions?|variations?|looks?|smiles?|moods?|emotions?|faces?|views?|shots?|styles?|options?|takes?|scenes?|settings?|environments?|worlds?)\b/gi,
|
|
7399
|
-
/\b\d+\s+(?:completely\s+|totally\s+|very\s+)?(?:different|unique|distinct|varying|varied|separate|individual)?\s*(?:facial\s+)?(?:expressions?|poses?|angles?|versions?|variations?|looks?|smiles?|moods?|emotions?|faces?|views?|shots?|styles?|options?|takes?|images?|photos?|pictures?|portraits?|copies|duplicates|scenes?|settings?|environments?|worlds?)\b/gi,
|
|
7400
|
-
/\b(?:grid|collage|montage|composite|triptych|diptych|side[- ]by[- ]side|side[- ]to[- ]side|split[- ]?screen|photo[- ]?sheet|contact[- ]?sheet|mood[- ]?board|lineup|line[- ]?up|tile[ds]?|tiling|rows?\s+(?:of|and)\s+columns?|columns?\s+(?:of|and)\s+rows?)\b/gi,
|
|
7401
|
-
/\beach\s+(?:with|showing|featuring|displaying|having|in)\s+(?:a\s+)?(?:different|unique|distinct|its own)\b/gi,
|
|
7402
|
-
/\beach\s+(?:one|version|variation|image|copy)\b/gi,
|
|
7403
|
-
/\b(?:show|display|create|generate|make|render|produce)\s+(?:multiple|different|various|several|all)\b/gi,
|
|
7404
|
-
/\b(?:switch(?:ing)?|mix(?:ing)?)\s+up\b/gi,
|
|
7405
|
-
/\b\d+\s+of\s+(?:them|these|those)\b/gi,
|
|
7406
|
-
/\b(?:multiple|several|many)\s+(?:copies|duplicates|instances|repeats)\b/gi,
|
|
7407
|
-
/\b\d+\s+(?:versions?|variations?|renditions?|interpretations?|depictions?|iterations?)\b/gi,
|
|
7408
|
-
/\b(?:repeated|repeating|repeat)\s+\d*\s*(?:times?)?\b/gi,
|
|
7409
|
-
/\b(?:put|place|fit|arrange)\s+(?:them|these|those|it)\s+(?:all\s+)?(?:together|into one|in one)\b/gi,
|
|
7410
|
-
/\ball\s+(?:together|in\s+one\s+(?:image|frame|picture|photo))\b/gi
|
|
7411
|
-
];
|
|
7412
|
-
const SINGULARIZE_PATTERNS = [
|
|
7413
|
-
[
|
|
7414
|
-
/\b(create|generate|make|render|produce)\s+\d+\s+(?:completely\s+|totally\s+|very\s+)?(?:different|unique|distinct|varying|varied|separate|individual)?\s*(scenes?|settings?|environments?|worlds?)\s+(featuring|with|of)\b/gi,
|
|
7415
|
-
'$1 a single scene $3'
|
|
7416
|
-
],
|
|
7417
|
-
[
|
|
7418
|
-
/\b(create|generate|make|render|produce)\s+\d+\s+(?:completely\s+|totally\s+|very\s+)?(?:different|unique|distinct|varying|varied|separate|individual)?\s*(images?|photos?|pictures?|portraits?)\s+(featuring|with|of)\b/gi,
|
|
7419
|
-
'$1 a single image $3'
|
|
7420
|
-
],
|
|
7421
|
-
[
|
|
7422
|
-
/\b(?:in|across)\s+(?:different|various|varying|multiple|several|many|diverse|assorted)\s+(?:scenes?|settings?|environments?|worlds?)\s*:/gi,
|
|
7423
|
-
'in this setting:'
|
|
7424
|
-
],
|
|
7425
|
-
[
|
|
7426
|
-
/\bfor\s+all\s+(?:scenes?|settings?|environments?|worlds?|images?|photos?|pictures?|portraits?)\b/gi,
|
|
7427
|
-
'for the image'
|
|
7428
|
-
]
|
|
7429
|
-
];
|
|
7430
|
-
function countPatternReplacement(match, ...args) {
|
|
7431
|
-
const offset = typeof args[args.length - 2] === 'number' ? args[args.length - 2] : 0;
|
|
7432
|
-
const source = typeof args[args.length - 1] === 'string' ? args[args.length - 1] : '';
|
|
7433
|
-
const before = source.slice(Math.max(0, offset - 8), offset);
|
|
7434
|
-
const after = source.slice(offset + match.length, offset + match.length + 8);
|
|
7435
|
-
const touchesAspectOrDimension = /(?:\d\s*[:/x×]\s*|\bby\s*)$/i.test(before) ||
|
|
7436
|
-
/^\s*(?::|\/|x|×|\bby\b)\s*\d/i.test(after);
|
|
7437
|
-
return touchesAspectOrDimension ? match : '';
|
|
7438
|
-
}
|
|
7439
|
-
export function sanitizeBatchPrompt(prompt) {
|
|
7440
|
-
const groups = [];
|
|
7441
|
-
const placeholderPrefix = '\x00DP';
|
|
7442
|
-
const placeholder = (i) => placeholderPrefix + i + '\x00';
|
|
7443
|
-
let shielded = prompt.replace(/\{[^{}]+\}/g, (match) => {
|
|
7444
|
-
if (match.includes('|')) {
|
|
7445
|
-
groups.push(match);
|
|
7446
|
-
return placeholder(groups.length - 1);
|
|
7447
|
-
}
|
|
7448
|
-
return match;
|
|
7449
|
-
});
|
|
7450
|
-
for (const [pattern, replacement] of SINGULARIZE_PATTERNS) {
|
|
7451
|
-
pattern.lastIndex = 0;
|
|
7452
|
-
shielded = shielded.replace(pattern, replacement);
|
|
7453
|
-
}
|
|
7454
|
-
for (const pattern of GRID_PATTERNS) {
|
|
7455
|
-
pattern.lastIndex = 0;
|
|
7456
|
-
shielded = shielded.replace(pattern, countPatternReplacement);
|
|
7457
|
-
}
|
|
7458
|
-
shielded = shielded.replace(/\s{2,}/g, ' ').replace(/\s+([.,;!?])/g, '$1').trim();
|
|
7459
|
-
shielded = shielded.replace(/^[,.\s]+/, '').replace(/[,.\s]+$/, '').trim();
|
|
7460
|
-
let result = shielded;
|
|
7461
|
-
for (let i = 0; i < groups.length; i++) {
|
|
7462
|
-
result = result.replace(placeholder(i), groups[i]);
|
|
7463
|
-
}
|
|
7464
|
-
return result;
|
|
7465
|
-
}
|
|
7397
|
+
export { sanitizeBatchPrompt } from '../tools/shared/promptSanitizer.js';
|
|
7466
7398
|
//# sourceMappingURL=index.js.map
|