@aj-archipelago/cortex 1.1.28 → 1.1.30
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.
|
@@ -44,8 +44,14 @@ const generateUniqueFolderName = () => {
|
|
|
44
44
|
|
|
45
45
|
async function downloadFile(url, outputPath) {
|
|
46
46
|
try {
|
|
47
|
+
let response;
|
|
48
|
+
try {
|
|
49
|
+
response = await axios.get(decodeURIComponent(url), { responseType: 'stream' });
|
|
50
|
+
} catch (error) {
|
|
51
|
+
response = await axios.get(url, { responseType: 'stream' });
|
|
52
|
+
}
|
|
53
|
+
|
|
47
54
|
// Make an HTTP request for the file
|
|
48
|
-
const response = await axios.get(url, { responseType: 'stream' });
|
|
49
55
|
|
|
50
56
|
// Create a writable file stream to save the file
|
|
51
57
|
const fileStream = fs.createWriteStream(outputPath);
|
package/lib/util.js
CHANGED
|
@@ -77,7 +77,9 @@ function generateUniqueFilename(extension) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
const downloadFile = async (fileUrl) => {
|
|
80
|
-
const
|
|
80
|
+
const urlObj = new URL(fileUrl);
|
|
81
|
+
const pathname = urlObj.pathname;
|
|
82
|
+
const fileExtension = pathname.substring(pathname.lastIndexOf('.') + 1);
|
|
81
83
|
const uniqueFilename = generateUniqueFilename(fileExtension);
|
|
82
84
|
const tempDir = os.tmpdir();
|
|
83
85
|
const localFilePath = `${tempDir}/${uniqueFilename}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aj-archipelago/cortex",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.30",
|
|
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
|
"private": false,
|
|
6
6
|
"repository": {
|
|
Binary file
|