apexify.js 3.0.2 → 3.1.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.
Files changed (119) hide show
  1. package/.tsbuildinfo +1 -0
  2. package/README.md +190 -151
  3. package/dist/ai/ApexAI.d.ts +37 -0
  4. package/dist/ai/ApexAI.d.ts.map +1 -0
  5. package/dist/ai/ApexAI.js +258 -0
  6. package/dist/ai/ApexAI.js.map +1 -0
  7. package/dist/ai/buttons/drawMenu.d.ts +3 -0
  8. package/dist/ai/buttons/drawMenu.d.ts.map +1 -0
  9. package/dist/ai/buttons/drawMenu.js +271 -0
  10. package/dist/ai/buttons/drawMenu.js.map +1 -0
  11. package/dist/ai/buttons/tools.d.ts +3 -0
  12. package/dist/ai/buttons/tools.d.ts.map +1 -0
  13. package/dist/ai/buttons/tools.js +442 -0
  14. package/dist/ai/buttons/tools.js.map +1 -0
  15. package/dist/ai/functions/chunkString.d.ts +2 -0
  16. package/dist/ai/functions/chunkString.d.ts.map +1 -0
  17. package/{lib → dist}/ai/functions/chunkString.js +8 -8
  18. package/dist/ai/functions/chunkString.js.map +1 -0
  19. package/dist/ai/functions/draw.d.ts +3 -0
  20. package/dist/ai/functions/draw.d.ts.map +1 -0
  21. package/dist/ai/functions/draw.js +377 -0
  22. package/dist/ai/functions/draw.js.map +1 -0
  23. package/dist/ai/functions/generateVoiceResponse.d.ts +3 -0
  24. package/dist/ai/functions/generateVoiceResponse.d.ts.map +1 -0
  25. package/dist/ai/functions/generateVoiceResponse.js +158 -0
  26. package/dist/ai/functions/generateVoiceResponse.js.map +1 -0
  27. package/dist/ai/functions/imageReader.d.ts +3 -0
  28. package/dist/ai/functions/imageReader.d.ts.map +1 -0
  29. package/dist/ai/functions/imageReader.js +23 -0
  30. package/dist/ai/functions/imageReader.js.map +1 -0
  31. package/dist/ai/functions/readFiles.d.ts +3 -0
  32. package/dist/ai/functions/readFiles.d.ts.map +1 -0
  33. package/dist/ai/functions/readFiles.js +62 -0
  34. package/dist/ai/functions/readFiles.js.map +1 -0
  35. package/dist/ai/functions/shouldDrawImage.d.ts +2 -0
  36. package/dist/ai/functions/shouldDrawImage.d.ts.map +1 -0
  37. package/dist/ai/functions/shouldDrawImage.js +12 -0
  38. package/dist/ai/functions/shouldDrawImage.js.map +1 -0
  39. package/dist/ai/models.d.ts +9 -0
  40. package/dist/ai/models.d.ts.map +1 -0
  41. package/dist/ai/models.js +538 -0
  42. package/dist/ai/models.js.map +1 -0
  43. package/dist/ai/utils.d.ts +9 -0
  44. package/dist/ai/utils.d.ts.map +1 -0
  45. package/dist/ai/utils.js +20 -0
  46. package/dist/ai/utils.js.map +1 -0
  47. package/dist/canvas/ApexPainter.d.ts +26 -0
  48. package/dist/canvas/ApexPainter.d.ts.map +1 -0
  49. package/dist/canvas/ApexPainter.js +412 -0
  50. package/dist/canvas/ApexPainter.js.map +1 -0
  51. package/dist/canvas/utils/bg.d.ts +24 -0
  52. package/dist/canvas/utils/bg.d.ts.map +1 -0
  53. package/dist/canvas/utils/bg.js +77 -0
  54. package/dist/canvas/utils/bg.js.map +1 -0
  55. package/dist/canvas/utils/charts.d.ts +9 -0
  56. package/dist/canvas/utils/charts.d.ts.map +1 -0
  57. package/dist/canvas/utils/charts.js +453 -0
  58. package/dist/canvas/utils/charts.js.map +1 -0
  59. package/dist/canvas/utils/circular.d.ts +10 -0
  60. package/dist/canvas/utils/circular.d.ts.map +1 -0
  61. package/dist/canvas/utils/circular.js +22 -0
  62. package/dist/canvas/utils/circular.js.map +1 -0
  63. package/dist/canvas/utils/customLines.d.ts +2 -0
  64. package/dist/canvas/utils/customLines.d.ts.map +1 -0
  65. package/dist/canvas/utils/customLines.js +50 -0
  66. package/dist/canvas/utils/customLines.js.map +1 -0
  67. package/dist/canvas/utils/general functions.d.ts +8 -0
  68. package/dist/canvas/utils/general functions.d.ts.map +1 -0
  69. package/dist/canvas/utils/general functions.js +187 -0
  70. package/dist/canvas/utils/general functions.js.map +1 -0
  71. package/dist/canvas/utils/imageProperties.d.ts +60 -0
  72. package/dist/canvas/utils/imageProperties.d.ts.map +1 -0
  73. package/dist/canvas/utils/imageProperties.js +331 -0
  74. package/dist/canvas/utils/imageProperties.js.map +1 -0
  75. package/dist/canvas/utils/radius.d.ts +10 -0
  76. package/dist/canvas/utils/radius.d.ts.map +1 -0
  77. package/dist/canvas/utils/radius.js +31 -0
  78. package/dist/canvas/utils/radius.js.map +1 -0
  79. package/dist/canvas/utils/textProperties.d.ts +18 -0
  80. package/dist/canvas/utils/textProperties.d.ts.map +1 -0
  81. package/dist/canvas/utils/textProperties.js +67 -0
  82. package/dist/canvas/utils/textProperties.js.map +1 -0
  83. package/dist/canvas/utils/types.d.ts +389 -0
  84. package/dist/canvas/utils/types.d.ts.map +1 -0
  85. package/dist/canvas/utils/types.js +5 -0
  86. package/dist/canvas/utils/types.js.map +1 -0
  87. package/dist/canvas/utils/utils.d.ts +20 -0
  88. package/dist/canvas/utils/utils.d.ts.map +1 -0
  89. package/dist/canvas/utils/utils.js +43 -0
  90. package/dist/canvas/utils/utils.js.map +1 -0
  91. package/dist/index.d.ts +11 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +66 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/utils.d.ts +12 -0
  96. package/dist/utils.d.ts.map +1 -0
  97. package/dist/utils.js +12 -0
  98. package/dist/utils.js.map +1 -0
  99. package/examples/barchart.txt +69 -0
  100. package/examples/linechart.txt +84 -0
  101. package/examples/piechart.txt +63 -0
  102. package/package.json +137 -78
  103. package/dataSQL/data.sql +0 -5
  104. package/dataSQL/dataName.sql +0 -0
  105. package/dataSQL/example_table.sql +0 -1
  106. package/index.js +0 -35
  107. package/lib/ai/apexAI.js +0 -446
  108. package/lib/ai/buttons/drawMenu.js +0 -351
  109. package/lib/ai/buttons/tools.js +0 -652
  110. package/lib/ai/functions/draw.js +0 -514
  111. package/lib/ai/functions/generateVoiceResponse.js +0 -239
  112. package/lib/ai/functions/processImageAttachments.js +0 -93
  113. package/lib/ai/functions/processMessageContent.js +0 -48
  114. package/lib/ai/functions/readFiles.js +0 -95
  115. package/lib/ai/functions/shouldDrawImage.js +0 -12
  116. package/lib/ai/models.js +0 -654
  117. package/lib/ai/utils.js +0 -21
  118. package/lib/canvas/ApexPainter.js +0 -1396
  119. package/lib/utils.js +0 -24
package/lib/ai/models.js DELETED
@@ -1,654 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ApexChat = exports.ApexImagine = void 0;
40
- var hercai_1 = require("hercai");
41
- var axios_1 = require("axios");
42
- var api_1 = require("api");
43
- var sdk = (0, api_1)("@prodia/v1.3.0#be019b2kls0gqss3");
44
- sdk.auth("43435e1c-cab1-493f-a224-f51e4b97ce8d");
45
- var herc = new hercai_1.Hercai();
46
- var apexAI_1 = require("./apexAI");
47
- function ApexImagine(model, prompt, options) {
48
- return __awaiter(this, void 0, void 0, function () {
49
- var negative, number, nsfw, neg, count, resultUrls, allowedModelsH, validProdiaModalsP, i, result, error_1, i, generateResponse, generatedJobId, result, checkedURLs, nsfwWords, _loop_1, _i, checkedURLs_1, text, state_1, e_1;
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0:
53
- _a.trys.push([0, 15, , 16]);
54
- negative = options.negative, number = options.number, nsfw = options.nsfw;
55
- neg = '';
56
- count = 1;
57
- if (negative) {
58
- neg = "".concat(negative);
59
- }
60
- if (number && Number.isInteger(number) && number >= 1 && number <= 4) {
61
- count = number;
62
- }
63
- else {
64
- throw new Error('Invalid number parameter. It must be an integer between 1 and 4.');
65
- }
66
- resultUrls = [];
67
- allowedModelsH = ['v1', 'v2', 'v2-beta', 'lexica', 'prodia', 'animefy', 'raava', 'shonin'];
68
- validProdiaModalsP = [
69
- "3Guofeng3_v34.safetensors [50f420de]",
70
- "absolutereality_V16.safetensors [37db0fc3]",
71
- "absolutereality_v181.safetensors [3d9d4d2b]",
72
- "amIReal_V41.safetensors [0a8a2e61]",
73
- "analog-diffusion-1.0.ckpt [9ca13f02]",
74
- "anythingv3_0-pruned.ckpt [2700c435]",
75
- "anything-v4.5-pruned.ckpt [65745d25]",
76
- "anythingV5_PrtRE.safetensors [893e49b9]",
77
- "AOM3A3_orangemixs.safetensors [9600da17]",
78
- "blazing_drive_v10g.safetensors [ca1c1eab]",
79
- "cetusMix_Version35.safetensors [de2f2560]",
80
- "childrensStories_v13D.safetensors [9dfaabcb]",
81
- "childrensStories_v1SemiReal.safetensors [a1c56dbb]",
82
- "childrensStories_v1ToonAnime.safetensors [2ec7b88b]",
83
- "Counterfeit_v30.safetensors [9e2a8f19]",
84
- "cuteyukimixAdorable_midchapter3.safetensors [04bdffe6]",
85
- "cyberrealistic_v33.safetensors [82b0d085]",
86
- "dalcefo_v4.safetensors [425952fe]",
87
- "deliberate_v2.safetensors [10ec4b29]",
88
- "deliberate_v3.safetensors [afd9d2d4]",
89
- "dreamlike-anime-1.0.safetensors [4520e090]",
90
- "dreamlike-diffusion-1.0.safetensors [5c9fd6e0]",
91
- "dreamlike-photoreal-2.0.safetensors [fdcf65e7]",
92
- "dreamshaper_6BakedVae.safetensors [114c8abb]",
93
- "dreamshaper_7.safetensors [5cf5ae06]",
94
- "dreamshaper_8.safetensors [9d40847d]",
95
- "edgeOfRealism_eorV20.safetensors [3ed5de15]",
96
- "EimisAnimeDiffusion_V1.ckpt [4f828a15]",
97
- "elldreths-vivid-mix.safetensors [342d9d26]",
98
- "epicrealism_naturalSinRC1VAE.safetensors [90a4c676]",
99
- "ICantBelieveItsNotPhotography_seco.safetensors [4e7a3dfd]",
100
- "juggernaut_aftermath.safetensors [5e20c455]",
101
- "lofi_v4.safetensors [ccc204d6]",
102
- "lyriel_v16.safetensors [68fceea2]",
103
- "majicmixRealistic_v4.safetensors [29d0de58]",
104
- "mechamix_v10.safetensors [ee685731]",
105
- "meinamix_meinaV9.safetensors [2ec66ab0]",
106
- "meinamix_meinaV11.safetensors [b56ce717]",
107
- "neverendingDream_v122.safetensors [f964ceeb]",
108
- "openjourney_V4.ckpt [ca2f377f]",
109
- "pastelMixStylizedAnime_pruned_fp16.safetensors [793a26e8]",
110
- "portraitplus_V1.0.safetensors [1400e684]",
111
- "protogenx34.safetensors [5896f8d5]",
112
- "Realistic_Vision_V1.4-pruned-fp16.safetensors [8d21810b]",
113
- "Realistic_Vision_V2.0.safetensors [79587710]",
114
- "Realistic_Vision_V4.0.safetensors [29a7afaa]",
115
- "Realistic_Vision_V5.0.safetensors [614d1063]",
116
- "redshift_diffusion-V10.safetensors [1400e684]",
117
- "revAnimated_v122.safetensors [3f4fefd9]",
118
- "rundiffusionFX25D_v10.safetensors [cd12b0ee]",
119
- "rundiffusionFX_v10.safetensors [cd4e694d]",
120
- "sdv1_4.ckpt [7460a6fa]",
121
- "v1-5-pruned-emaonly.safetensors [d7049739]",
122
- "v1-5-inpainting.safetensors [21c7ab71]",
123
- "shoninsBeautiful_v10.safetensors [25d8c546]",
124
- "theallys-mix-ii-churned.safetensors [5d9225a4]",
125
- "timeless-1.0.ckpt [7c4971d4]",
126
- "toonyou_beta6.safetensors [980f6b15]",
127
- ];
128
- if (!allowedModelsH.includes(model)) return [3 /*break*/, 7];
129
- i = 0;
130
- _a.label = 1;
131
- case 1:
132
- if (!(i < count)) return [3 /*break*/, 6];
133
- _a.label = 2;
134
- case 2:
135
- _a.trys.push([2, 4, , 5]);
136
- return [4 /*yield*/, herc.drawImage({ model: model, prompt: prompt, negative_prompt: neg })];
137
- case 3:
138
- result = _a.sent();
139
- resultUrls.push(result.url);
140
- return [3 /*break*/, 5];
141
- case 4:
142
- error_1 = _a.sent();
143
- console.error("Failed to draw image with Hercai. Retrying...", error_1);
144
- return [3 /*break*/, 5];
145
- case 5:
146
- i++;
147
- return [3 /*break*/, 1];
148
- case 6: return [3 /*break*/, 12];
149
- case 7:
150
- if (!validProdiaModalsP.includes(model)) return [3 /*break*/, 12];
151
- i = 0;
152
- _a.label = 8;
153
- case 8:
154
- if (!(i < count)) return [3 /*break*/, 12];
155
- return [4 /*yield*/, sdk.generate({
156
- model: model,
157
- prompt: prompt,
158
- })];
159
- case 9:
160
- generateResponse = _a.sent();
161
- generatedJobId = generateResponse.data.job;
162
- return [4 /*yield*/, checkJobStatus(generatedJobId)];
163
- case 10:
164
- result = _a.sent();
165
- if (result) {
166
- resultUrls.push(result);
167
- }
168
- else {
169
- console.error('Invalid result format. Expected a URL.');
170
- }
171
- _a.label = 11;
172
- case 11:
173
- i++;
174
- return [3 /*break*/, 8];
175
- case 12:
176
- if (!nsfw) return [3 /*break*/, 14];
177
- return [4 /*yield*/, apexChecker(resultUrls)];
178
- case 13:
179
- checkedURLs = _a.sent();
180
- nsfwWords = [
181
- "porn",
182
- "sex",
183
- "nude",
184
- "nsfw",
185
- "xxx",
186
- "adult",
187
- "vagina",
188
- "penis",
189
- "boobs",
190
- "fuck",
191
- "orgasm",
192
- "erotic",
193
- "naughty",
194
- "kinky",
195
- "sensual",
196
- "horny",
197
- "lust",
198
- "sperm",
199
- "ejaculate",
200
- "busty",
201
- "booty",
202
- "striptease",
203
- "dildo",
204
- "vibrator",
205
- "fetish",
206
- "bondage",
207
- "anal",
208
- "oral",
209
- "blowjob",
210
- "cumshot",
211
- "gangbang",
212
- "threesome",
213
- "orgy",
214
- "deepthroat",
215
- "naked",
216
- "undress",
217
- "cum",
218
- "suck",
219
- "lick",
220
- "spank",
221
- "masturbate",
222
- "clitoris",
223
- "penetration",
224
- "swinger",
225
- "hooker",
226
- "prostitute",
227
- "escort",
228
- "cumswap",
229
- "creampie",
230
- "rimjob",
231
- "squirt",
232
- "butt",
233
- "ass",
234
- "slut",
235
- "whore",
236
- "cumming",
237
- "rimming",
238
- "cunnilingus",
239
- "fellatio",
240
- "crotch",
241
- "groin",
242
- "erogenous",
243
- "labia",
244
- "testicles",
245
- "climax",
246
- "thrust",
247
- "missionary",
248
- "doggy",
249
- "69",
250
- "tits",
251
- "pussy",
252
- "cock",
253
- "boobies",
254
- "boner",
255
- "cherry",
256
- "virgin",
257
- "cumming",
258
- "anal beads",
259
- "nipple",
260
- "stripper",
261
- "g-string",
262
- "thong",
263
- "fingering",
264
- "handjob",
265
- "voyeur",
266
- "orgasmic",
267
- "nudity",
268
- "sexting",
269
- "seduction",
270
- "lustful",
271
- "wet",
272
- "hardcore",
273
- "seduce",
274
- "dirty",
275
- "naughty",
276
- "erotic",
277
- "pleasure",
278
- "aroused",
279
- "intimate",
280
- "eroticism",
281
- "foreplay",
282
- "dominate",
283
- "submissive",
284
- "bdsm",
285
- "s&m",
286
- "masochism",
287
- "sadism",
288
- "bukkake",
289
- "gangbang",
290
- "fetish",
291
- "orgy",
292
- "bondage",
293
- "golden shower",
294
- "dirty talk",
295
- "pillow talk",
296
- "sex slave",
297
- "dirty dancing",
298
- "striptease",
299
- "pornographic",
300
- "adult entertainment",
301
- "sexual intercourse",
302
- "titillating",
303
- "sexy",
304
- "hot",
305
- "erotic",
306
- "raunchy",
307
- "stimulation",
308
- "climax",
309
- "horny",
310
- "turn-on",
311
- "kinky",
312
- "lustful",
313
- "sensual",
314
- "passionate",
315
- "intimate",
316
- "provocative",
317
- "tease",
318
- "foreplay",
319
- "satisfy",
320
- "pleasure",
321
- "erogenous",
322
- "arousal",
323
- "lust",
324
- "desire",
325
- "attraction",
326
- "libido",
327
- "orgasm",
328
- "bedroom",
329
- "undress",
330
- "naked",
331
- "kiss",
332
- "touch",
333
- "petting",
334
- "cuddle",
335
- "spooning",
336
- "naughty",
337
- "dirty",
338
- "taboo",
339
- "forbidden",
340
- "sinful",
341
- "sultry",
342
- "risqué",
343
- "racy",
344
- "flirt",
345
- "seduce",
346
- "titillate",
347
- "arouse",
348
- "tempt",
349
- "stimulate",
350
- "seduction",
351
- "pleasure",
352
- "ecstasy",
353
- "passion",
354
- "intimacy",
355
- "sensuality",
356
- "eroticism",
357
- "fetish",
358
- "fantasy",
359
- "kink",
360
- "role-play",
361
- "dominance",
362
- "submission",
363
- "bondage",
364
- "masochism",
365
- "sadism",
366
- "orgy",
367
- "swinging",
368
- "voyeurism",
369
- "exhibitionism",
370
- "cunnilingus",
371
- "fellatio",
372
- "69",
373
- "blowjob",
374
- "anal",
375
- "doggy style",
376
- "missionary",
377
- "cowgirl",
378
- "reverse cowgirl",
379
- "threesome",
380
- "foursome",
381
- "gangbang",
382
- "rimming",
383
- "golden shower",
384
- "facial",
385
- "creampie",
386
- "cumshot",
387
- "squirting",
388
- "masturbation",
389
- "orgasm",
390
- "erect",
391
- "nipple",
392
- "pubic",
393
- "erection",
394
- "ejaculation",
395
- "clitoris",
396
- "penetration",
397
- "vibrator",
398
- "dildo",
399
- "strap-on",
400
- "butt plug",
401
- "anal beads",
402
- "crotchless",
403
- "lingerie",
404
- "corset",
405
- "stockings",
406
- "garter",
407
- "bra",
408
- "panties",
409
- "thong",
410
- "G-string",
411
- "bikini",
412
- "lingerie",
413
- "boudoir",
414
- "stripper",
415
- "exotic dancer",
416
- "burlesque",
417
- "pole dance",
418
- "erotic dance",
419
- "nude",
420
- "topless",
421
- "lap dance",
422
- "strip tease",
423
- "private dance",
424
- "camgirl",
425
- "porn star",
426
- "sex worker",
427
- "escort",
428
- "prostitute",
429
- "whore",
430
- "call girl",
431
- "hooker",
432
- "streetwalker",
433
- "courtesan",
434
- "madam",
435
- "mistress",
436
- "dominatrix",
437
- "submissive",
438
- "slave",
439
- "master",
440
- "mistress",
441
- "sir",
442
- "madame",
443
- "domina",
444
- "domme",
445
- "sissy",
446
- "bottom",
447
- "top",
448
- "fetish",
449
- "kink",
450
- "leather",
451
- "latex",
452
- "rubber",
453
- "bondage",
454
- "rope",
455
- "chain",
456
- "spanking",
457
- "whipping",
458
- "caning",
459
- "flogging",
460
- "paddling",
461
- "torture",
462
- "humiliation",
463
- "degradation",
464
- "submission",
465
- "dominance",
466
- "sadism",
467
- "masochism",
468
- "bukkake",
469
- "facial",
470
- "creampie",
471
- "cum swap",
472
- "cum play",
473
- "cum shot",
474
- "gang bang",
475
- "double penetration",
476
- "anal sex",
477
- "oral sex",
478
- "rimming",
479
- "fingering",
480
- "gay",
481
- "lesbian",
482
- "niga",
483
- "underage",
484
- "xnxx",
485
- "xxx",
486
- "pornhub",
487
- ];
488
- _loop_1 = function (text) {
489
- if (nsfwWords.some(function (word) { return text.includes(word); })) {
490
- return { value: "The generated text contains NSFW content." };
491
- }
492
- };
493
- for (_i = 0, checkedURLs_1 = checkedURLs; _i < checkedURLs_1.length; _i++) {
494
- text = checkedURLs_1[_i];
495
- state_1 = _loop_1(text);
496
- if (typeof state_1 === "object")
497
- return [2 /*return*/, state_1.value];
498
- }
499
- _a.label = 14;
500
- case 14: return [2 /*return*/, resultUrls];
501
- case 15:
502
- e_1 = _a.sent();
503
- if (e_1.response && e_1.response.status === 429) {
504
- console.error("Too many requests. Please try again later.");
505
- return [2 /*return*/, "Please wait i am in a cool down for a minute"];
506
- }
507
- else if (e_1.response && e_1.response.status === 500) {
508
- console.error("Internal server error. Please try again later.");
509
- return [2 /*return*/, "Please wait i am in a cool down for a minute"];
510
- }
511
- else {
512
- console.error("Please wait i am in a cool down for a minute");
513
- return [2 /*return*/, "Please wait i am in a cool down for a minute"];
514
- }
515
- return [3 /*break*/, 16];
516
- case 16: return [2 /*return*/];
517
- }
518
- });
519
- });
520
- }
521
- exports.ApexImagine = ApexImagine;
522
- function checkJobStatus(jobId, retryCount) {
523
- if (retryCount === void 0) { retryCount = 3; }
524
- return __awaiter(this, void 0, void 0, function () {
525
- var getJobResponse, jobData, error_2;
526
- return __generator(this, function (_a) {
527
- switch (_a.label) {
528
- case 0:
529
- _a.trys.push([0, 7, , 8]);
530
- return [4 /*yield*/, sdk.getJob({ jobId: jobId })];
531
- case 1:
532
- getJobResponse = _a.sent();
533
- jobData = getJobResponse.data;
534
- if (!(jobData.status === "generating" || jobData.status === "queued")) return [3 /*break*/, 5];
535
- if (!(retryCount > 0)) return [3 /*break*/, 3];
536
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 3000); })];
537
- case 2:
538
- _a.sent();
539
- return [2 /*return*/, checkJobStatus(jobId, retryCount - 1)];
540
- case 3:
541
- console.error("Job failed after multiple retries:", jobData);
542
- return [2 /*return*/, null];
543
- case 4: return [3 /*break*/, 6];
544
- case 5:
545
- if (jobData.status === "succeeded") {
546
- return [2 /*return*/, jobData.imageUrl];
547
- }
548
- else {
549
- console.error("Job failed:", jobData);
550
- return [2 /*return*/, null];
551
- }
552
- _a.label = 6;
553
- case 6: return [3 /*break*/, 8];
554
- case 7:
555
- error_2 = _a.sent();
556
- console.error(error_2);
557
- return [2 /*return*/, null];
558
- case 8: return [2 /*return*/];
559
- }
560
- });
561
- });
562
- }
563
- function ApexChat(model, prompt) {
564
- return __awaiter(this, void 0, void 0, function () {
565
- var response, e_2;
566
- return __generator(this, function (_a) {
567
- switch (_a.label) {
568
- case 0:
569
- _a.trys.push([0, 6, , 7]);
570
- if (!['v3', 'v3-32k', 'turbo', 'turbo-16k', 'gemini'].includes(model)) return [3 /*break*/, 2];
571
- return [4 /*yield*/, herc.question({ model: "".concat(model), content: "".concat(prompt) })];
572
- case 1:
573
- response = _a.sent();
574
- return [2 /*return*/, response.reply];
575
- case 2:
576
- if (!(model === 'apexChat')) return [3 /*break*/, 4];
577
- return [4 /*yield*/, (0, apexAI_1.apexai)(prompt)];
578
- case 3: return [2 /*return*/, _a.sent()];
579
- case 4: throw new Error('Invalid model.');
580
- case 5: return [3 /*break*/, 7];
581
- case 6:
582
- e_2 = _a.sent();
583
- console.error(e_2.message);
584
- return [2 /*return*/, ''];
585
- case 7: return [2 /*return*/];
586
- }
587
- });
588
- });
589
- }
590
- exports.ApexChat = ApexChat;
591
- function apexChecker(urls) {
592
- return __awaiter(this, void 0, void 0, function () {
593
- var retryCount, maxRetries, fetchData, error_3, error_4;
594
- var _this = this;
595
- return __generator(this, function (_a) {
596
- switch (_a.label) {
597
- case 0:
598
- _a.trys.push([0, 7, , 8]);
599
- retryCount = 0;
600
- maxRetries = 3;
601
- fetchData = function () { return __awaiter(_this, void 0, void 0, function () {
602
- var response, error_5;
603
- return __generator(this, function (_a) {
604
- switch (_a.label) {
605
- case 0:
606
- _a.trys.push([0, 2, , 3]);
607
- return [4 /*yield*/, axios_1.post("https://api-inference.huggingface.co/models/Salesforce/blip-image-captioning-base", { image: urls }, {
608
- headers: {
609
- "Content-Type": "application/json",
610
- Authorization: "Bearer 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",
611
- },
612
- })];
613
- case 1:
614
- response = _a.sent();
615
- if (response.status === 200) {
616
- return [2 /*return*/, response.data[0].generated_text];
617
- }
618
- else {
619
- console.error("Failed to fetch image captioning API: ".concat(response.statusText));
620
- return [2 /*return*/, null];
621
- }
622
- return [3 /*break*/, 3];
623
- case 2:
624
- error_5 = _a.sent();
625
- console.error("Error fetching data: ".concat(error_5.message));
626
- throw error_5;
627
- case 3: return [2 /*return*/];
628
- }
629
- });
630
- }); };
631
- _a.label = 1;
632
- case 1:
633
- if (!(retryCount < maxRetries)) return [3 /*break*/, 6];
634
- _a.label = 2;
635
- case 2:
636
- _a.trys.push([2, 4, , 5]);
637
- return [4 /*yield*/, fetchData()];
638
- case 3: return [2 /*return*/, _a.sent()];
639
- case 4:
640
- error_3 = _a.sent();
641
- console.error("Error fetching data (Retry ".concat(retryCount + 1, "): ").concat(error_3.message));
642
- retryCount++;
643
- return [3 /*break*/, 5];
644
- case 5: return [3 /*break*/, 1];
645
- case 6: return [2 /*return*/, null];
646
- case 7:
647
- error_4 = _a.sent();
648
- console.error("Error in attemptImageCaptioning: ".concat(error_4.message));
649
- return [2 /*return*/, null];
650
- case 8: return [2 /*return*/];
651
- }
652
- });
653
- });
654
- }
package/lib/ai/utils.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApexImagine = exports.ApexChat = exports.drawImage = exports.generateVoiceResponse = exports.shouldDrawImage = exports.chunkString = exports.processImageAttachments = exports.processMessageContent = void 0;
4
- var processMessageContent_1 = require("./functions/processMessageContent");
5
- Object.defineProperty(exports, "processMessageContent", { enumerable: true, get: function () { return processMessageContent_1.processMessageContent; } });
6
- var processImageAttachments_1 = require("./functions/processImageAttachments");
7
- Object.defineProperty(exports, "processImageAttachments", { enumerable: true, get: function () { return processImageAttachments_1.processImageAttachments; } });
8
- var chunkString_1 = require("./functions/chunkString");
9
- Object.defineProperty(exports, "chunkString", { enumerable: true, get: function () { return chunkString_1.chunkString; } });
10
- var shouldDrawImage_1 = require("./functions/shouldDrawImage");
11
- Object.defineProperty(exports, "shouldDrawImage", { enumerable: true, get: function () { return shouldDrawImage_1.shouldDrawImage; } });
12
- var generateVoice_1 = require("./functions/generateVoiceResponse");
13
- Object.defineProperty(exports, "generateVoiceResponse", { enumerable: true, get: function () { return generateVoice_1.generateVoiceResponse; } });
14
- var draw_1 = require("./functions/draw");
15
- Object.defineProperty(exports, "drawImage", { enumerable: true, get: function () { return draw_1.drawImage; } });
16
- var readFiles_1 = require("./functions/readFiles");
17
- Object.defineProperty(exports, "readPdf", { enumerable: true, get: function () { return readFiles_1.readPdf; } });
18
- Object.defineProperty(exports, "readTextFile", { enumerable: true, get: function () { return readFiles_1.readTextFile; } });
19
- var models_1 = require("./models");
20
- Object.defineProperty(exports, "ApexChat", { enumerable: true, get: function () { return models_1.ApexChat; } });
21
- Object.defineProperty(exports, "ApexImagine", { enumerable: true, get: function () { return models_1.ApexImagine; } });