apexify.js 4.8.1 → 4.8.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/cjs/ai/ApexAI.d.ts +0 -1
- package/dist/cjs/ai/ApexAI.js +56 -64
- package/dist/cjs/ai/ApexModules.d.ts +0 -1
- package/dist/cjs/ai/ApexModules.js +25 -33
- package/dist/cjs/ai/functions/readFiles.d.ts +0 -1
- package/dist/cjs/ai/functions/readFiles.js +11 -51
- package/dist/cjs/ai/functions/tokenizer.d.ts +0 -1
- package/dist/cjs/ai/functions/tokenizer.js +1 -5
- package/dist/cjs/ai/functions/validOptions.d.ts +0 -1
- package/dist/cjs/ai/functions/validOptions.js +13 -23
- package/dist/cjs/ai/modals/electronHub/chatmodels.d.ts +0 -1
- package/dist/cjs/ai/modals/electronHub/chatmodels.js +5 -12
- package/dist/cjs/ai/modals/electronHub/imageModels.d.ts +0 -1
- package/dist/cjs/ai/modals/electronHub/imageModels.js +10 -17
- package/dist/cjs/ai/modals/electronHub/songModels.d.ts +0 -1
- package/dist/cjs/ai/modals/electronHub/songModels.js +1 -3
- package/dist/cjs/ai/modals/electronHub/speechModels.d.ts +0 -1
- package/dist/cjs/ai/modals/electronHub/speechModels.js +7 -14
- package/dist/cjs/ai/modals/electronHub/videoModels.d.ts +0 -1
- package/dist/cjs/ai/modals/electronHub/videoModels.js +5 -12
- package/dist/cjs/ai/modals/groq/chatgroq.d.ts +0 -1
- package/dist/cjs/ai/modals/groq/chatgroq.js +4 -11
- package/dist/cjs/ai/modals/groq/imageAnalyzer.d.ts +0 -1
- package/dist/cjs/ai/modals/groq/imageAnalyzer.js +9 -16
- package/dist/cjs/ai/modals/groq/whisper.d.ts +0 -1
- package/dist/cjs/ai/modals/groq/whisper.js +20 -27
- package/dist/cjs/ai/modals/hercai/chatModels.d.ts +0 -1
- package/dist/cjs/ai/modals/hercai/chatModels.js +3 -7
- package/dist/cjs/ai/utils.d.ts +4 -6
- package/dist/cjs/ai/utils.js +4 -17
- package/dist/cjs/canvas/ApexPainter.d.ts +1 -2
- package/dist/cjs/canvas/ApexPainter.js +93 -101
- package/dist/cjs/canvas/utils/Background/bg.d.ts +1 -2
- package/dist/cjs/canvas/utils/Background/bg.js +8 -18
- package/dist/cjs/canvas/utils/Charts/charts.d.ts +1 -2
- package/dist/cjs/canvas/utils/Charts/charts.js +14 -23
- package/dist/cjs/canvas/utils/Custom/customLines.d.ts +1 -2
- package/dist/cjs/canvas/utils/Custom/customLines.js +4 -8
- package/dist/cjs/canvas/utils/General/conversion.d.ts +0 -1
- package/dist/cjs/canvas/utils/General/conversion.js +7 -15
- package/dist/cjs/canvas/utils/General/general functions.d.ts +1 -2
- package/dist/cjs/canvas/utils/General/general functions.js +48 -64
- package/dist/cjs/canvas/utils/Image/imageProperties.d.ts +1 -2
- package/dist/cjs/canvas/utils/Image/imageProperties.js +9 -21
- package/dist/cjs/canvas/utils/Texts/textProperties.d.ts +1 -2
- package/dist/cjs/canvas/utils/Texts/textProperties.js +3 -9
- package/dist/cjs/canvas/utils/types.d.ts +0 -1
- package/dist/cjs/canvas/utils/types.js +1 -3
- package/dist/cjs/canvas/utils/utils.d.ts +8 -9
- package/dist/cjs/canvas/utils/utils.js +8 -44
- package/dist/cjs/index.d.ts +5 -6
- package/dist/cjs/index.js +15 -65
- package/dist/cjs/utils.d.ts +3 -4
- package/dist/cjs/utils.js +4 -16
- package/dist/esm/ai/ApexAI.d.ts +0 -1
- package/dist/esm/ai/ApexAI.js +56 -64
- package/dist/esm/ai/ApexModules.d.ts +0 -1
- package/dist/esm/ai/ApexModules.js +25 -33
- package/dist/esm/ai/functions/readFiles.d.ts +0 -1
- package/dist/esm/ai/functions/readFiles.js +11 -51
- package/dist/esm/ai/functions/tokenizer.d.ts +0 -1
- package/dist/esm/ai/functions/tokenizer.js +1 -5
- package/dist/esm/ai/functions/validOptions.d.ts +0 -1
- package/dist/esm/ai/functions/validOptions.js +13 -23
- package/dist/esm/ai/modals/electronHub/chatmodels.d.ts +0 -1
- package/dist/esm/ai/modals/electronHub/chatmodels.js +5 -12
- package/dist/esm/ai/modals/electronHub/imageModels.d.ts +0 -1
- package/dist/esm/ai/modals/electronHub/imageModels.js +10 -17
- package/dist/esm/ai/modals/electronHub/songModels.d.ts +0 -1
- package/dist/esm/ai/modals/electronHub/songModels.js +1 -3
- package/dist/esm/ai/modals/electronHub/speechModels.d.ts +0 -1
- package/dist/esm/ai/modals/electronHub/speechModels.js +7 -14
- package/dist/esm/ai/modals/electronHub/videoModels.d.ts +0 -1
- package/dist/esm/ai/modals/electronHub/videoModels.js +5 -12
- package/dist/esm/ai/modals/groq/chatgroq.d.ts +0 -1
- package/dist/esm/ai/modals/groq/chatgroq.js +4 -11
- package/dist/esm/ai/modals/groq/imageAnalyzer.d.ts +0 -1
- package/dist/esm/ai/modals/groq/imageAnalyzer.js +9 -16
- package/dist/esm/ai/modals/groq/whisper.d.ts +0 -1
- package/dist/esm/ai/modals/groq/whisper.js +20 -27
- package/dist/esm/ai/modals/hercai/chatModels.d.ts +0 -1
- package/dist/esm/ai/modals/hercai/chatModels.js +3 -7
- package/dist/esm/ai/utils.d.ts +4 -6
- package/dist/esm/ai/utils.js +4 -17
- package/dist/esm/canvas/ApexPainter.d.ts +1 -2
- package/dist/esm/canvas/ApexPainter.js +93 -101
- package/dist/esm/canvas/utils/Background/bg.d.ts +1 -2
- package/dist/esm/canvas/utils/Background/bg.js +8 -18
- package/dist/esm/canvas/utils/Charts/charts.d.ts +1 -2
- package/dist/esm/canvas/utils/Charts/charts.js +14 -23
- package/dist/esm/canvas/utils/Custom/customLines.d.ts +1 -2
- package/dist/esm/canvas/utils/Custom/customLines.js +4 -8
- package/dist/esm/canvas/utils/General/conversion.d.ts +0 -1
- package/dist/esm/canvas/utils/General/conversion.js +7 -15
- package/dist/esm/canvas/utils/General/general functions.d.ts +1 -2
- package/dist/esm/canvas/utils/General/general functions.js +48 -64
- package/dist/esm/canvas/utils/Image/imageProperties.d.ts +1 -2
- package/dist/esm/canvas/utils/Image/imageProperties.js +9 -21
- package/dist/esm/canvas/utils/Texts/textProperties.d.ts +1 -2
- package/dist/esm/canvas/utils/Texts/textProperties.js +3 -9
- package/dist/esm/canvas/utils/types.d.ts +0 -1
- package/dist/esm/canvas/utils/types.js +1 -3
- package/dist/esm/canvas/utils/utils.d.ts +8 -9
- package/dist/esm/canvas/utils/utils.js +8 -44
- package/dist/esm/index.d.ts +5 -6
- package/dist/esm/index.js +15 -65
- package/dist/esm/utils.d.ts +3 -4
- package/dist/esm/utils.js +4 -16
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/ai/ApexAI.ts +2 -2
- package/lib/ai/ApexModules.ts +8 -8
- package/lib/ai/modals/electronHub/chatmodels.ts +1 -1
- package/lib/ai/modals/electronHub/imageModels.ts +2 -2
- package/lib/ai/modals/electronHub/speechModels.ts +1 -1
- package/lib/ai/utils.ts +3 -5
- package/lib/canvas/ApexPainter.ts +4 -4
- package/lib/canvas/utils/Background/bg.ts +1 -1
- package/lib/canvas/utils/Charts/charts.ts +1 -1
- package/lib/canvas/utils/Custom/customLines.ts +2 -2
- package/lib/canvas/utils/General/general functions.ts +1 -1
- package/lib/canvas/utils/Image/imageProperties.ts +1 -1
- package/lib/canvas/utils/Texts/textProperties.ts +1 -1
- package/lib/canvas/utils/utils.ts +8 -8
- package/lib/index.ts +5 -5
- package/lib/utils.ts +3 -3
- package/package.json +7 -5
- package/dist/cjs/ai/ApexAI.d.ts.map +0 -1
- package/dist/cjs/ai/ApexAI.js.map +0 -1
- package/dist/cjs/ai/ApexModules.d.ts.map +0 -1
- package/dist/cjs/ai/ApexModules.js.map +0 -1
- package/dist/cjs/ai/functions/readFiles.d.ts.map +0 -1
- package/dist/cjs/ai/functions/readFiles.js.map +0 -1
- package/dist/cjs/ai/functions/tokenizer.d.ts.map +0 -1
- package/dist/cjs/ai/functions/tokenizer.js.map +0 -1
- package/dist/cjs/ai/functions/typeWriter.d.ts +0 -2
- package/dist/cjs/ai/functions/typeWriter.d.ts.map +0 -1
- package/dist/cjs/ai/functions/typeWriter.js +0 -24
- package/dist/cjs/ai/functions/typeWriter.js.map +0 -1
- package/dist/cjs/ai/functions/validOptions.d.ts.map +0 -1
- package/dist/cjs/ai/functions/validOptions.js.map +0 -1
- package/dist/cjs/ai/modals/electronHub/chatmodels.d.ts.map +0 -1
- package/dist/cjs/ai/modals/electronHub/chatmodels.js.map +0 -1
- package/dist/cjs/ai/modals/electronHub/imageModels.d.ts.map +0 -1
- package/dist/cjs/ai/modals/electronHub/imageModels.js.map +0 -1
- package/dist/cjs/ai/modals/electronHub/songModels.d.ts.map +0 -1
- package/dist/cjs/ai/modals/electronHub/songModels.js.map +0 -1
- package/dist/cjs/ai/modals/electronHub/speechModels.d.ts.map +0 -1
- package/dist/cjs/ai/modals/electronHub/speechModels.js.map +0 -1
- package/dist/cjs/ai/modals/electronHub/videoModels.d.ts.map +0 -1
- package/dist/cjs/ai/modals/electronHub/videoModels.js.map +0 -1
- package/dist/cjs/ai/modals/groq/chatgroq.d.ts.map +0 -1
- package/dist/cjs/ai/modals/groq/chatgroq.js.map +0 -1
- package/dist/cjs/ai/modals/groq/imageAnalyzer.d.ts.map +0 -1
- package/dist/cjs/ai/modals/groq/imageAnalyzer.js.map +0 -1
- package/dist/cjs/ai/modals/groq/whisper.d.ts.map +0 -1
- package/dist/cjs/ai/modals/groq/whisper.js.map +0 -1
- package/dist/cjs/ai/modals/hercai/chatModels.d.ts.map +0 -1
- package/dist/cjs/ai/modals/hercai/chatModels.js.map +0 -1
- package/dist/cjs/ai/utils.d.ts.map +0 -1
- package/dist/cjs/ai/utils.js.map +0 -1
- package/dist/cjs/canvas/ApexPainter.d.ts.map +0 -1
- package/dist/cjs/canvas/ApexPainter.js.map +0 -1
- package/dist/cjs/canvas/Themes/Level-Up/levelup.d.ts +0 -11
- package/dist/cjs/canvas/Themes/Level-Up/levelup.d.ts.map +0 -1
- package/dist/cjs/canvas/Themes/Level-Up/levelup.js +0 -163
- package/dist/cjs/canvas/Themes/Level-Up/levelup.js.map +0 -1
- package/dist/cjs/canvas/utils/Background/bg.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/Background/bg.js.map +0 -1
- package/dist/cjs/canvas/utils/Charts/charts.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/Charts/charts.js.map +0 -1
- package/dist/cjs/canvas/utils/Custom/customLines.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/Custom/customLines.js.map +0 -1
- package/dist/cjs/canvas/utils/General/conversion.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/General/conversion.js.map +0 -1
- package/dist/cjs/canvas/utils/General/general functions.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/General/general functions.js.map +0 -1
- package/dist/cjs/canvas/utils/Image/imageProperties.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/Image/imageProperties.js.map +0 -1
- package/dist/cjs/canvas/utils/Texts/textProperties.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/Texts/textProperties.js.map +0 -1
- package/dist/cjs/canvas/utils/types.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/types.js.map +0 -1
- package/dist/cjs/canvas/utils/utils.d.ts.map +0 -1
- package/dist/cjs/canvas/utils/utils.js.map +0 -1
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/cjs/utils.d.ts.map +0 -1
- package/dist/cjs/utils.js.map +0 -1
- package/dist/esm/ai/ApexAI.d.ts.map +0 -1
- package/dist/esm/ai/ApexAI.js.map +0 -1
- package/dist/esm/ai/ApexModules.d.ts.map +0 -1
- package/dist/esm/ai/ApexModules.js.map +0 -1
- package/dist/esm/ai/functions/readFiles.d.ts.map +0 -1
- package/dist/esm/ai/functions/readFiles.js.map +0 -1
- package/dist/esm/ai/functions/tokenizer.d.ts.map +0 -1
- package/dist/esm/ai/functions/tokenizer.js.map +0 -1
- package/dist/esm/ai/functions/typeWriter.d.ts +0 -2
- package/dist/esm/ai/functions/typeWriter.d.ts.map +0 -1
- package/dist/esm/ai/functions/typeWriter.js +0 -24
- package/dist/esm/ai/functions/typeWriter.js.map +0 -1
- package/dist/esm/ai/functions/validOptions.d.ts.map +0 -1
- package/dist/esm/ai/functions/validOptions.js.map +0 -1
- package/dist/esm/ai/modals/electronHub/chatmodels.d.ts.map +0 -1
- package/dist/esm/ai/modals/electronHub/chatmodels.js.map +0 -1
- package/dist/esm/ai/modals/electronHub/imageModels.d.ts.map +0 -1
- package/dist/esm/ai/modals/electronHub/imageModels.js.map +0 -1
- package/dist/esm/ai/modals/electronHub/songModels.d.ts.map +0 -1
- package/dist/esm/ai/modals/electronHub/songModels.js.map +0 -1
- package/dist/esm/ai/modals/electronHub/speechModels.d.ts.map +0 -1
- package/dist/esm/ai/modals/electronHub/speechModels.js.map +0 -1
- package/dist/esm/ai/modals/electronHub/videoModels.d.ts.map +0 -1
- package/dist/esm/ai/modals/electronHub/videoModels.js.map +0 -1
- package/dist/esm/ai/modals/groq/chatgroq.d.ts.map +0 -1
- package/dist/esm/ai/modals/groq/chatgroq.js.map +0 -1
- package/dist/esm/ai/modals/groq/imageAnalyzer.d.ts.map +0 -1
- package/dist/esm/ai/modals/groq/imageAnalyzer.js.map +0 -1
- package/dist/esm/ai/modals/groq/whisper.d.ts.map +0 -1
- package/dist/esm/ai/modals/groq/whisper.js.map +0 -1
- package/dist/esm/ai/modals/hercai/chatModels.d.ts.map +0 -1
- package/dist/esm/ai/modals/hercai/chatModels.js.map +0 -1
- package/dist/esm/ai/utils.d.ts.map +0 -1
- package/dist/esm/ai/utils.js.map +0 -1
- package/dist/esm/canvas/ApexPainter.d.ts.map +0 -1
- package/dist/esm/canvas/ApexPainter.js.map +0 -1
- package/dist/esm/canvas/Themes/Level-Up/levelup.d.ts +0 -11
- package/dist/esm/canvas/Themes/Level-Up/levelup.d.ts.map +0 -1
- package/dist/esm/canvas/Themes/Level-Up/levelup.js +0 -163
- package/dist/esm/canvas/Themes/Level-Up/levelup.js.map +0 -1
- package/dist/esm/canvas/utils/Background/bg.d.ts.map +0 -1
- package/dist/esm/canvas/utils/Background/bg.js.map +0 -1
- package/dist/esm/canvas/utils/Charts/charts.d.ts.map +0 -1
- package/dist/esm/canvas/utils/Charts/charts.js.map +0 -1
- package/dist/esm/canvas/utils/Custom/customLines.d.ts.map +0 -1
- package/dist/esm/canvas/utils/Custom/customLines.js.map +0 -1
- package/dist/esm/canvas/utils/General/conversion.d.ts.map +0 -1
- package/dist/esm/canvas/utils/General/conversion.js.map +0 -1
- package/dist/esm/canvas/utils/General/general functions.d.ts.map +0 -1
- package/dist/esm/canvas/utils/General/general functions.js.map +0 -1
- package/dist/esm/canvas/utils/Image/imageProperties.d.ts.map +0 -1
- package/dist/esm/canvas/utils/Image/imageProperties.js.map +0 -1
- package/dist/esm/canvas/utils/Texts/textProperties.d.ts.map +0 -1
- package/dist/esm/canvas/utils/Texts/textProperties.js.map +0 -1
- package/dist/esm/canvas/utils/types.d.ts.map +0 -1
- package/dist/esm/canvas/utils/types.js.map +0 -1
- package/dist/esm/canvas/utils/utils.d.ts.map +0 -1
- package/dist/esm/canvas/utils/utils.js.map +0 -1
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/esm/utils.d.ts.map +0 -1
- package/dist/esm/utils.js.map +0 -1
- package/lib/ai/functions/typeWriter.ts +0 -24
- package/lib/canvas/Themes/Level-Up/levelup.ts +0 -183
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
* @param drawBackgroundGradient The function for drawing a gradient background on the canvas.
|
|
8
8
|
* @param customBackground The function for drawing a custom background image on the canvas.
|
|
9
9
|
*/
|
|
10
|
-
import { OutputFormat, CanvasConfig, ImageProperties, TextObject, GIFOptions, GIFResults, CustomOptions, cropOptions, GradientConfig, Frame, PatternOptions, ExtractFramesOptions, ResizeOptions, CropOptions, MaskOptions, BlendOptions } from "./types";
|
|
11
|
-
import { drawBackgroundColor, drawBackgroundGradient, customBackground, backgroundRadius } from "./Background/bg";
|
|
12
|
-
import { applyRotation, imageRadius, applyStroke, applyZoom, applyShadow, objectRadius, drawShape, applyPerspective } from './Image/imageProperties';
|
|
13
|
-
import { drawText, WrappedText } from "./Texts/textProperties";
|
|
14
|
-
import { loadImages, resizingImg, converter, applyColorFilters, imgEffects, cropOuter, cropInner, detectColors, removeColor, bgRemoval } from './General/general functions';
|
|
15
|
-
import { customLines } from "./Custom/customLines";
|
|
16
|
-
import { verticalBarChart, pieChart, lineChart } from './Charts/charts';
|
|
17
|
-
import { url, arrayBuffer, base64, dataURL, blob } from "./General/conversion";
|
|
10
|
+
import { OutputFormat, CanvasConfig, ImageProperties, TextObject, GIFOptions, GIFResults, CustomOptions, cropOptions, GradientConfig, Frame, PatternOptions, ExtractFramesOptions, ResizeOptions, CropOptions, MaskOptions, BlendOptions } from "./types.js";
|
|
11
|
+
import { drawBackgroundColor, drawBackgroundGradient, customBackground, backgroundRadius } from "./Background/bg.js";
|
|
12
|
+
import { applyRotation, imageRadius, applyStroke, applyZoom, applyShadow, objectRadius, drawShape, applyPerspective } from './Image/imageProperties.js';
|
|
13
|
+
import { drawText, WrappedText } from "./Texts/textProperties.js";
|
|
14
|
+
import { loadImages, resizingImg, converter, applyColorFilters, imgEffects, cropOuter, cropInner, detectColors, removeColor, bgRemoval } from './General/general functions.js';
|
|
15
|
+
import { customLines } from "./Custom/customLines.js";
|
|
16
|
+
import { verticalBarChart, pieChart, lineChart } from './Charts/charts.js';
|
|
17
|
+
import { url, arrayBuffer, base64, dataURL, blob } from "./General/conversion.js";
|
|
18
18
|
export { url, OutputFormat, arrayBuffer, base64, dataURL, blob, CanvasConfig, ImageProperties, TextObject, GIFOptions, GIFResults, CustomOptions, cropOptions, customLines, drawBackgroundColor, drawBackgroundGradient, customBackground, applyRotation, imageRadius, applyStroke, applyZoom, applyShadow, objectRadius, backgroundRadius, drawShape, drawText, WrappedText, loadImages, resizingImg, converter, applyColorFilters, imgEffects, verticalBarChart, pieChart, lineChart, cropInner, cropOuter, detectColors, removeColor, bgRemoval, GradientConfig, Frame, PatternOptions, ExtractFramesOptions, ResizeOptions, CropOptions, applyPerspective, MaskOptions, BlendOptions };
|
|
19
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Exported utilities for handling canvas configurations and drawing operations.
|
|
4
3
|
* @param CanvasConfig The configuration options for the canvas.
|
|
@@ -8,46 +7,11 @@
|
|
|
8
7
|
* @param drawBackgroundGradient The function for drawing a gradient background on the canvas.
|
|
9
8
|
* @param customBackground The function for drawing a custom background image on the canvas.
|
|
10
9
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(exports, "applyRotation", { enumerable: true, get: function () { return imageProperties_1.applyRotation; } });
|
|
20
|
-
Object.defineProperty(exports, "imageRadius", { enumerable: true, get: function () { return imageProperties_1.imageRadius; } });
|
|
21
|
-
Object.defineProperty(exports, "applyStroke", { enumerable: true, get: function () { return imageProperties_1.applyStroke; } });
|
|
22
|
-
Object.defineProperty(exports, "applyZoom", { enumerable: true, get: function () { return imageProperties_1.applyZoom; } });
|
|
23
|
-
Object.defineProperty(exports, "applyShadow", { enumerable: true, get: function () { return imageProperties_1.applyShadow; } });
|
|
24
|
-
Object.defineProperty(exports, "objectRadius", { enumerable: true, get: function () { return imageProperties_1.objectRadius; } });
|
|
25
|
-
Object.defineProperty(exports, "drawShape", { enumerable: true, get: function () { return imageProperties_1.drawShape; } });
|
|
26
|
-
Object.defineProperty(exports, "applyPerspective", { enumerable: true, get: function () { return imageProperties_1.applyPerspective; } });
|
|
27
|
-
const textProperties_1 = require("./Texts/textProperties");
|
|
28
|
-
Object.defineProperty(exports, "drawText", { enumerable: true, get: function () { return textProperties_1.drawText; } });
|
|
29
|
-
Object.defineProperty(exports, "WrappedText", { enumerable: true, get: function () { return textProperties_1.WrappedText; } });
|
|
30
|
-
const general_functions_1 = require("./General/general functions");
|
|
31
|
-
Object.defineProperty(exports, "loadImages", { enumerable: true, get: function () { return general_functions_1.loadImages; } });
|
|
32
|
-
Object.defineProperty(exports, "resizingImg", { enumerable: true, get: function () { return general_functions_1.resizingImg; } });
|
|
33
|
-
Object.defineProperty(exports, "converter", { enumerable: true, get: function () { return general_functions_1.converter; } });
|
|
34
|
-
Object.defineProperty(exports, "applyColorFilters", { enumerable: true, get: function () { return general_functions_1.applyColorFilters; } });
|
|
35
|
-
Object.defineProperty(exports, "imgEffects", { enumerable: true, get: function () { return general_functions_1.imgEffects; } });
|
|
36
|
-
Object.defineProperty(exports, "cropOuter", { enumerable: true, get: function () { return general_functions_1.cropOuter; } });
|
|
37
|
-
Object.defineProperty(exports, "cropInner", { enumerable: true, get: function () { return general_functions_1.cropInner; } });
|
|
38
|
-
Object.defineProperty(exports, "detectColors", { enumerable: true, get: function () { return general_functions_1.detectColors; } });
|
|
39
|
-
Object.defineProperty(exports, "removeColor", { enumerable: true, get: function () { return general_functions_1.removeColor; } });
|
|
40
|
-
Object.defineProperty(exports, "bgRemoval", { enumerable: true, get: function () { return general_functions_1.bgRemoval; } });
|
|
41
|
-
const customLines_1 = require("./Custom/customLines");
|
|
42
|
-
Object.defineProperty(exports, "customLines", { enumerable: true, get: function () { return customLines_1.customLines; } });
|
|
43
|
-
const charts_1 = require("./Charts/charts");
|
|
44
|
-
Object.defineProperty(exports, "verticalBarChart", { enumerable: true, get: function () { return charts_1.verticalBarChart; } });
|
|
45
|
-
Object.defineProperty(exports, "pieChart", { enumerable: true, get: function () { return charts_1.pieChart; } });
|
|
46
|
-
Object.defineProperty(exports, "lineChart", { enumerable: true, get: function () { return charts_1.lineChart; } });
|
|
47
|
-
const conversion_1 = require("./General/conversion");
|
|
48
|
-
Object.defineProperty(exports, "url", { enumerable: true, get: function () { return conversion_1.url; } });
|
|
49
|
-
Object.defineProperty(exports, "arrayBuffer", { enumerable: true, get: function () { return conversion_1.arrayBuffer; } });
|
|
50
|
-
Object.defineProperty(exports, "base64", { enumerable: true, get: function () { return conversion_1.base64; } });
|
|
51
|
-
Object.defineProperty(exports, "dataURL", { enumerable: true, get: function () { return conversion_1.dataURL; } });
|
|
52
|
-
Object.defineProperty(exports, "blob", { enumerable: true, get: function () { return conversion_1.blob; } });
|
|
53
|
-
//# sourceMappingURL=utils.js.map
|
|
10
|
+
import { drawBackgroundColor, drawBackgroundGradient, customBackground, backgroundRadius } from "./Background/bg.js";
|
|
11
|
+
import { applyRotation, imageRadius, applyStroke, applyZoom, applyShadow, objectRadius, drawShape, applyPerspective } from './Image/imageProperties.js';
|
|
12
|
+
import { drawText, WrappedText } from "./Texts/textProperties.js";
|
|
13
|
+
import { loadImages, resizingImg, converter, applyColorFilters, imgEffects, cropOuter, cropInner, detectColors, removeColor, bgRemoval } from './General/general functions.js';
|
|
14
|
+
import { customLines } from "./Custom/customLines.js";
|
|
15
|
+
import { verticalBarChart, pieChart, lineChart } from './Charts/charts.js';
|
|
16
|
+
import { url, arrayBuffer, base64, dataURL, blob } from "./General/conversion.js";
|
|
17
|
+
export { url, arrayBuffer, base64, dataURL, blob, customLines, drawBackgroundColor, drawBackgroundGradient, customBackground, applyRotation, imageRadius, applyStroke, applyZoom, applyShadow, objectRadius, backgroundRadius, drawShape, drawText, WrappedText, loadImages, resizingImg, converter, applyColorFilters, imgEffects, verticalBarChart, pieChart, lineChart, cropInner, cropOuter, detectColors, removeColor, bgRemoval, applyPerspective };
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ApexAI, ApexChat, ApexImagine, ApexPainter, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory } from "./utils";
|
|
2
|
-
import { validateModels } from "./ai/functions/validOptions";
|
|
3
|
-
import { groqAnalyzer } from "./ai/utils";
|
|
4
|
-
export * from "./canvas/utils/utils";
|
|
5
|
-
export * from "./canvas/utils/types";
|
|
1
|
+
import { ApexAI, ApexChat, ApexImagine, ApexPainter, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory } from "./utils.js";
|
|
2
|
+
import { validateModels } from "./ai/functions/validOptions.js";
|
|
3
|
+
import { groqAnalyzer } from "./ai/utils.js";
|
|
4
|
+
export * from "./canvas/utils/utils.js";
|
|
5
|
+
export * from "./canvas/utils/types.js";
|
|
6
6
|
declare const ApexFileReader: typeof readFile;
|
|
7
7
|
declare const ApexImageAnalyzer: typeof groqAnalyzer;
|
|
8
8
|
export { ApexPainter, ApexAI, ApexImagine, ApexChat, validateModels, ApexListener, ApexFileReader, ApexImageAnalyzer, ApexVideo, ApexText2Speech, resetHistory };
|
|
@@ -26,4 +26,3 @@ declare const Apexify: {
|
|
|
26
26
|
resetHistory: typeof resetHistory;
|
|
27
27
|
};
|
|
28
28
|
export default Apexify;
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,45 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.resetHistory = exports.ApexText2Speech = exports.ApexVideo = exports.ApexImageAnalyzer = exports.ApexFileReader = exports.ApexListener = exports.validateModels = exports.ApexChat = exports.ApexImagine = exports.ApexAI = exports.ApexPainter = void 0;
|
|
40
|
-
const path = __importStar(require("path"));
|
|
41
|
-
const fs = __importStar(require("fs"));
|
|
42
|
-
const child_process_1 = require("child_process");
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import { execSync } from "child_process";
|
|
43
4
|
const CYAN = "\x1b[36m";
|
|
44
5
|
const GREEN = "\x1b[32m";
|
|
45
6
|
const RED = "\x1b[31m";
|
|
@@ -73,7 +34,7 @@ fetch("https://registry.npmjs.com/-/v1/search?text=apexify.js")
|
|
|
73
34
|
console.log(`${CYAN}🚀 A new version of Apexify.js is available: ${latestVersion}${RESET}`);
|
|
74
35
|
console.log(`${CYAN}📦 Updating Apexify.js...${RESET}`);
|
|
75
36
|
try {
|
|
76
|
-
|
|
37
|
+
execSync("npm install apexify.js@latest", { stdio: "inherit" });
|
|
77
38
|
console.log(`${GREEN}✅ Apexify.js has been successfully updated to version ${latestVersion}.${RESET}`);
|
|
78
39
|
}
|
|
79
40
|
catch (error) {
|
|
@@ -91,27 +52,16 @@ if (!installedVersion || installedVersion === "Not installed") {
|
|
|
91
52
|
else {
|
|
92
53
|
console.log(`${GREEN}✅ Apexify.js is already installed (Version: ${installedVersion}).${RESET}`);
|
|
93
54
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Object.defineProperty(exports, "resetHistory", { enumerable: true, get: function () { return utils_1.resetHistory; } });
|
|
103
|
-
const validOptions_1 = require("./ai/functions/validOptions");
|
|
104
|
-
Object.defineProperty(exports, "validateModels", { enumerable: true, get: function () { return validOptions_1.validateModels; } });
|
|
105
|
-
const utils_2 = require("./ai/utils");
|
|
106
|
-
__exportStar(require("./canvas/utils/utils"), exports);
|
|
107
|
-
__exportStar(require("./canvas/utils/types"), exports);
|
|
108
|
-
const ApexFileReader = utils_1.readFile;
|
|
109
|
-
exports.ApexFileReader = ApexFileReader;
|
|
110
|
-
const ApexImageAnalyzer = utils_2.groqAnalyzer;
|
|
111
|
-
exports.ApexImageAnalyzer = ApexImageAnalyzer;
|
|
55
|
+
import { ApexAI, ApexChat, ApexImagine, ApexPainter, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory } from "./utils.js";
|
|
56
|
+
import { validateModels } from "./ai/functions/validOptions.js";
|
|
57
|
+
import { groqAnalyzer } from "./ai/utils.js";
|
|
58
|
+
export * from "./canvas/utils/utils.js";
|
|
59
|
+
export * from "./canvas/utils/types.js";
|
|
60
|
+
const ApexFileReader = readFile;
|
|
61
|
+
const ApexImageAnalyzer = groqAnalyzer;
|
|
62
|
+
export { ApexPainter, ApexAI, ApexImagine, ApexChat, validateModels, ApexListener, ApexFileReader, ApexImageAnalyzer, ApexVideo, ApexText2Speech, resetHistory };
|
|
112
63
|
const Apexify = {
|
|
113
|
-
ApexPainter
|
|
114
|
-
ApexFileReader, ApexImageAnalyzer, ApexVideo
|
|
64
|
+
ApexPainter, ApexAI, ApexImagine, ApexChat, validateModels, ApexListener,
|
|
65
|
+
ApexFileReader, ApexImageAnalyzer, ApexVideo, ApexText2Speech, resetHistory
|
|
115
66
|
};
|
|
116
|
-
|
|
117
|
-
//# sourceMappingURL=index.js.map
|
|
67
|
+
export default Apexify;
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ApexPainter } from "./canvas/ApexPainter";
|
|
2
|
-
import { ApexAI } from "./ai/ApexAI";
|
|
3
|
-
import { ApexChat, ApexImagine, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory } from "./ai/utils";
|
|
1
|
+
import { ApexPainter } from "./canvas/ApexPainter.js";
|
|
2
|
+
import { ApexAI } from "./ai/ApexAI.js";
|
|
3
|
+
import { ApexChat, ApexImagine, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory } from "./ai/utils.js";
|
|
4
4
|
export { ApexPainter, ApexAI, ApexImagine, ApexChat, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory };
|
|
5
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/cjs/utils.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "ApexPainter", { enumerable: true, get: function () { return ApexPainter_1.ApexPainter; } });
|
|
6
|
-
const ApexAI_1 = require("./ai/ApexAI");
|
|
7
|
-
Object.defineProperty(exports, "ApexAI", { enumerable: true, get: function () { return ApexAI_1.ApexAI; } });
|
|
8
|
-
const utils_1 = require("./ai/utils");
|
|
9
|
-
Object.defineProperty(exports, "ApexChat", { enumerable: true, get: function () { return utils_1.ApexChat; } });
|
|
10
|
-
Object.defineProperty(exports, "ApexImagine", { enumerable: true, get: function () { return utils_1.ApexImagine; } });
|
|
11
|
-
Object.defineProperty(exports, "ApexListener", { enumerable: true, get: function () { return utils_1.ApexListener; } });
|
|
12
|
-
Object.defineProperty(exports, "readFile", { enumerable: true, get: function () { return utils_1.readFile; } });
|
|
13
|
-
Object.defineProperty(exports, "ApexVideo", { enumerable: true, get: function () { return utils_1.ApexVideo; } });
|
|
14
|
-
Object.defineProperty(exports, "ApexText2Speech", { enumerable: true, get: function () { return utils_1.ApexText2Speech; } });
|
|
15
|
-
Object.defineProperty(exports, "resetHistory", { enumerable: true, get: function () { return utils_1.resetHistory; } });
|
|
16
|
-
//# sourceMappingURL=utils.js.map
|
|
1
|
+
import { ApexPainter } from "./canvas/ApexPainter.js";
|
|
2
|
+
import { ApexAI } from "./ai/ApexAI.js";
|
|
3
|
+
import { ApexChat, ApexImagine, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory } from "./ai/utils.js";
|
|
4
|
+
export { ApexPainter, ApexAI, ApexImagine, ApexChat, ApexListener, readFile, ApexVideo, ApexText2Speech, resetHistory };
|
package/dist/esm/ai/ApexAI.d.ts
CHANGED
|
@@ -142,4 +142,3 @@ export interface Options {
|
|
|
142
142
|
}
|
|
143
143
|
export declare function ApexAI(message: Message, ApexOptions: Options): Promise<any>;
|
|
144
144
|
export declare function handleVoiceAI(message: any, voiceChannelId: string, chat: any, modelName?: string, personality?: string): Promise<any>;
|
|
145
|
-
//# sourceMappingURL=ApexAI.d.ts.map
|
package/dist/esm/ai/ApexAI.js
CHANGED
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const voice_1 = require("@discordjs/voice");
|
|
11
|
-
const whisper_1 = require("./modals/groq/whisper");
|
|
12
|
-
const stream_1 = require("stream");
|
|
13
|
-
const prism_media_1 = __importDefault(require("prism-media"));
|
|
14
|
-
const path_1 = __importDefault(require("path"));
|
|
15
|
-
const fs_1 = __importDefault(require("fs"));
|
|
16
|
-
const child_process_1 = require("child_process");
|
|
1
|
+
import { groqAnalyzer, readFile, ApexImagine, ApexText2Speech, ApexListener, ApexChat } from "./utils.js";
|
|
2
|
+
import { ActionRowBuilder, EmbedBuilder, AttachmentBuilder, ButtonStyle, ButtonBuilder, PermissionFlagsBits } from "discord.js";
|
|
3
|
+
import { joinVoiceChannel, createAudioPlayer, createAudioResource, EndBehaviorType, AudioPlayerStatus } from "@discordjs/voice";
|
|
4
|
+
import { whisper } from "./modals/groq/whisper.js";
|
|
5
|
+
import { pipeline, Readable } from "stream";
|
|
6
|
+
import prism from "prism-media";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
import { execSync } from "child_process";
|
|
17
10
|
function createButtonRows(buttons) {
|
|
18
11
|
if (!Array.isArray(buttons) || buttons.length === 0)
|
|
19
12
|
return [];
|
|
20
13
|
const buttonRows = [];
|
|
21
|
-
let currentRow = new
|
|
14
|
+
let currentRow = new ActionRowBuilder();
|
|
22
15
|
for (const button of buttons) {
|
|
23
16
|
if (!button.label || !button.style || !button.custom_id)
|
|
24
17
|
continue;
|
|
25
|
-
const buttonComponent = new
|
|
18
|
+
const buttonComponent = new ButtonBuilder()
|
|
26
19
|
.setLabel(button.label)
|
|
27
20
|
.setStyle(button.style)
|
|
28
21
|
.setCustomId(button.custom_id);
|
|
29
22
|
if (button.emoji)
|
|
30
23
|
buttonComponent.setEmoji(button.emoji);
|
|
31
|
-
if (button.url && button.style ===
|
|
24
|
+
if (button.url && button.style === ButtonStyle.Link)
|
|
32
25
|
buttonComponent.setURL(button.url);
|
|
33
26
|
currentRow.addComponents(buttonComponent);
|
|
34
27
|
if (currentRow.components.length === 5) {
|
|
35
28
|
buttonRows.push(currentRow);
|
|
36
|
-
currentRow = new
|
|
29
|
+
currentRow = new ActionRowBuilder();
|
|
37
30
|
}
|
|
38
31
|
}
|
|
39
32
|
if (currentRow.components.length > 0) {
|
|
@@ -41,7 +34,7 @@ function createButtonRows(buttons) {
|
|
|
41
34
|
}
|
|
42
35
|
return buttonRows.slice(0, 5);
|
|
43
36
|
}
|
|
44
|
-
async function ApexAI(message, ApexOptions) {
|
|
37
|
+
export async function ApexAI(message, ApexOptions) {
|
|
45
38
|
if (!message.guild || message.author.bot)
|
|
46
39
|
return;
|
|
47
40
|
let prompt = message.content || "";
|
|
@@ -87,18 +80,18 @@ async function ApexAI(message, ApexOptions) {
|
|
|
87
80
|
console.error("Audio file exceeds 25MB.");
|
|
88
81
|
continue;
|
|
89
82
|
}
|
|
90
|
-
prompt += `\n> Transcribed from audio:\n${await
|
|
83
|
+
prompt += `\n> Transcribed from audio:\n${await whisper(prompt, url)}`;
|
|
91
84
|
}
|
|
92
85
|
else if (["image/png", "image/jpeg", "image/jpg", "image/webp"].includes(contentType)) {
|
|
93
86
|
if (!Api_Keys?.groq_API) {
|
|
94
87
|
console.error("Missing Groq API Key.");
|
|
95
88
|
continue;
|
|
96
89
|
}
|
|
97
|
-
prompt += `\n> Image analysis:\n${await
|
|
90
|
+
prompt += `\n> Image analysis:\n${await groqAnalyzer({ img: url, ApiKey: Api_Keys.groq_API })}`;
|
|
98
91
|
}
|
|
99
92
|
else if (attachment.name.endsWith(".pdf") || attachment.name.endsWith(".txt")) {
|
|
100
93
|
const fileType = attachment.name.endsWith(".pdf") ? "pdf" : "txt";
|
|
101
|
-
const fileContent = await
|
|
94
|
+
const fileContent = await readFile(url, fileType);
|
|
102
95
|
prompt += `\n\n- 📜 ${attachment.name} content:\n${fileContent}`;
|
|
103
96
|
}
|
|
104
97
|
else {
|
|
@@ -120,7 +113,7 @@ async function ApexAI(message, ApexOptions) {
|
|
|
120
113
|
prevReply += fetchedMessage.content || "";
|
|
121
114
|
const firstAttachment = fetchedMessage.attachments?.first();
|
|
122
115
|
if (firstAttachment && /\.(png|jpg|jpeg|webp)$/i.test(firstAttachment.url)) {
|
|
123
|
-
prevReply += await
|
|
116
|
+
prevReply += await groqAnalyzer({
|
|
124
117
|
img: firstAttachment.url,
|
|
125
118
|
ApiKey: Api_Keys?.groq_API,
|
|
126
119
|
prompt,
|
|
@@ -167,14 +160,14 @@ async function ApexAI(message, ApexOptions) {
|
|
|
167
160
|
let tempEnhancer;
|
|
168
161
|
if (enhancer) {
|
|
169
162
|
const enhancementRequest = `Rewrite this text below in a more descriptive way, making it clearer to be visualized correctly by an AI image generator. Use stronger words and return only the enhanced prompt—nothing more, nothing less.\n\n`;
|
|
170
|
-
tempEnhancer = await
|
|
163
|
+
tempEnhancer = await ApexChat("gpt-4-turbo", prompt, { instruction: enhancementRequest });
|
|
171
164
|
}
|
|
172
|
-
genImage = await
|
|
165
|
+
genImage = await ApexImagine(imagine?.imageModel, tempEnhancer || prompt, { width: imagine?.enhancer?.width, height: imagine?.enhancer?.height, format: imagine?.enhancer?.format,
|
|
173
166
|
quality: imagine?.enhancer?.quality, negative_prompt: imagine?.enhancer?.negative_prompt, nsfw: imagine?.nsfw?.enable,
|
|
174
167
|
nsfwWords: imagine?.nsfw?.keywords, deepCheck: imagine?.nsfw?.deepCheck, count: imagine?.numOfImages });
|
|
175
168
|
instruction += `\n\nThe image has already been generated. Do not attempt to generate or describe another image. Instead, provide feedback, thoughts, or a critique based on the given prompt:\n\n`;
|
|
176
169
|
}
|
|
177
|
-
aiResponse = await
|
|
170
|
+
aiResponse = await ApexChat(chat?.chatModel, prompt, { instruction, memory: chat?.memory?.memoryOn, userId: chat?.memory?.id, limit: chat?.memory?.limit, threshold: chat?.memory?.threshold });
|
|
178
171
|
}
|
|
179
172
|
else if (voiceEnabled) {
|
|
180
173
|
let instruction = chat?.instruction;
|
|
@@ -183,24 +176,24 @@ async function ApexAI(message, ApexOptions) {
|
|
|
183
176
|
let tempEnhancer;
|
|
184
177
|
if (enhancer) {
|
|
185
178
|
const enhancementRequest = `Rewrite this text below in a more descriptive way, making it clearer to be visualized correctly by an AI image generator. Use stronger words and return only the enhanced prompt—nothing more, nothing less.\n\n`;
|
|
186
|
-
tempEnhancer = await
|
|
179
|
+
tempEnhancer = await ApexChat("gpt-4-turbo", prompt, { instruction: enhancementRequest });
|
|
187
180
|
}
|
|
188
|
-
genImage = await
|
|
181
|
+
genImage = await ApexImagine(imagine?.imageModel, tempEnhancer || prompt, { width: enhancer?.width, height: enhancer?.height, format: enhancer?.format,
|
|
189
182
|
quality: enhancer?.quality, negative_prompt: enhancer?.negative_prompt, nsfw: nsfw?.enable,
|
|
190
183
|
nsfwWords: nsfw?.keywords, deepCheck: nsfw?.deepCheck, count: imagine?.numOfImages });
|
|
191
184
|
instruction += `\n\nThe image has already been generated. Do not attempt to generate or describe another image. Instead, provide feedback, thoughts, or a critique based on the given prompt:\n\n`;
|
|
192
185
|
}
|
|
193
|
-
aiResponse = await
|
|
194
|
-
aiResponse = await
|
|
186
|
+
aiResponse = await ApexChat(chat?.chatModel, prompt, { instruction, memory: chat?.memory?.memoryOn, userId: chat?.memory?.id, limit: chat?.memory?.limit, threshold: chat?.memory?.threshold });
|
|
187
|
+
aiResponse = await ApexText2Speech({ modelName: voice?.voiceModel, inputText: aiResponse, personality: voice?.characterName });
|
|
195
188
|
}
|
|
196
189
|
else if (imageEnabled && drawTrigger) {
|
|
197
190
|
const enhancer = imagine?.enhancer?.enable ? imagine.enhancer : undefined;
|
|
198
191
|
let tempEnhancer;
|
|
199
192
|
if (enhancer) {
|
|
200
193
|
const enhancementRequest = `Rewrite this text below in a more descriptive way, making it clearer to be visualized correctly by an AI image generator. Use stronger words and return only the enhanced prompt—nothing more, nothing less.\n\n${prompt}`;
|
|
201
|
-
tempEnhancer = await
|
|
194
|
+
tempEnhancer = await ApexChat("gpt-4-turbo", prompt, { instruction: enhancementRequest });
|
|
202
195
|
}
|
|
203
|
-
genImage = await
|
|
196
|
+
genImage = await ApexImagine(imagine?.imageModel, tempEnhancer || prompt, { width: enhancer?.width, height: enhancer?.height, format: enhancer?.format,
|
|
204
197
|
quality: enhancer?.quality, negative_prompt: enhancer?.negative_prompt, nsfw: nsfw?.enable,
|
|
205
198
|
nsfwWords: nsfw?.keywords, deepCheck: nsfw?.deepCheck, count: imagine?.numOfImages });
|
|
206
199
|
}
|
|
@@ -214,12 +207,12 @@ async function ApexAI(message, ApexOptions) {
|
|
|
214
207
|
const imageAttachments = [];
|
|
215
208
|
if (genImage.length > 0) {
|
|
216
209
|
for (const imageUrl of genImage) {
|
|
217
|
-
imageAttachments.push(new
|
|
210
|
+
imageAttachments.push(new AttachmentBuilder(imageUrl, { name: `image-${Date.now()}.png` }));
|
|
218
211
|
}
|
|
219
212
|
}
|
|
220
213
|
let voiceAttachment = null;
|
|
221
214
|
if (voiceEnabled && aiResponse instanceof Buffer) {
|
|
222
|
-
voiceAttachment = new
|
|
215
|
+
voiceAttachment = new AttachmentBuilder(aiResponse, { name: "ai_voice.mp3" });
|
|
223
216
|
}
|
|
224
217
|
const chunkMessage = (text, maxLength = 2000) => {
|
|
225
218
|
const chunks = [];
|
|
@@ -241,7 +234,7 @@ async function ApexAI(message, ApexOptions) {
|
|
|
241
234
|
if (!content.trim())
|
|
242
235
|
return;
|
|
243
236
|
if (messageType?.sendAs === "embed") {
|
|
244
|
-
const embed = new
|
|
237
|
+
const embed = new EmbedBuilder()
|
|
245
238
|
.setColor(0x0099ff)
|
|
246
239
|
.setDescription(content)
|
|
247
240
|
.setFooter({ text: "AI Response" });
|
|
@@ -325,12 +318,12 @@ let voiceConnection = null;
|
|
|
325
318
|
let activeUser = null;
|
|
326
319
|
let isRecording = false;
|
|
327
320
|
let silenceTimer = null;
|
|
328
|
-
const recordingsDir =
|
|
329
|
-
if (!
|
|
330
|
-
|
|
321
|
+
const recordingsDir = path.join(process.cwd(), "recordings");
|
|
322
|
+
if (!fs.existsSync(recordingsDir)) {
|
|
323
|
+
fs.mkdirSync(recordingsDir, { recursive: true });
|
|
331
324
|
}
|
|
332
325
|
try {
|
|
333
|
-
|
|
326
|
+
execSync("ffmpeg -version > nul 2>&1");
|
|
334
327
|
}
|
|
335
328
|
catch (err) {
|
|
336
329
|
console.error("🚨 FFmpeg is NOT installed or not in PATH! Install it first.");
|
|
@@ -339,7 +332,7 @@ function resetSilenceTimer() {
|
|
|
339
332
|
if (silenceTimer)
|
|
340
333
|
clearTimeout(silenceTimer);
|
|
341
334
|
}
|
|
342
|
-
async function handleVoiceAI(message, voiceChannelId, chat, modelName, personality) {
|
|
335
|
+
export async function handleVoiceAI(message, voiceChannelId, chat, modelName, personality) {
|
|
343
336
|
const guild = message.guild;
|
|
344
337
|
if (!guild)
|
|
345
338
|
return;
|
|
@@ -351,16 +344,16 @@ async function handleVoiceAI(message, voiceChannelId, chat, modelName, personali
|
|
|
351
344
|
if (!botMember)
|
|
352
345
|
return;
|
|
353
346
|
const permissions = channel.permissionsFor(botMember);
|
|
354
|
-
if (!permissions?.has(
|
|
355
|
-
!permissions.has(
|
|
356
|
-
!permissions.has(
|
|
357
|
-
!permissions.has(
|
|
347
|
+
if (!permissions?.has(PermissionFlagsBits.Connect) ||
|
|
348
|
+
!permissions.has(PermissionFlagsBits.Speak) ||
|
|
349
|
+
!permissions.has(PermissionFlagsBits.Stream) ||
|
|
350
|
+
!permissions.has(PermissionFlagsBits.UseVAD)) {
|
|
358
351
|
return await message.reply("🚫 I don't have the required permissions to join and speak in this voice channel.");
|
|
359
352
|
}
|
|
360
353
|
if (voiceConnection) {
|
|
361
354
|
return await message.reply("⚠️ AI is already in a voice channel.");
|
|
362
355
|
}
|
|
363
|
-
voiceConnection =
|
|
356
|
+
voiceConnection = joinVoiceChannel({
|
|
364
357
|
channelId: channel.id,
|
|
365
358
|
guildId: guild.id,
|
|
366
359
|
adapterCreator: guild.voiceAdapterCreator,
|
|
@@ -378,18 +371,18 @@ function captureAudio(connection, chat, modelName, personality) {
|
|
|
378
371
|
isRecording = false;
|
|
379
372
|
}
|
|
380
373
|
resetSilenceTimer();
|
|
381
|
-
const rawFilePath =
|
|
382
|
-
const wavFilePath =
|
|
374
|
+
const rawFilePath = path.join(recordingsDir, `${userId}.pcm`);
|
|
375
|
+
const wavFilePath = path.join(recordingsDir, `${userId}.wav`);
|
|
383
376
|
const opusStream = receiver.subscribe(userId, {
|
|
384
|
-
end: { behavior:
|
|
377
|
+
end: { behavior: EndBehaviorType.AfterSilence, duration: 2000 }
|
|
385
378
|
});
|
|
386
|
-
const pcmStream = new
|
|
379
|
+
const pcmStream = new prism.opus.Decoder({
|
|
387
380
|
frameSize: 960,
|
|
388
381
|
channels: 1,
|
|
389
382
|
rate: 48000
|
|
390
383
|
});
|
|
391
|
-
const writeStream =
|
|
392
|
-
|
|
384
|
+
const writeStream = fs.createWriteStream(rawFilePath);
|
|
385
|
+
pipeline(opusStream, pcmStream, writeStream, (err) => {
|
|
393
386
|
if (err) {
|
|
394
387
|
console.error("❌ Error writing PCM file:", err);
|
|
395
388
|
return;
|
|
@@ -419,12 +412,12 @@ function startSilenceTimer(chat, modelName, personality) {
|
|
|
419
412
|
}, 5000);
|
|
420
413
|
}
|
|
421
414
|
function convertPCMtoWAV(inputPCM, outputWAV, chat, modelName, personality) {
|
|
422
|
-
if (!
|
|
415
|
+
if (!fs.existsSync(inputPCM) || fs.statSync(inputPCM).size === 0) {
|
|
423
416
|
return;
|
|
424
417
|
}
|
|
425
418
|
try {
|
|
426
|
-
|
|
427
|
-
if (
|
|
419
|
+
execSync(`ffmpeg -y -f s16le -ar 48000 -ac 1 -i "${inputPCM}" -acodec pcm_s16le "${outputWAV}" > nul 2>&1`);
|
|
420
|
+
if (fs.existsSync(outputWAV)) {
|
|
428
421
|
transcribeAudio(outputWAV, chat, modelName, personality);
|
|
429
422
|
}
|
|
430
423
|
}
|
|
@@ -434,7 +427,7 @@ function convertPCMtoWAV(inputPCM, outputWAV, chat, modelName, personality) {
|
|
|
434
427
|
}
|
|
435
428
|
async function transcribeAudio(filePath, chat, modelName, personality) {
|
|
436
429
|
try {
|
|
437
|
-
const transcribedText = await
|
|
430
|
+
const transcribedText = await ApexListener({
|
|
438
431
|
filepath: filePath,
|
|
439
432
|
prompt: "Transcribe what the user said in English.",
|
|
440
433
|
lang: "en"
|
|
@@ -443,7 +436,7 @@ async function transcribeAudio(filePath, chat, modelName, personality) {
|
|
|
443
436
|
voiceQueue.push({ userId: activeUser || "unknown", text: transcribedText.transcribe });
|
|
444
437
|
processQueue(chat, modelName, personality);
|
|
445
438
|
}
|
|
446
|
-
|
|
439
|
+
fs.unlinkSync(filePath);
|
|
447
440
|
}
|
|
448
441
|
catch (error) {
|
|
449
442
|
console.error("❌ Error in transcription:", error);
|
|
@@ -457,20 +450,20 @@ async function processQueue(chat, modelName, personality) {
|
|
|
457
450
|
activeUser = userId;
|
|
458
451
|
resetSilenceTimer();
|
|
459
452
|
try {
|
|
460
|
-
const aiResponse = await
|
|
453
|
+
const aiResponse = await ApexChat(chat?.chatModel || "gpt-4o", text, {
|
|
461
454
|
instruction: chat.instruction,
|
|
462
455
|
memory: chat?.memory?.memoryOn,
|
|
463
456
|
userId,
|
|
464
457
|
limit: chat?.memory?.limit,
|
|
465
458
|
threshold: chat?.memory?.threshold
|
|
466
459
|
});
|
|
467
|
-
const audioBuffer = await
|
|
460
|
+
const audioBuffer = await ApexText2Speech({ inputText: aiResponse, modelName, personality });
|
|
468
461
|
if (voiceConnection) {
|
|
469
|
-
const player =
|
|
470
|
-
const resource =
|
|
462
|
+
const player = createAudioPlayer();
|
|
463
|
+
const resource = createAudioResource(Readable.from(audioBuffer));
|
|
471
464
|
voiceConnection.subscribe(player);
|
|
472
465
|
player.play(resource);
|
|
473
|
-
player.on(
|
|
466
|
+
player.on(AudioPlayerStatus.Idle, () => {
|
|
474
467
|
isProcessing = false;
|
|
475
468
|
if (voiceQueue.length > 0) {
|
|
476
469
|
processQueue(chat, modelName, personality);
|
|
@@ -491,4 +484,3 @@ function leaveVoiceChannel() {
|
|
|
491
484
|
resetSilenceTimer();
|
|
492
485
|
}
|
|
493
486
|
}
|
|
494
|
-
//# sourceMappingURL=ApexAI.js.map
|