gptrans 2.1.2 โ 2.1.4
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 +1 -1
- package/demo/case_parallelism.js +5 -2
- package/demo/case_references.js +5 -2
- package/index.js +3 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npm install gptrans
|
|
|
30
30
|
|
|
31
31
|
### ๐ Environment Setup
|
|
32
32
|
|
|
33
|
-
GPTrans
|
|
33
|
+
On Node.js 20.6+, GPTrans loads a `.env` from the current working directory via `process.loadEnvFile()` when you construct `GPTrans` (missing or invalid files are ignored). Create a `.env` in your project root and add your API keys:
|
|
34
34
|
|
|
35
35
|
```env
|
|
36
36
|
OPENAI_API_KEY=your_openai_api_key
|
package/demo/case_parallelism.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import GPTrans from '../index.js';
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
2
|
import { fileURLToPath } from 'url';
|
|
4
3
|
import { dirname, join } from 'path';
|
|
5
4
|
|
|
6
5
|
// Cargar .env desde la carpeta demo
|
|
7
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
7
|
const __dirname = dirname(__filename);
|
|
9
|
-
|
|
8
|
+
try {
|
|
9
|
+
process.loadEnvFile(join(__dirname, '.env'));
|
|
10
|
+
} catch {
|
|
11
|
+
/* optional .env missing or unreadable */
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
console.log('๐ Prueba de Paralelismo en GPTrans');
|
|
12
15
|
console.log('โ ๏ธ Mรบltiples instancias con MISMO NOMBRE y MISMO PAR DE IDIOMAS\n');
|
package/demo/case_references.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import GPTrans from '../index.js';
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
2
|
import { fileURLToPath } from 'url';
|
|
4
3
|
import { dirname, join } from 'path';
|
|
5
4
|
|
|
6
5
|
// Load .env from demo folder
|
|
7
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
7
|
const __dirname = dirname(__filename);
|
|
9
|
-
|
|
8
|
+
try {
|
|
9
|
+
process.loadEnvFile(join(__dirname, '.env'));
|
|
10
|
+
} catch {
|
|
11
|
+
/* optional .env missing or unreadable */
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
console.log('๐ Testing GPTrans with Reference Translations\n');
|
|
12
15
|
console.log('='.repeat(70));
|
package/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import DeepBase from 'deepbase';
|
|
|
2
2
|
import stringHash from 'string-hash';
|
|
3
3
|
import { ModelMix } from 'modelmix';
|
|
4
4
|
import { isoAssoc, isLanguageAvailable } from './isoAssoc.js';
|
|
5
|
-
import dotenv from 'dotenv';
|
|
6
5
|
import { GeminiGenerator } from 'genmix';
|
|
7
6
|
import fs from 'fs';
|
|
8
7
|
import path from 'path';
|
|
@@ -69,9 +68,9 @@ class GPTrans {
|
|
|
69
68
|
from = this.normalizeBCP47(from);
|
|
70
69
|
|
|
71
70
|
try {
|
|
72
|
-
|
|
73
|
-
} catch
|
|
74
|
-
|
|
71
|
+
process.loadEnvFile();
|
|
72
|
+
} catch {
|
|
73
|
+
/* optional .env missing or unreadable */
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
const path = new URL('../../db', import.meta.url).pathname;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gptrans",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.4",
|
|
5
5
|
"description": "๐ GPTrans - The smarter AI-powered way to translate.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"translate",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"url": "https://github.com/clasen/GPTrans/issues"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/clasen/GPTrans#readme",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20.6.0"
|
|
39
|
+
},
|
|
37
40
|
"dependencies": {
|
|
38
|
-
"axios": "^1.12.2",
|
|
39
41
|
"deepbase": "^1.4.8",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"genmix": "^1.0.4",
|
|
43
|
-
"modelmix": "^4.4.22",
|
|
42
|
+
"genmix": "^1.2.4",
|
|
43
|
+
"modelmix": "^4.5.6",
|
|
44
44
|
"string-hash": "^1.1.3"
|
|
45
45
|
}
|
|
46
46
|
}
|