apexify.js 3.3.10 → 4.0.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/README.md +183 -0
- package/dist/ai/ApexAI.d.ts +88 -8
- package/dist/ai/ApexAI.d.ts.map +1 -1
- package/dist/ai/ApexAI.js +61 -161
- package/dist/ai/ApexAI.js.map +1 -1
- package/dist/ai/direct-use.d.ts +9 -0
- package/dist/ai/direct-use.d.ts.map +1 -0
- package/dist/ai/direct-use.js +572 -0
- package/dist/ai/direct-use.js.map +1 -0
- package/dist/ai/functions/Gemini.d.ts +6 -0
- package/dist/ai/functions/Gemini.d.ts.map +1 -0
- package/dist/ai/functions/Gemini.js +103 -0
- package/dist/ai/functions/Gemini.js.map +1 -0
- package/dist/ai/functions/draw.d.ts +2 -1
- package/dist/ai/functions/draw.d.ts.map +1 -1
- package/dist/ai/functions/draw.js +476 -102
- package/dist/ai/functions/draw.js.map +1 -1
- package/dist/ai/functions/generateVoiceResponse.d.ts +3 -1
- package/dist/ai/functions/generateVoiceResponse.d.ts.map +1 -1
- package/dist/ai/functions/generateVoiceResponse.js +29 -18
- package/dist/ai/functions/generateVoiceResponse.js.map +1 -1
- package/dist/ai/functions/typeWriter.d.ts +1 -1
- package/dist/ai/functions/typeWriter.d.ts.map +1 -1
- package/dist/ai/functions/typeWriter.js +3 -2
- package/dist/ai/functions/typeWriter.js.map +1 -1
- package/dist/ai/functions/validOptions.d.ts +10 -0
- package/dist/ai/functions/validOptions.d.ts.map +1 -0
- package/dist/ai/functions/validOptions.js +130 -0
- package/dist/ai/functions/validOptions.js.map +1 -0
- package/dist/ai/modals-chat/Gemini-flash.d.ts +6 -0
- package/dist/ai/modals-chat/Gemini-flash.d.ts.map +1 -0
- package/dist/ai/modals-chat/Gemini-flash.js +111 -0
- package/dist/ai/modals-chat/Gemini-flash.js.map +1 -0
- package/dist/ai/modals-chat/Gemini-pro.d.ts +6 -0
- package/dist/ai/modals-chat/Gemini-pro.d.ts.map +1 -0
- package/dist/ai/modals-chat/Gemini-pro.js +96 -0
- package/dist/ai/modals-chat/Gemini-pro.js.map +1 -0
- package/dist/ai/modals-chat/apexChat.d.ts +2 -0
- package/dist/ai/modals-chat/apexChat.d.ts.map +1 -0
- package/dist/ai/modals-chat/apexChat.js +33 -0
- package/dist/ai/modals-chat/apexChat.js.map +1 -0
- package/dist/ai/modals-chat/config.d.ts +5 -0
- package/dist/ai/modals-chat/config.d.ts.map +1 -0
- package/dist/ai/modals-chat/config.js +13 -0
- package/dist/ai/modals-chat/config.js.map +1 -0
- package/dist/ai/modals-chat/facebook-ai.d.ts +2 -0
- package/dist/ai/modals-chat/facebook-ai.d.ts.map +1 -0
- package/dist/ai/modals-chat/facebook-ai.js +21 -0
- package/dist/ai/modals-chat/facebook-ai.js.map +1 -0
- package/dist/ai/modals-chat/gemma.d.ts +3 -0
- package/dist/ai/modals-chat/gemma.d.ts.map +1 -0
- package/dist/ai/modals-chat/gemma.js +54 -0
- package/dist/ai/modals-chat/gemma.js.map +1 -0
- package/dist/ai/modals-chat/modals.d.ts +8 -0
- package/dist/ai/modals-chat/modals.d.ts.map +1 -0
- package/dist/ai/modals-chat/modals.js +16 -0
- package/dist/ai/modals-chat/modals.js.map +1 -0
- package/dist/ai/modals-chat/starChat.d.ts +2 -0
- package/dist/ai/modals-chat/starChat.d.ts.map +1 -0
- package/dist/ai/modals-chat/starChat.js +32 -0
- package/dist/ai/modals-chat/starChat.js.map +1 -0
- package/dist/ai/modals-chat/yi-ai.d.ts +2 -0
- package/dist/ai/modals-chat/yi-ai.d.ts.map +1 -0
- package/dist/ai/modals-chat/yi-ai.js +41 -0
- package/dist/ai/modals-chat/yi-ai.js.map +1 -0
- package/dist/ai/utils.d.ts +3 -2
- package/dist/ai/utils.d.ts.map +1 -1
- package/dist/ai/utils.js +6 -4
- package/dist/ai/utils.js.map +1 -1
- package/dist/canvas/utils/general functions.js +1 -1
- package/dist/canvas/utils/general functions.js.map +1 -1
- package/lib/ai/ApexAI.ts +214 -224
- package/lib/ai/{models.ts → direct-use.ts} +9 -12
- package/lib/ai/functions/draw.ts +547 -149
- package/lib/ai/functions/generateVoiceResponse.ts +37 -22
- package/lib/ai/functions/typeWriter.ts +4 -2
- package/lib/ai/functions/validOptions.ts +210 -0
- package/lib/ai/modals-chat/Gemini-flash.ts +108 -0
- package/lib/ai/modals-chat/Gemini-pro.ts +93 -0
- package/lib/ai/modals-chat/apexChat.ts +31 -0
- package/lib/ai/modals-chat/config.ts +11 -0
- package/lib/ai/modals-chat/facebook-ai.ts +14 -0
- package/lib/ai/modals-chat/modals.ts +8 -0
- package/lib/ai/modals-chat/starChat.ts +31 -0
- package/lib/ai/modals-chat/yi-ai.ts +40 -0
- package/lib/ai/utils.ts +3 -1
- package/lib/canvas/utils/general functions.ts +1 -1
- package/package.json +5 -3
- package/lib/ai/functions/aivoice.ts +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
export async function yi_34b(prompt: string) {
|
|
4
|
+
try {
|
|
5
|
+
const messages = [
|
|
6
|
+
{ "role": "user", "content": prompt }
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
const formattedMessages = messages.map(message => `[${message.role}] ${message.content}`).join('\n');
|
|
10
|
+
|
|
11
|
+
const response = await axios.post(
|
|
12
|
+
`https://api-inference.huggingface.co/models/01-ai/Yi-1.5-34B-Chat`,
|
|
13
|
+
{ inputs: formattedMessages },
|
|
14
|
+
{
|
|
15
|
+
headers: {
|
|
16
|
+
'Authorization': `Bearer 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`,
|
|
17
|
+
'Content-Type': 'application/json'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const generatedText = response.data[0].generated_text;
|
|
23
|
+
const botIndex = generatedText.indexOf('[bot]', generatedText.indexOf('[user]'));
|
|
24
|
+
|
|
25
|
+
if (botIndex !== -1) {
|
|
26
|
+
let botResponse = generatedText.substring(botIndex);
|
|
27
|
+
const nextBotIndex = botResponse.indexOf('[bot]', 1);
|
|
28
|
+
const nextUserIndex = botResponse.indexOf('[user]', 1);
|
|
29
|
+
const endIndex = Math.min(nextBotIndex !== -1 ? nextBotIndex : botResponse.length, nextUserIndex !== -1 ? nextUserIndex : botResponse.length);
|
|
30
|
+
botResponse = botResponse.substring(0, endIndex);
|
|
31
|
+
botResponse = botResponse.substring(botResponse.indexOf('[bot]') + 5).trim();
|
|
32
|
+
return botResponse;
|
|
33
|
+
} else {
|
|
34
|
+
return generatedText;
|
|
35
|
+
}
|
|
36
|
+
} catch (error: any) {
|
|
37
|
+
console.error('Error:', error.response.data);
|
|
38
|
+
return 'Please wait, I am on cooldown.';
|
|
39
|
+
}
|
|
40
|
+
}
|
package/lib/ai/utils.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { toDraw } from "./functions/shouldDrawImage";
|
|
|
4
4
|
import { aiVoice } from "./functions/generateVoiceResponse";
|
|
5
5
|
import { aiImagine } from "./functions/draw";
|
|
6
6
|
import { readPdf, readTextFile } from "./functions/readFiles";
|
|
7
|
-
import { ApexChat, ApexImagine } from "./
|
|
7
|
+
import { ApexChat, ApexImagine } from "./direct-use";
|
|
8
8
|
import { typeWriter } from "./functions/typeWriter" ;
|
|
9
9
|
import { readImage } from "./functions/readImagess";
|
|
10
|
+
import { geminiPro } from "./modals-chat/Gemini-pro";
|
|
10
11
|
|
|
11
12
|
export {
|
|
12
13
|
chunkString,
|
|
@@ -20,4 +21,5 @@ export {
|
|
|
20
21
|
ApexChat,
|
|
21
22
|
ApexImagine,
|
|
22
23
|
typeWriter,
|
|
24
|
+
geminiPro,
|
|
23
25
|
};
|
|
@@ -209,7 +209,7 @@ export async function imgEffects(imagePath: string, filters: any[]) {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
const outputMimeType =
|
|
212
|
+
const outputMimeType = Jimp.MIME_PNG;
|
|
213
213
|
|
|
214
214
|
return await jimpImage.getBufferAsync(outputMimeType);
|
|
215
215
|
} catch (error: any) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apexify.js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Ai and Canvas library. Supports typescript and javascript",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"watch": "tsc -w",
|
|
10
10
|
"start": "node ./dist/index.js",
|
|
11
|
-
"dev": "
|
|
11
|
+
"dev": "ts-node ./lib/index.ts"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"lib",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"keywords": [
|
|
18
18
|
"manipulation",
|
|
19
|
+
"unlimited ai",
|
|
19
20
|
"node-charts",
|
|
20
21
|
"canvas-charts",
|
|
21
22
|
"pixman",
|
|
@@ -142,12 +143,13 @@
|
|
|
142
143
|
"author": "zenith-79",
|
|
143
144
|
"license": "MIT",
|
|
144
145
|
"dependencies": {
|
|
146
|
+
"@google/generative-ai": "^0.11.1",
|
|
145
147
|
"@iamtraction/google-translate": "^2.0.1",
|
|
146
148
|
"@napi-rs/canvas": "^0.1.51",
|
|
147
149
|
"api": "^6.1.1",
|
|
148
150
|
"gifencoder": "^2.0.1",
|
|
149
151
|
"hercai": "^12.2.0",
|
|
150
|
-
"jimp": "^0.
|
|
152
|
+
"jimp": "^0.3.11",
|
|
151
153
|
"pdf-parse": "^1.1.1",
|
|
152
154
|
"sharp": "^0.33.2",
|
|
153
155
|
"tesseract.js": "^5.0.5"
|
|
File without changes
|