apexify.js 4.0.12 → 4.1.0
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/ApexAI.d.ts +1 -2
- package/dist/ai/ApexAI.d.ts.map +1 -1
- package/dist/ai/ApexAI.js.map +1 -1
- package/dist/ai/ApexModules.d.ts +17 -0
- package/dist/ai/ApexModules.d.ts.map +1 -0
- package/dist/ai/ApexModules.js +704 -0
- package/dist/ai/ApexModules.js.map +1 -0
- package/dist/ai/functions/draw.d.ts +1 -2
- package/dist/ai/functions/draw.d.ts.map +1 -1
- package/dist/ai/functions/draw.js +504 -504
- package/dist/ai/functions/draw.js.map +1 -1
- package/dist/ai/functions/generateVoiceResponse.d.ts +1 -2
- package/dist/ai/functions/generateVoiceResponse.d.ts.map +1 -1
- package/dist/ai/functions/generateVoiceResponse.js.map +1 -1
- package/dist/ai/functions/shouldDrawImage.js +2 -3
- package/dist/ai/functions/shouldDrawImage.js.map +1 -1
- package/dist/ai/functions/validOptions.d.ts +4 -4
- package/dist/ai/functions/validOptions.d.ts.map +1 -1
- package/dist/ai/functions/validOptions.js +44 -117
- package/dist/ai/functions/validOptions.js.map +1 -1
- package/dist/ai/modals-chat/Gemini-pro.d.ts.map +1 -1
- package/dist/ai/modals-chat/Gemini-pro.js +6 -3
- package/dist/ai/modals-chat/Gemini-pro.js.map +1 -1
- package/dist/ai/utils.d.ts +1 -1
- package/dist/ai/utils.d.ts.map +1 -1
- package/dist/ai/utils.js +3 -3
- package/dist/ai/utils.js.map +1 -1
- package/lib/ai/ApexAI.ts +1 -2
- package/lib/ai/ApexModules.ts +733 -0
- package/lib/ai/functions/draw.ts +32 -25
- package/lib/ai/functions/generateVoiceResponse.ts +1 -2
- package/lib/ai/functions/validOptions.ts +44 -194
- package/lib/ai/modals-chat/Gemini-pro.ts +18 -16
- package/lib/ai/utils.ts +1 -1
- package/package.json +8 -1
- package/lib/ai/direct-use.ts +0 -586
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
import { Hercai } from 'hercai';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import api from "api";
|
|
4
|
+
import translate from "@iamtraction/google-translate";
|
|
5
|
+
const sdk = api("@prodia/v1.3.0#be019b2kls0gqss3");
|
|
6
|
+
import { apexai, starChat, facebook_ai, yi_34b } from './modals-chat/modals';
|
|
7
|
+
import { validOptions } from "./functions/validOptions";
|
|
8
|
+
|
|
9
|
+
sdk.auth("43435e1c-cab1-493f-a224-f51e4b97ce8d");
|
|
10
|
+
const hercai = new Hercai('6eZZOdDwm6Epdzn8mnhcX9SBDkxvoNYcNj9ILS0P44=');
|
|
11
|
+
|
|
12
|
+
export interface ApexImagineOptions {
|
|
13
|
+
nsfw?: boolean;
|
|
14
|
+
deepCheck?: boolean;
|
|
15
|
+
count?: number;
|
|
16
|
+
negative_prompt?: string;
|
|
17
|
+
sampler?: any;
|
|
18
|
+
image_style?: any;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
steps?: number;
|
|
22
|
+
seed?: number;
|
|
23
|
+
cfg_scale?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type ChatModelOption = "v3" | "v3-32k" | "turbo" | "turbo-16k" | "gemini" ;
|
|
27
|
+
type hercmodals = "v1" | "v2" | "v2-beta" | "v3" | "lexica" | "prodia" | "animefy" | "raava" | "shonin" | "simurg";
|
|
28
|
+
|
|
29
|
+
async function ApexImagine(model: string, prompt: string, options: ApexImagineOptions): Promise<string[] | undefined> {
|
|
30
|
+
let imageURL: string | null;
|
|
31
|
+
let response: string[] = [];
|
|
32
|
+
const imageType = await validOptions;
|
|
33
|
+
|
|
34
|
+
const { nsfw = false, deepCheck = false, count = 2, negative_prompt = "", sampler = "DPM-Solver", height = 512, width = 512, cfg_scale = 9, steps = 20, seed = -1, image_style = "Cinematic" } = options;
|
|
35
|
+
|
|
36
|
+
const translatedText = await translate(prompt, {
|
|
37
|
+
from: "auto",
|
|
38
|
+
to: "en",
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
for (let i = 0; i < count; i++) {
|
|
42
|
+
if (imageType.validHercaiModals.includes(model)) {
|
|
43
|
+
if (model === 'prodia') {
|
|
44
|
+
imageURL = (await hercai.betaDrawImage({
|
|
45
|
+
prompt: translatedText.text,
|
|
46
|
+
negative_prompt: negative_prompt,
|
|
47
|
+
sampler: sampler,
|
|
48
|
+
image_style: image_style,
|
|
49
|
+
width: width,
|
|
50
|
+
height: height,
|
|
51
|
+
scale: cfg_scale,
|
|
52
|
+
steps: steps
|
|
53
|
+
})).url;
|
|
54
|
+
} else {
|
|
55
|
+
imageURL = (await hercai.drawImage({
|
|
56
|
+
model: model as hercmodals,
|
|
57
|
+
prompt: translatedText.text,
|
|
58
|
+
negative_prompt: negative_prompt
|
|
59
|
+
})).url;
|
|
60
|
+
}
|
|
61
|
+
} else if (imageType.validProdiaModals.includes(model)) {
|
|
62
|
+
const generating = await sdk.generate({
|
|
63
|
+
model: model,
|
|
64
|
+
prompt: translatedText.text,
|
|
65
|
+
negative_prompt: negative_prompt,
|
|
66
|
+
style_preset: image_style,
|
|
67
|
+
cfg_scale: cfg_scale,
|
|
68
|
+
sampler: sampler,
|
|
69
|
+
seed: seed,
|
|
70
|
+
steps: steps,
|
|
71
|
+
width: width,
|
|
72
|
+
height: height
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const generatedJobId = generating.data.job;
|
|
76
|
+
imageURL = await checkJobStatus(generatedJobId);
|
|
77
|
+
} else if (imageType.validSXDL.includes(model)) {
|
|
78
|
+
const generating = await sdk.sdxlGenerate({
|
|
79
|
+
model: model,
|
|
80
|
+
prompt: translatedText.text,
|
|
81
|
+
negative_prompt: negative_prompt,
|
|
82
|
+
style_preset: image_style,
|
|
83
|
+
cfg_scale: cfg_scale,
|
|
84
|
+
sampler: sampler,
|
|
85
|
+
seed: seed,
|
|
86
|
+
steps: steps,
|
|
87
|
+
width: width,
|
|
88
|
+
height: height
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const generatedJobId = generating.data.job;
|
|
92
|
+
imageURL = await checkJobStatus(generatedJobId);
|
|
93
|
+
} else {
|
|
94
|
+
throw new Error("Invalid model provided. Please check docs/mpn page for valid models.");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (imageURL) {
|
|
98
|
+
if (nsfw === false && deepCheck === false) {
|
|
99
|
+
response.push(imageURL);
|
|
100
|
+
} else {
|
|
101
|
+
|
|
102
|
+
const nsfwWords: string[] = [
|
|
103
|
+
"2g1c",
|
|
104
|
+
"2 girls 1 cup",
|
|
105
|
+
"acrotomophilia",
|
|
106
|
+
"alabama hot pocket",
|
|
107
|
+
"alaskan pipeline",
|
|
108
|
+
"anal",
|
|
109
|
+
"anilingus",
|
|
110
|
+
"anus",
|
|
111
|
+
"apeshit",
|
|
112
|
+
"arsehole",
|
|
113
|
+
"ass",
|
|
114
|
+
"asshole",
|
|
115
|
+
"assmunch",
|
|
116
|
+
"auto erotic",
|
|
117
|
+
"autoerotic",
|
|
118
|
+
"babeland",
|
|
119
|
+
"baby batter",
|
|
120
|
+
"baby juice",
|
|
121
|
+
"ball gag",
|
|
122
|
+
"ball gravy",
|
|
123
|
+
"ball kicking",
|
|
124
|
+
"ball licking",
|
|
125
|
+
"ball sack",
|
|
126
|
+
"ball sucking",
|
|
127
|
+
"bangbros",
|
|
128
|
+
"bangbus",
|
|
129
|
+
"bareback",
|
|
130
|
+
"barely legal",
|
|
131
|
+
"barenaked",
|
|
132
|
+
"bastard",
|
|
133
|
+
"bastardo",
|
|
134
|
+
"bastinado",
|
|
135
|
+
"bbw",
|
|
136
|
+
"bdsm",
|
|
137
|
+
"beaner",
|
|
138
|
+
"beaners",
|
|
139
|
+
"beaver cleaver",
|
|
140
|
+
"beaver lips",
|
|
141
|
+
"beastiality",
|
|
142
|
+
"bestiality",
|
|
143
|
+
"big black",
|
|
144
|
+
"big breasts",
|
|
145
|
+
"big knockers",
|
|
146
|
+
"big tits",
|
|
147
|
+
"bimbos",
|
|
148
|
+
"birdlock",
|
|
149
|
+
"bitch",
|
|
150
|
+
"bitches",
|
|
151
|
+
"black cock",
|
|
152
|
+
"blonde action",
|
|
153
|
+
"blonde on blonde action",
|
|
154
|
+
"blowjob",
|
|
155
|
+
"blow job",
|
|
156
|
+
"blow your load",
|
|
157
|
+
"blue waffle",
|
|
158
|
+
"blumpkin",
|
|
159
|
+
"bollocks",
|
|
160
|
+
"bondage",
|
|
161
|
+
"boner",
|
|
162
|
+
"boob",
|
|
163
|
+
"boobs",
|
|
164
|
+
"booty call",
|
|
165
|
+
"brown showers",
|
|
166
|
+
"brunette action",
|
|
167
|
+
"bukkake",
|
|
168
|
+
"bulldyke",
|
|
169
|
+
"bullet vibe",
|
|
170
|
+
"bullshit",
|
|
171
|
+
"bung hole",
|
|
172
|
+
"bunghole",
|
|
173
|
+
"busty",
|
|
174
|
+
"butt",
|
|
175
|
+
"buttcheeks",
|
|
176
|
+
"butthole",
|
|
177
|
+
"camel toe",
|
|
178
|
+
"camgirl",
|
|
179
|
+
"camslut",
|
|
180
|
+
"camwhore",
|
|
181
|
+
"carpet muncher",
|
|
182
|
+
"carpetmuncher",
|
|
183
|
+
"chocolate rosebuds",
|
|
184
|
+
"cialis",
|
|
185
|
+
"circlejerk",
|
|
186
|
+
"cleveland steamer",
|
|
187
|
+
"clit",
|
|
188
|
+
"clitoris",
|
|
189
|
+
"clover clamps",
|
|
190
|
+
"clusterfuck",
|
|
191
|
+
"cock",
|
|
192
|
+
"cocks",
|
|
193
|
+
"coprolagnia",
|
|
194
|
+
"coprophilia",
|
|
195
|
+
"cornhole",
|
|
196
|
+
"coon",
|
|
197
|
+
"coons",
|
|
198
|
+
"creampie",
|
|
199
|
+
"cum",
|
|
200
|
+
"cumming",
|
|
201
|
+
"cumshot",
|
|
202
|
+
"cumshots",
|
|
203
|
+
"cunnilingus",
|
|
204
|
+
"cunt",
|
|
205
|
+
"darkie",
|
|
206
|
+
"date rape",
|
|
207
|
+
"daterape",
|
|
208
|
+
"deep throat",
|
|
209
|
+
"deepthroat",
|
|
210
|
+
"dendrophilia",
|
|
211
|
+
"dick",
|
|
212
|
+
"dildo",
|
|
213
|
+
"dingleberry",
|
|
214
|
+
"dingleberries",
|
|
215
|
+
"dirty pillows",
|
|
216
|
+
"dirty sanchez",
|
|
217
|
+
"doggie style",
|
|
218
|
+
"doggiestyle",
|
|
219
|
+
"doggy style",
|
|
220
|
+
"doggystyle",
|
|
221
|
+
"dog style",
|
|
222
|
+
"dolcett",
|
|
223
|
+
"domination",
|
|
224
|
+
"dominatrix",
|
|
225
|
+
"dommes",
|
|
226
|
+
"donkey punch",
|
|
227
|
+
"double dong",
|
|
228
|
+
"double penetration",
|
|
229
|
+
"dp action",
|
|
230
|
+
"dry hump",
|
|
231
|
+
"dvda",
|
|
232
|
+
"eat my ass",
|
|
233
|
+
"ecchi",
|
|
234
|
+
"ejaculation",
|
|
235
|
+
"erotic",
|
|
236
|
+
"erotism",
|
|
237
|
+
"escort",
|
|
238
|
+
"eunuch",
|
|
239
|
+
"fag",
|
|
240
|
+
"faggot",
|
|
241
|
+
"fecal",
|
|
242
|
+
"felch",
|
|
243
|
+
"fellatio",
|
|
244
|
+
"feltch",
|
|
245
|
+
"female squirting",
|
|
246
|
+
"femdom",
|
|
247
|
+
"figging",
|
|
248
|
+
"fingerbang",
|
|
249
|
+
"fingering",
|
|
250
|
+
"fisting",
|
|
251
|
+
"foot fetish",
|
|
252
|
+
"footjob",
|
|
253
|
+
"frotting",
|
|
254
|
+
"fuck",
|
|
255
|
+
"fuck buttons",
|
|
256
|
+
"fuckin",
|
|
257
|
+
"fucking",
|
|
258
|
+
"fucktards",
|
|
259
|
+
"fudge packer",
|
|
260
|
+
"fudgepacker",
|
|
261
|
+
"futanari",
|
|
262
|
+
"gangbang",
|
|
263
|
+
"gang bang",
|
|
264
|
+
"gay sex",
|
|
265
|
+
"genitals",
|
|
266
|
+
"giant cock",
|
|
267
|
+
"girl on",
|
|
268
|
+
"girl on top",
|
|
269
|
+
"girls gone wild",
|
|
270
|
+
"goatcx",
|
|
271
|
+
"goatse",
|
|
272
|
+
"god damn",
|
|
273
|
+
"gokkun",
|
|
274
|
+
"golden shower",
|
|
275
|
+
"goodpoop",
|
|
276
|
+
"goo girl",
|
|
277
|
+
"goregasm",
|
|
278
|
+
"grope",
|
|
279
|
+
"group sex",
|
|
280
|
+
"g-spot",
|
|
281
|
+
"guro",
|
|
282
|
+
"hand job",
|
|
283
|
+
"handjob",
|
|
284
|
+
"hard core",
|
|
285
|
+
"hardcore",
|
|
286
|
+
"hentai",
|
|
287
|
+
"homoerotic",
|
|
288
|
+
"honkey",
|
|
289
|
+
"hooker",
|
|
290
|
+
"horny",
|
|
291
|
+
"hot carl",
|
|
292
|
+
"hot chick",
|
|
293
|
+
"how to kill",
|
|
294
|
+
"how to murder",
|
|
295
|
+
"huge fat",
|
|
296
|
+
"humping",
|
|
297
|
+
"incest",
|
|
298
|
+
"intercourse",
|
|
299
|
+
"jack off",
|
|
300
|
+
"jail bait",
|
|
301
|
+
"jailbait",
|
|
302
|
+
"jelly donut",
|
|
303
|
+
"jerk off",
|
|
304
|
+
"jigaboo",
|
|
305
|
+
"jiggaboo",
|
|
306
|
+
"jiggerboo",
|
|
307
|
+
"jizz",
|
|
308
|
+
"juggs",
|
|
309
|
+
"kike",
|
|
310
|
+
"kinbaku",
|
|
311
|
+
"kinkster",
|
|
312
|
+
"kinky",
|
|
313
|
+
"knobbing",
|
|
314
|
+
"leather restraint",
|
|
315
|
+
"leather straight jacket",
|
|
316
|
+
"lemon party",
|
|
317
|
+
"livesex",
|
|
318
|
+
"lolita",
|
|
319
|
+
"lovemaking",
|
|
320
|
+
"make me come",
|
|
321
|
+
"male squirting",
|
|
322
|
+
"masturbate",
|
|
323
|
+
"masturbating",
|
|
324
|
+
"masturbation",
|
|
325
|
+
"menage a trois",
|
|
326
|
+
"milf",
|
|
327
|
+
"missionary position",
|
|
328
|
+
"mong",
|
|
329
|
+
"motherfucker",
|
|
330
|
+
"mound of venus",
|
|
331
|
+
"mr hands",
|
|
332
|
+
"muff diver",
|
|
333
|
+
"muffdiving",
|
|
334
|
+
"nambla",
|
|
335
|
+
"nawashi",
|
|
336
|
+
"negro",
|
|
337
|
+
"neonazi",
|
|
338
|
+
"nigga",
|
|
339
|
+
"nigger",
|
|
340
|
+
"nig nog",
|
|
341
|
+
"nimphomania",
|
|
342
|
+
"nipple",
|
|
343
|
+
"nipples",
|
|
344
|
+
"nsfw",
|
|
345
|
+
'nsfw images',
|
|
346
|
+
"nude",
|
|
347
|
+
"nudity",
|
|
348
|
+
"nutten",
|
|
349
|
+
"nympho",
|
|
350
|
+
"nymphomania",
|
|
351
|
+
"octopussy",
|
|
352
|
+
"omorashi",
|
|
353
|
+
"one cup two girls",
|
|
354
|
+
'one guy one jar',
|
|
355
|
+
"orgasm",
|
|
356
|
+
"orgy",
|
|
357
|
+
'paedophile',
|
|
358
|
+
"paki",
|
|
359
|
+
"panties",
|
|
360
|
+
"panty",
|
|
361
|
+
"pedobear",
|
|
362
|
+
"pedophile",
|
|
363
|
+
'pegging',
|
|
364
|
+
'penis',
|
|
365
|
+
"phone sex",
|
|
366
|
+
'piece of shit',
|
|
367
|
+
"pikey",
|
|
368
|
+
"pissing",
|
|
369
|
+
"piss pig",
|
|
370
|
+
"pisspig",
|
|
371
|
+
"playboy",
|
|
372
|
+
"pleasure chest",
|
|
373
|
+
"pole smoker",
|
|
374
|
+
"ponyplay",
|
|
375
|
+
"poof",
|
|
376
|
+
"poon",
|
|
377
|
+
"poontang",
|
|
378
|
+
"punany",
|
|
379
|
+
"poop chute",
|
|
380
|
+
"poopchute",
|
|
381
|
+
"porn",
|
|
382
|
+
"porno",
|
|
383
|
+
"pornography",
|
|
384
|
+
"prince albert piercing",
|
|
385
|
+
"pthc",
|
|
386
|
+
"pubes",
|
|
387
|
+
"pussy",
|
|
388
|
+
"queaf",
|
|
389
|
+
"queef",
|
|
390
|
+
"quim",
|
|
391
|
+
"raghead",
|
|
392
|
+
"raging boner",
|
|
393
|
+
"rape",
|
|
394
|
+
"raping",
|
|
395
|
+
"rapist",
|
|
396
|
+
"rectum",
|
|
397
|
+
"reverse cowgirl",
|
|
398
|
+
"rimjob",
|
|
399
|
+
"rimming",
|
|
400
|
+
"rosy palm",
|
|
401
|
+
"rosy palm and her 5 sisters",
|
|
402
|
+
"rusty trombone",
|
|
403
|
+
"sadism",
|
|
404
|
+
"santorum",
|
|
405
|
+
"scat",
|
|
406
|
+
"schlong",
|
|
407
|
+
"scissoring",
|
|
408
|
+
"semen",
|
|
409
|
+
"sex",
|
|
410
|
+
"sexcam",
|
|
411
|
+
"sexo",
|
|
412
|
+
"sexy",
|
|
413
|
+
"sexual",
|
|
414
|
+
"sexually",
|
|
415
|
+
"sexuality",
|
|
416
|
+
"shaved beaver",
|
|
417
|
+
"shaved pussy",
|
|
418
|
+
"shemale",
|
|
419
|
+
"shibari",
|
|
420
|
+
"shit",
|
|
421
|
+
"shitblimp",
|
|
422
|
+
"shitty",
|
|
423
|
+
"shota",
|
|
424
|
+
"shrimping",
|
|
425
|
+
"skeet",
|
|
426
|
+
"slanteye",
|
|
427
|
+
"slut",
|
|
428
|
+
"s&m",
|
|
429
|
+
"smut",
|
|
430
|
+
"snatch",
|
|
431
|
+
"snowballing",
|
|
432
|
+
"sodomize",
|
|
433
|
+
"sodomy",
|
|
434
|
+
"spastic",
|
|
435
|
+
"spic",
|
|
436
|
+
"splooge",
|
|
437
|
+
"splooge moose",
|
|
438
|
+
"spooge",
|
|
439
|
+
"spread legs",
|
|
440
|
+
"spunk",
|
|
441
|
+
"strap on",
|
|
442
|
+
"strapon",
|
|
443
|
+
"strappado",
|
|
444
|
+
"strip club",
|
|
445
|
+
"style doggy",
|
|
446
|
+
"suck",
|
|
447
|
+
"sucks",
|
|
448
|
+
"suicide girls",
|
|
449
|
+
"sultry women",
|
|
450
|
+
"swastika",
|
|
451
|
+
"swinger",
|
|
452
|
+
"tainted love",
|
|
453
|
+
"taste my",
|
|
454
|
+
"tea bagging",
|
|
455
|
+
"threesome",
|
|
456
|
+
"throating",
|
|
457
|
+
"thumbzilla",
|
|
458
|
+
"tied up",
|
|
459
|
+
"tight white",
|
|
460
|
+
"tit",
|
|
461
|
+
"tits",
|
|
462
|
+
"titties",
|
|
463
|
+
"titty",
|
|
464
|
+
"topless",
|
|
465
|
+
"tosser",
|
|
466
|
+
"towelhead",
|
|
467
|
+
"tranny",
|
|
468
|
+
"tribadism",
|
|
469
|
+
"tub girl",
|
|
470
|
+
'tubgirl',
|
|
471
|
+
"tushy",
|
|
472
|
+
"twat",
|
|
473
|
+
"twink",
|
|
474
|
+
"twinkie",
|
|
475
|
+
"two girls one cup",
|
|
476
|
+
"undressing",
|
|
477
|
+
'upskirt',
|
|
478
|
+
"urethra play",
|
|
479
|
+
"urophilia",
|
|
480
|
+
"vagina",
|
|
481
|
+
"venus mound",
|
|
482
|
+
"viagra",
|
|
483
|
+
"vibrator",
|
|
484
|
+
"violet wand",
|
|
485
|
+
"vorarephilia",
|
|
486
|
+
"voyeur",
|
|
487
|
+
"voyeurweb",
|
|
488
|
+
"voyuer",
|
|
489
|
+
"vulva",
|
|
490
|
+
"wank",
|
|
491
|
+
"wetback",
|
|
492
|
+
"wet dream",
|
|
493
|
+
"white power",
|
|
494
|
+
"whore",
|
|
495
|
+
"worldsex",
|
|
496
|
+
"wrapping men",
|
|
497
|
+
"wrinkled starfish",
|
|
498
|
+
"xx",
|
|
499
|
+
"xxx",
|
|
500
|
+
"yaoi",
|
|
501
|
+
"yellow showers",
|
|
502
|
+
"yiffy",
|
|
503
|
+
"zoophilia",
|
|
504
|
+
"anal",
|
|
505
|
+
"arousal",
|
|
506
|
+
"balls",
|
|
507
|
+
"blowjob",
|
|
508
|
+
"busty",
|
|
509
|
+
"butt",
|
|
510
|
+
"cameltoe",
|
|
511
|
+
"climax",
|
|
512
|
+
"clitoris",
|
|
513
|
+
"cock",
|
|
514
|
+
"crotch",
|
|
515
|
+
"cum",
|
|
516
|
+
"cumshot",
|
|
517
|
+
"cunnilingus",
|
|
518
|
+
"dirty",
|
|
519
|
+
"dirtytalk",
|
|
520
|
+
"dildo",
|
|
521
|
+
"erect",
|
|
522
|
+
"erogenous",
|
|
523
|
+
"escort",
|
|
524
|
+
"explicit",
|
|
525
|
+
"facial",
|
|
526
|
+
"fetish",
|
|
527
|
+
"flirt",
|
|
528
|
+
"foreplay",
|
|
529
|
+
"genitals",
|
|
530
|
+
"groin",
|
|
531
|
+
"hardcore",
|
|
532
|
+
"hardon",
|
|
533
|
+
"horniness",
|
|
534
|
+
"horny",
|
|
535
|
+
"kamasutra",
|
|
536
|
+
"kinky",
|
|
537
|
+
"lewd",
|
|
538
|
+
"lingerie",
|
|
539
|
+
"lust",
|
|
540
|
+
"lustful",
|
|
541
|
+
"masturbate",
|
|
542
|
+
"mature",
|
|
543
|
+
"milf",
|
|
544
|
+
"naughty",
|
|
545
|
+
"naked",
|
|
546
|
+
"nipples",
|
|
547
|
+
"nude",
|
|
548
|
+
"obscene",
|
|
549
|
+
"oral",
|
|
550
|
+
"orgasm",
|
|
551
|
+
"penetration",
|
|
552
|
+
"penis",
|
|
553
|
+
"pleasure",
|
|
554
|
+
"porn",
|
|
555
|
+
"prostitute",
|
|
556
|
+
"provocative",
|
|
557
|
+
"pubic",
|
|
558
|
+
"pussy",
|
|
559
|
+
"seduce",
|
|
560
|
+
"seductive",
|
|
561
|
+
"sensual",
|
|
562
|
+
"sex",
|
|
563
|
+
"sexual",
|
|
564
|
+
"sperm",
|
|
565
|
+
"strip",
|
|
566
|
+
"striptease",
|
|
567
|
+
"swinger",
|
|
568
|
+
"testicles",
|
|
569
|
+
"thong",
|
|
570
|
+
"threesome",
|
|
571
|
+
"undies",
|
|
572
|
+
"undress",
|
|
573
|
+
"vagina",
|
|
574
|
+
"vibrator",
|
|
575
|
+
"wank",
|
|
576
|
+
"wet",
|
|
577
|
+
"hentai",
|
|
578
|
+
"bdsm",
|
|
579
|
+
"gay",
|
|
580
|
+
"lesbian",
|
|
581
|
+
"femboy",
|
|
582
|
+
"ass",
|
|
583
|
+
];
|
|
584
|
+
|
|
585
|
+
let shouldExclude = false;
|
|
586
|
+
const caption = await apexChecker(imageURL);
|
|
587
|
+
|
|
588
|
+
if (nsfw === true && caption) {
|
|
589
|
+
shouldExclude = nsfwWords.some(word => caption.includes(word));
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
if (deepCheck === true) {
|
|
593
|
+
shouldExclude = shouldExclude || nsfwWords.some(word => translatedText.text.includes(word));
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
if (!shouldExclude) {
|
|
597
|
+
response.push(imageURL);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return response;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
async function ApexChat(model: string, prompt: string): Promise<string> {
|
|
606
|
+
try {
|
|
607
|
+
if (prompt.length >= 2000) {
|
|
608
|
+
const chunks = [];
|
|
609
|
+
while (prompt.length > 0) {
|
|
610
|
+
chunks.push(prompt.substring(0, 2000));
|
|
611
|
+
prompt = prompt.substring(2000);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
const responses = await Promise.all(chunks.map(async (chunk) => {
|
|
615
|
+
return await processChunk(model, chunk);
|
|
616
|
+
}));
|
|
617
|
+
|
|
618
|
+
return responses.join('');
|
|
619
|
+
} else {
|
|
620
|
+
return await processChunk(model, prompt);
|
|
621
|
+
}
|
|
622
|
+
} catch (error: any) {
|
|
623
|
+
console.error(error.message);
|
|
624
|
+
return '';
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
async function processChunk(model: string, prompt: string): Promise<string> {
|
|
629
|
+
let response: string;
|
|
630
|
+
|
|
631
|
+
switch (model) {
|
|
632
|
+
case 'v3':
|
|
633
|
+
case 'v3-32k':
|
|
634
|
+
case 'turbo':
|
|
635
|
+
case 'turbo-16k':
|
|
636
|
+
case 'gemini':
|
|
637
|
+
response = (await hercai.question({ model: model as ChatModelOption, content: prompt })).reply;
|
|
638
|
+
break;
|
|
639
|
+
case 'apexChat':
|
|
640
|
+
response = await apexai(prompt);
|
|
641
|
+
break;
|
|
642
|
+
case 'starChat':
|
|
643
|
+
response = await starChat(prompt);
|
|
644
|
+
break;
|
|
645
|
+
case 'facebook-ai':
|
|
646
|
+
response = await facebook_ai(prompt);
|
|
647
|
+
break;
|
|
648
|
+
case 'yi-ai':
|
|
649
|
+
response = await yi_34b(prompt);
|
|
650
|
+
break;
|
|
651
|
+
default:
|
|
652
|
+
throw new Error('Invalid model.');
|
|
653
|
+
}
|
|
654
|
+
return response;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
async function apexChecker(urls: any) {
|
|
658
|
+
try {
|
|
659
|
+
let retryCount = 0;
|
|
660
|
+
const maxRetries = 3;
|
|
661
|
+
|
|
662
|
+
const fetchData = async () => {
|
|
663
|
+
try {
|
|
664
|
+
const response = await axios.post(
|
|
665
|
+
`https://api-inference.huggingface.co/models/Salesforce/blip-image-captioning-base`,
|
|
666
|
+
{ image: urls },
|
|
667
|
+
{
|
|
668
|
+
headers: {
|
|
669
|
+
"Content-Type": "application/json",
|
|
670
|
+
Authorization: `Bearer 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`,
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
);
|
|
674
|
+
|
|
675
|
+
if (response.status === 200) {
|
|
676
|
+
return response.data[0].generated_text;
|
|
677
|
+
} else {
|
|
678
|
+
console.error(
|
|
679
|
+
`Failed to fetch image captioning API: ${response.statusText}`,
|
|
680
|
+
);
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
} catch (e: any) {
|
|
684
|
+
console.error(`Error fetching data: ${e.message}`);
|
|
685
|
+
throw e;
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
while (retryCount < maxRetries) {
|
|
690
|
+
try {
|
|
691
|
+
return await fetchData();
|
|
692
|
+
} catch (e: any) {
|
|
693
|
+
console.error(
|
|
694
|
+
`Error fetching data (Retry ${retryCount + 1}): ${e.message}`,
|
|
695
|
+
);
|
|
696
|
+
retryCount++;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
return null;
|
|
701
|
+
} catch (e: any) {
|
|
702
|
+
console.error(`Error in attemptImageCaptioning: ${e.message}`);
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
async function checkJobStatus(jobId: string, retryCount = 3): Promise<string | null> {
|
|
708
|
+
try {
|
|
709
|
+
const getJobResponse = await sdk.getJob({ jobId: jobId });
|
|
710
|
+
const jobData = getJobResponse.data;
|
|
711
|
+
|
|
712
|
+
if (jobData.status === "generating" || jobData.status === "queued") {
|
|
713
|
+
if (retryCount > 0) {
|
|
714
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
715
|
+
return checkJobStatus(jobId, retryCount - 1);
|
|
716
|
+
} else {
|
|
717
|
+
console.error("Job failed after multiple retries:", jobData);
|
|
718
|
+
return null;
|
|
719
|
+
}
|
|
720
|
+
} else if (jobData.status === "succeeded") {
|
|
721
|
+
return jobData.imageUrl;
|
|
722
|
+
} else {
|
|
723
|
+
console.error("Job failed:", jobData);
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
} catch (error) {
|
|
727
|
+
console.error(error);
|
|
728
|
+
return null;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
export { ApexImagine, ApexChat };
|