@aj-archipelago/cortex 1.3.55 → 1.3.57
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/.env.sample +3 -1
- package/config/default.example.json +2 -2
- package/config.js +32 -0
- package/helper-apps/mogrt-handler/.env.example +24 -0
- package/helper-apps/mogrt-handler/README.md +166 -0
- package/helper-apps/mogrt-handler/glossaryHandler.js +218 -0
- package/helper-apps/mogrt-handler/index.js +213 -0
- package/helper-apps/mogrt-handler/package-lock.json +7106 -0
- package/helper-apps/mogrt-handler/package.json +34 -0
- package/helper-apps/mogrt-handler/s3Handler.js +444 -0
- package/helper-apps/mogrt-handler/start.js +98 -0
- package/helper-apps/mogrt-handler/swagger.js +42 -0
- package/helper-apps/mogrt-handler/swagger.yaml +436 -0
- package/helper-apps/mogrt-handler/tests/integration/api.test.js +226 -0
- package/helper-apps/mogrt-handler/tests/integration/glossary.test.js +106 -0
- package/helper-apps/mogrt-handler/tests/setup.js +8 -0
- package/helper-apps/mogrt-handler/tests/test-files/test.gif +1 -0
- package/helper-apps/mogrt-handler/tests/test-files/test.mogrt +1 -0
- package/helper-apps/mogrt-handler/tests/test-files/test.mp4 +1 -0
- package/helper-apps/mogrt-handler/tests/unit/glossary.unit.test.js +118 -0
- package/helper-apps/mogrt-handler/tests/unit/index.test.js +349 -0
- package/helper-apps/mogrt-handler/tests/unit/s3Handler.test.js +204 -0
- package/helper-apps/mogrt-handler/tests/unit/sample.test.js +28 -0
- package/helper-apps/mogrt-handler/vitest.config.js +15 -0
- package/lib/entityConstants.js +1 -1
- package/lib/requestExecutor.js +1 -1
- package/package.json +1 -1
- package/pathways/list_translation_models.js +67 -0
- package/pathways/system/sys_test_response_reasonableness.js +20 -0
- package/pathways/system/workspaces/workspace_applet_edit.js +187 -0
- package/pathways/translate_apptek.js +11 -0
- package/pathways/translate_google.js +10 -0
- package/pathways/translate_groq.js +36 -0
- package/pathways/video_seedance.js +17 -0
- package/pathways/video_veo.js +31 -0
- package/server/modelExecutor.js +16 -0
- package/server/plugins/apptekTranslatePlugin.js +189 -0
- package/server/plugins/googleTranslatePlugin.js +121 -0
- package/server/plugins/groqChatPlugin.js +108 -0
- package/server/plugins/replicateApiPlugin.js +22 -0
- package/server/plugins/veoVideoPlugin.js +218 -0
- package/tests/apptekTranslatePlugin.test.js +228 -0
- package/tests/integration/apptekTranslatePlugin.integration.test.js +156 -0
- package/tests/translate_apptek.test.js +117 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import sinon from 'sinon';
|
|
3
|
+
import { PathwayResolver } from '../server/pathwayResolver.js';
|
|
4
|
+
|
|
5
|
+
// Mock configuration
|
|
6
|
+
const mockModel = {
|
|
7
|
+
name: 'apptek-translate',
|
|
8
|
+
type: 'APPTEK-TRANSLATE',
|
|
9
|
+
apiEndpoint: 'https://api.mock-apptek.com',
|
|
10
|
+
apiKey: 'mock-api-key'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
test.beforeEach((t) => {
|
|
14
|
+
// Create a sinon sandbox
|
|
15
|
+
t.context.sandbox = sinon.createSandbox();
|
|
16
|
+
|
|
17
|
+
// Save original environment variables
|
|
18
|
+
t.context.originalEnv = { ...process.env };
|
|
19
|
+
|
|
20
|
+
// Set environment variables for testing
|
|
21
|
+
process.env.APPTEK_API_ENDPOINT = 'https://api.mock-apptek.com';
|
|
22
|
+
process.env.APPTEK_API_KEY = 'mock-api-key';
|
|
23
|
+
|
|
24
|
+
// Create config mock
|
|
25
|
+
t.context.mockConfig = {
|
|
26
|
+
get: (key) => {
|
|
27
|
+
const configs = {
|
|
28
|
+
models: {
|
|
29
|
+
'apptek-translate': mockModel
|
|
30
|
+
},
|
|
31
|
+
'models.apptek-translate': mockModel,
|
|
32
|
+
defaultModelName: 'apptek-translate',
|
|
33
|
+
environmentVariables: {
|
|
34
|
+
APPTEK_API_ENDPOINT: 'https://api.mock-apptek.com',
|
|
35
|
+
APPTEK_API_KEY: 'mock-api-key'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return configs[key];
|
|
39
|
+
},
|
|
40
|
+
getEnv: () => ({
|
|
41
|
+
APPTEK_API_ENDPOINT: 'https://api.mock-apptek.com',
|
|
42
|
+
APPTEK_API_KEY: 'mock-api-key'
|
|
43
|
+
}),
|
|
44
|
+
models: {
|
|
45
|
+
'apptek-translate': mockModel
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Create a fresh copy of the pathway
|
|
50
|
+
t.context.pathway = {
|
|
51
|
+
name: 'translate_apptek',
|
|
52
|
+
model: 'apptek-translate',
|
|
53
|
+
prompt: '{{{text}}}',
|
|
54
|
+
inputParameters: {
|
|
55
|
+
from: 'auto',
|
|
56
|
+
to: 'en',
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Setup basic arguments
|
|
61
|
+
t.context.args = {
|
|
62
|
+
text: 'Hello, how are you?',
|
|
63
|
+
from: 'en',
|
|
64
|
+
to: 'es'
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Create resolver instance
|
|
68
|
+
t.context.resolver = new PathwayResolver({
|
|
69
|
+
config: t.context.mockConfig,
|
|
70
|
+
pathway: t.context.pathway,
|
|
71
|
+
args: t.context.args,
|
|
72
|
+
endpoints: {
|
|
73
|
+
"apptek-translate": {
|
|
74
|
+
resolve: t.context.sandbox.stub().resolves('translated text'),
|
|
75
|
+
type: 'APPTEK-TRANSLATE'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test.afterEach.always((t) => {
|
|
82
|
+
// Restore sandbox
|
|
83
|
+
t.context.sandbox.restore();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('pathway has correct basic configuration', (t) => {
|
|
87
|
+
const pathway = t.context.pathway;
|
|
88
|
+
|
|
89
|
+
t.is(pathway.model, 'apptek-translate');
|
|
90
|
+
t.is(typeof pathway.prompt, 'string');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('pathway has correct input parameters', (t) => {
|
|
94
|
+
const pathway = t.context.pathway;
|
|
95
|
+
|
|
96
|
+
t.is(pathway.inputParameters.from, 'auto');
|
|
97
|
+
t.is(pathway.inputParameters.to, 'en');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
test('resolver processes text correctly', async (t) => {
|
|
102
|
+
const resolver = t.context.resolver;
|
|
103
|
+
const result = await resolver.processInputText('Hello, how are you?');
|
|
104
|
+
t.deepEqual(result, ['Hello, how are you?']);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('resolver handles empty text', async (t) => {
|
|
108
|
+
const resolver = t.context.resolver;
|
|
109
|
+
const result = await resolver.processInputText('');
|
|
110
|
+
t.deepEqual(result, ['']);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test('resolver uses correct model', (t) => {
|
|
114
|
+
const resolver = t.context.resolver;
|
|
115
|
+
const model = resolver.model;
|
|
116
|
+
t.is(model.type, 'APPTEK-TRANSLATE');
|
|
117
|
+
});
|