@aj-archipelago/cortex 0.0.8 → 0.0.9
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/lib/fileChunker.js +3 -0
- package/lib/request.js +1 -1
- package/package.json +2 -1
package/lib/fileChunker.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
|
|
2
3
|
const ffmpeg = require('fluent-ffmpeg');
|
|
4
|
+
ffmpeg.setFfmpegPath(ffmpegPath);
|
|
3
5
|
const path = require('path');
|
|
4
6
|
const { v4: uuidv4 } = require('uuid');
|
|
5
7
|
const os = require('os');
|
|
@@ -132,6 +134,7 @@ const processYoutubeUrl = async (url) => {
|
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
const stream = ytdl.downloadFromInfo(info, { format: audioFormat });
|
|
137
|
+
// const stream = ytdl(url, { filter: 'audioonly' })
|
|
135
138
|
|
|
136
139
|
const mp3Stream = convertYoutubeToMp3Stream(stream);
|
|
137
140
|
const outputFileName = path.join(os.tmpdir(), `${uuidv4()}.mp3`);
|
package/lib/request.js
CHANGED
|
@@ -80,7 +80,7 @@ const postRequest = async ({ url, data, params, headers, cache }, model) => {
|
|
|
80
80
|
return await limiters[model].schedule(() => postWithMonitor(model, url, data, axiosConfigObj));
|
|
81
81
|
} catch (e) {
|
|
82
82
|
console.error(`Failed request with data ${JSON.stringify(data)}: ${e}`);
|
|
83
|
-
if (e.response.status === 429) {
|
|
83
|
+
if (e.response.status && e.response.status === 429) {
|
|
84
84
|
monitors[model].incrementError429Count();
|
|
85
85
|
}
|
|
86
86
|
errors.push(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aj-archipelago/cortex",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Cortex is a GraphQL API for AI. It provides a simple, extensible interface for using AI services from OpenAI, Azure and others.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"homepage": "https://github.com/aj-archipelago/cortex#readme",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@apollo/utils.keyvadapter": "^1.1.2",
|
|
31
|
+
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
31
32
|
"@graphql-tools/schema": "^9.0.12",
|
|
32
33
|
"@keyv/redis": "^2.5.4",
|
|
33
34
|
"apollo-server": "^3.12.0",
|