generaltranslation 1.0.13 → 1.0.14

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.
Files changed (2) hide show
  1. package/models/models.js +4 -4
  2. package/package.json +1 -1
package/models/models.js CHANGED
@@ -6,7 +6,6 @@ let AliasToModel = null;
6
6
  // Fetches models and aliases from the server and caches them
7
7
  const fetchModelData = async () => {
8
8
  if (!Models || !AliasToModel) {
9
- console.log('fetching model data...')
10
9
  const results = await Promise.all([
11
10
  fetch('https://data.gtx.dev/models.json'),
12
11
  fetch('https://data.gtx.dev/alias_to_model.json')
@@ -18,6 +17,7 @@ const fetchModelData = async () => {
18
17
  Models = values[0];
19
18
  AliasToModel = values[1];
20
19
  }
20
+ return [Models, AliasToModel];
21
21
  }
22
22
 
23
23
  // ----- MODEL INFORMATION ----- //
@@ -25,10 +25,10 @@ const fetchModelData = async () => {
25
25
  // Get all info about a given model
26
26
  // Returns an object or null if invalid
27
27
  const getModelInfo = async model => {
28
- await fetchModelData();
28
+ const [Models, AliasToModel] = await fetchModelData();
29
29
  model = model?.toLowerCase();
30
- const modelName = AliasToModel[model] || model;
31
- return Models[modelName]
30
+ const modelName = AliasToModel ? AliasToModel[model] : model;
31
+ return Models ? Models[modelName] : null;
32
32
  }
33
33
 
34
34
  // Get all languages known to be compatible with a given LLM
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generaltranslation",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "A language toolkit for AI developers",
5
5
  "main": "index.js",
6
6
  "scripts": {