@aj-archipelago/cortex 1.1.18 → 1.1.20
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/config/default.example.json +1 -14
- package/helper-apps/cortex-file-handler/blobHandler.js +317 -142
- package/helper-apps/cortex-file-handler/index.js +98 -10
- package/helper-apps/cortex-file-handler/localFileHandler.js +45 -27
- package/helper-apps/cortex-file-handler/package-lock.json +785 -20
- package/helper-apps/cortex-file-handler/package.json +2 -0
- package/helper-apps/cortex-file-handler/redis.js +102 -2
- package/lib/pathwayTools.js +5 -1
- package/package.json +1 -1
- package/pathways/summary.js +1 -1
- package/server/modelExecutor.js +8 -0
- package/server/pathwayResolver.js +1 -0
- package/server/plugins/azureCognitivePlugin.js +26 -2
- package/server/plugins/claude3VertexPlugin.js +273 -140
- package/server/plugins/gemini15ChatPlugin.js +215 -0
- package/server/plugins/gemini15VisionPlugin.js +101 -0
- package/server/plugins/geminiChatPlugin.js +19 -7
- package/server/plugins/openAiVisionPlugin.js +9 -3
- package/server/resolver.js +10 -1
- package/server/typeDef.js +8 -8
- package/tests/vision.test.js +1 -1
|
@@ -29,43 +29,61 @@ async function deleteFolder(requestId) {
|
|
|
29
29
|
console.log(`Cleaned folder: ${targetFolder}`);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
async function cleanupLocal() {
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
|
|
32
|
+
async function cleanupLocal(urls=null) {
|
|
33
|
+
if(!urls){
|
|
34
|
+
const cleanedUrls = []; // initialize array for holding cleaned file URLs
|
|
35
|
+
try {
|
|
36
|
+
// Read the directory
|
|
37
|
+
const items = await fs.readdir(publicFolder);
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
// Calculate the date that is x months ago
|
|
40
|
+
const monthsAgo = new Date();
|
|
41
|
+
monthsAgo.setMonth(monthsAgo.getMonth() - 1);
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
// Iterate through the items
|
|
44
|
+
for (const item of items) {
|
|
45
|
+
const itemPath = join(publicFolder, item);
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
// Get the stats of the item
|
|
48
|
+
const stats = await fs.stat(itemPath);
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
// Check if the item is a file or a directory
|
|
51
|
+
const isDirectory = stats.isDirectory();
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
// Compare the last modified date with three months ago
|
|
54
|
+
if (stats.mtime < monthsAgo) {
|
|
55
|
+
if (isDirectory) {
|
|
56
|
+
// If it's a directory, delete it recursively
|
|
57
|
+
await fs.rm(itemPath, { recursive: true });
|
|
58
|
+
console.log(`Cleaned directory: ${item}`);
|
|
59
|
+
} else {
|
|
60
|
+
// If it's a file, delete it
|
|
61
|
+
await fs.unlink(itemPath);
|
|
62
|
+
console.log(`Cleaned file: ${item}`);
|
|
63
|
+
|
|
64
|
+
// Add the URL of the cleaned file to cleanedUrls array
|
|
65
|
+
cleanedUrls.push(`http://${ipAddress}:${port}/files/${item}`);
|
|
66
|
+
}
|
|
61
67
|
}
|
|
62
68
|
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(`Error cleaning up files: ${error}`);
|
|
71
|
+
}
|
|
72
|
+
}else{
|
|
73
|
+
try{
|
|
74
|
+
for (const url of urls) {
|
|
75
|
+
const filename = url.split('/').pop();
|
|
76
|
+
const itemPath = join(publicFolder, filename);
|
|
77
|
+
await fs.unlink(itemPath);
|
|
78
|
+
}
|
|
79
|
+
}catch(error){
|
|
80
|
+
console.error(`Error cleaning up files: ${error}`);
|
|
63
81
|
}
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.error(`Error cleaning up files: ${error}`);
|
|
66
82
|
}
|
|
67
|
-
}
|
|
68
83
|
|
|
84
|
+
// Return the array of cleaned file URLs
|
|
85
|
+
return cleanedUrls;
|
|
86
|
+
}
|
|
69
87
|
|
|
70
88
|
export {
|
|
71
89
|
moveFileToPublicFolder, deleteFolder, cleanupLocal
|