modelmix 4.2.2 → 4.2.6
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/README.md +4 -5
- package/demo/demo.js +2 -2
- package/demo/free.js +1 -6
- package/demo/gpt51.js +3 -8
- package/demo/mcp-simple.js +1 -1
- package/demo/package-lock.json +449 -0
- package/demo/package.json +1 -0
- package/demo/repl-powers.js +77 -0
- package/demo/verbose.js +103 -0
- package/index.js +122 -28
- package/package.json +2 -2
- package/test/bottleneck.test.js +9 -9
- package/test/images.test.js +1 -1
- package/test/json.test.js +2 -2
- package/test/live.mcp.js +10 -8
- package/test/templates.test.js +15 -15
package/test/templates.test.js
CHANGED
|
@@ -27,7 +27,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
it('should replace simple template variables', async () => {
|
|
30
|
-
model.
|
|
30
|
+
model.gpt41()
|
|
31
31
|
.replace({
|
|
32
32
|
'{{name}}': 'Alice',
|
|
33
33
|
'{{age}}': '30',
|
|
@@ -56,7 +56,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it('should handle multiple template replacements', async () => {
|
|
59
|
-
model.
|
|
59
|
+
model.gpt41()
|
|
60
60
|
.replace({ '{{greeting}}': 'Hello' })
|
|
61
61
|
.replace({ '{{name}}': 'Bob' })
|
|
62
62
|
.replace({ '{{action}}': 'welcome' })
|
|
@@ -82,7 +82,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
it('should handle nested template objects', async () => {
|
|
85
|
-
model.
|
|
85
|
+
model.gpt41()
|
|
86
86
|
.replace({
|
|
87
87
|
'{{user_name}}': 'Charlie',
|
|
88
88
|
'{{user_role}}': 'admin',
|
|
@@ -111,7 +111,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
it('should preserve unreplaced templates', async () => {
|
|
114
|
-
model.
|
|
114
|
+
model.gpt41()
|
|
115
115
|
.replace({ '{{name}}': 'David' })
|
|
116
116
|
.addText('Hello {{name}}, your ID is {{user_id}} and status is {{status}}');
|
|
117
117
|
|
|
@@ -135,7 +135,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
it('should handle empty and special character replacements', async () => {
|
|
138
|
-
model.
|
|
138
|
+
model.gpt41()
|
|
139
139
|
.replace({
|
|
140
140
|
'{{empty}}': '',
|
|
141
141
|
'{{special}}': 'Hello & "World" <test>',
|
|
@@ -175,7 +175,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
it('should load and replace from template file', async () => {
|
|
178
|
-
model.
|
|
178
|
+
model.gpt41()
|
|
179
179
|
.replaceKeyFromFile('{{template}}', path.join(fixturesPath, 'template.txt'))
|
|
180
180
|
.replace({
|
|
181
181
|
'{{name}}': 'Eve',
|
|
@@ -214,7 +214,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
it('should load and process JSON data file', async () => {
|
|
217
|
-
model.
|
|
217
|
+
model.gpt41()
|
|
218
218
|
.replaceKeyFromFile('{{data}}', path.join(fixturesPath, 'data.json'))
|
|
219
219
|
.addText('Process this data: {{data}}');
|
|
220
220
|
|
|
@@ -246,7 +246,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
246
246
|
});
|
|
247
247
|
|
|
248
248
|
it('should handle file loading errors gracefully', async () => {
|
|
249
|
-
model.
|
|
249
|
+
model.gpt41()
|
|
250
250
|
.replaceKeyFromFile('{{missing}}', path.join(fixturesPath, 'nonexistent.txt'))
|
|
251
251
|
.addText('This should contain: {{missing}}');
|
|
252
252
|
|
|
@@ -271,7 +271,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
271
271
|
});
|
|
272
272
|
|
|
273
273
|
it('should handle multiple file replacements', async () => {
|
|
274
|
-
model.
|
|
274
|
+
model.gpt41()
|
|
275
275
|
.replaceKeyFromFile('{{template}}', path.join(fixturesPath, 'template.txt'))
|
|
276
276
|
.replaceKeyFromFile('{{data}}', path.join(fixturesPath, 'data.json'))
|
|
277
277
|
.replace({
|
|
@@ -315,7 +315,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
315
315
|
it('should handle relative and absolute paths', async () => {
|
|
316
316
|
const absolutePath = path.resolve(fixturesPath, 'template.txt');
|
|
317
317
|
|
|
318
|
-
model.
|
|
318
|
+
model.gpt41()
|
|
319
319
|
.replaceKeyFromFile('{{absolute}}', absolutePath)
|
|
320
320
|
.replace({
|
|
321
321
|
'{{name}}': 'Grace',
|
|
@@ -362,7 +362,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
362
362
|
});
|
|
363
363
|
|
|
364
364
|
it('should combine file loading with template replacement in complex scenarios', async () => {
|
|
365
|
-
model.
|
|
365
|
+
model.gpt41()
|
|
366
366
|
.replaceKeyFromFile('{{user_data}}', path.join(fixturesPath, 'data.json'))
|
|
367
367
|
.replace({
|
|
368
368
|
'{{action}}': 'analyze',
|
|
@@ -402,7 +402,7 @@ describe('Template and File Operations Tests', () => {
|
|
|
402
402
|
roles: ['admin', 'user']
|
|
403
403
|
};
|
|
404
404
|
|
|
405
|
-
model.
|
|
405
|
+
model.gpt41()
|
|
406
406
|
.replaceKeyFromFile('{{data}}', path.join(fixturesPath, 'data.json'))
|
|
407
407
|
.replace({ '{{instruction}}': 'Count active users by role' })
|
|
408
408
|
.addText('{{instruction}} from this data: {{data}}');
|
|
@@ -447,16 +447,16 @@ describe('Template and File Operations Tests', () => {
|
|
|
447
447
|
|
|
448
448
|
it('should handle template replacement errors gracefully', () => {
|
|
449
449
|
expect(() => {
|
|
450
|
-
model.
|
|
450
|
+
model.gpt41().replace(null);
|
|
451
451
|
}).to.not.throw();
|
|
452
452
|
|
|
453
453
|
expect(() => {
|
|
454
|
-
model.
|
|
454
|
+
model.gpt41().replace(undefined);
|
|
455
455
|
}).to.not.throw();
|
|
456
456
|
});
|
|
457
457
|
|
|
458
458
|
it('should handle file reading errors without crashing', async () => {
|
|
459
|
-
model.
|
|
459
|
+
model.gpt41()
|
|
460
460
|
.replaceKeyFromFile('{{bad_file}}', '/path/that/does/not/exist.txt')
|
|
461
461
|
.addText('Content: {{bad_file}}');
|
|
462
462
|
|