@nomalism-com/api 0.40.81 → 0.40.86
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/dist/index.d.ts +365 -349
- package/dist/index.js +52 -5
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(main_exports, {
|
|
|
46
46
|
GoogleFilePermission: () => googleFilePermission_exports,
|
|
47
47
|
GoogleSheets: () => googleSheets_exports,
|
|
48
48
|
Inventario: () => inventario_exports,
|
|
49
|
+
LLMClass: () => llm_exports,
|
|
49
50
|
Language: () => language_exports,
|
|
50
51
|
Location: () => location_exports,
|
|
51
52
|
Logout: () => logout_exports,
|
|
@@ -4162,20 +4163,64 @@ var Repository119 = class {
|
|
|
4162
4163
|
}
|
|
4163
4164
|
};
|
|
4164
4165
|
|
|
4166
|
+
// src/modules/llm/llm.ts
|
|
4167
|
+
var llm_exports = {};
|
|
4168
|
+
__export(llm_exports, {
|
|
4169
|
+
default: () => Repository120
|
|
4170
|
+
});
|
|
4171
|
+
var Repository120 = class {
|
|
4172
|
+
constructor({ headers, route }) {
|
|
4173
|
+
this.headers = headers;
|
|
4174
|
+
this.route = route;
|
|
4175
|
+
}
|
|
4176
|
+
async prompt(data, { onChunk, onDone, onError }) {
|
|
4177
|
+
const ac = new AbortController();
|
|
4178
|
+
(async () => {
|
|
4179
|
+
try {
|
|
4180
|
+
const resp = await fetch(`${this.route}prompt`, {
|
|
4181
|
+
method: "POST",
|
|
4182
|
+
headers: {
|
|
4183
|
+
"Content-Type": "application/json",
|
|
4184
|
+
...this.headers
|
|
4185
|
+
},
|
|
4186
|
+
body: JSON.stringify(data),
|
|
4187
|
+
signal: ac.signal
|
|
4188
|
+
});
|
|
4189
|
+
if (!resp.ok || !resp.body) {
|
|
4190
|
+
const text = await resp.text().catch(() => "");
|
|
4191
|
+
throw new Error(`HTTP ${resp.status}: ${text}`);
|
|
4192
|
+
}
|
|
4193
|
+
const reader = resp.body.getReader();
|
|
4194
|
+
const decoder = new TextDecoder();
|
|
4195
|
+
while (true) {
|
|
4196
|
+
const { value, done } = await reader.read();
|
|
4197
|
+
if (done) break;
|
|
4198
|
+
onChunk(decoder.decode(value, { stream: true }));
|
|
4199
|
+
}
|
|
4200
|
+
onDone?.();
|
|
4201
|
+
} catch (err) {
|
|
4202
|
+
if (err?.name === "AbortError") return;
|
|
4203
|
+
onError?.(err);
|
|
4204
|
+
}
|
|
4205
|
+
})();
|
|
4206
|
+
return { abort: () => ac.abort() };
|
|
4207
|
+
}
|
|
4208
|
+
};
|
|
4209
|
+
|
|
4165
4210
|
// src/main.ts
|
|
4166
4211
|
var API = class {
|
|
4167
4212
|
constructor({ processEnvironment, services, gatewayUrl, apikey, tokenBearer }) {
|
|
4168
4213
|
this.processEnvironment = processEnvironment || "localhost";
|
|
4169
|
-
|
|
4214
|
+
this.defaultHeaders = new AxiosHeaders();
|
|
4170
4215
|
if (apikey) {
|
|
4171
|
-
defaultHeaders.set("apikey", apikey);
|
|
4216
|
+
this.defaultHeaders.set("apikey", apikey);
|
|
4172
4217
|
}
|
|
4173
4218
|
if (tokenBearer) {
|
|
4174
|
-
defaultHeaders.setAuthorization(tokenBearer);
|
|
4219
|
+
this.defaultHeaders.setAuthorization(tokenBearer);
|
|
4175
4220
|
}
|
|
4176
4221
|
this.client = axios.create({
|
|
4177
4222
|
baseURL: gatewayUrl,
|
|
4178
|
-
headers: defaultHeaders
|
|
4223
|
+
headers: this.defaultHeaders
|
|
4179
4224
|
});
|
|
4180
4225
|
const getServicePath = (service) => {
|
|
4181
4226
|
const baseUrl = services[service];
|
|
@@ -4189,7 +4234,8 @@ var API = class {
|
|
|
4189
4234
|
documents: getServicePath("documents"),
|
|
4190
4235
|
view: getServicePath("view"),
|
|
4191
4236
|
print: getServicePath("print"),
|
|
4192
|
-
tickets: getServicePath("tickets")
|
|
4237
|
+
tickets: getServicePath("tickets"),
|
|
4238
|
+
llm: getServicePath("llm")
|
|
4193
4239
|
};
|
|
4194
4240
|
const getModuleParams = (service, module) => ({
|
|
4195
4241
|
api: this.client,
|
|
@@ -4359,6 +4405,7 @@ var API = class {
|
|
|
4359
4405
|
this.Portal = new Repository117(getModuleParams("stock", "portal"));
|
|
4360
4406
|
this.GoogleSheetPool = new Repository118(getModuleParams("stock", "google_sheet_pool"));
|
|
4361
4407
|
this.AccountCode = new Repository119(getModuleParams("stock", "account_code"));
|
|
4408
|
+
this.LLM = new Repository120({ headers: this.defaultHeaders, ...getModuleParams("llm", "llm") });
|
|
4362
4409
|
}
|
|
4363
4410
|
};
|
|
4364
4411
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomalism-com/api",
|
|
3
3
|
"description": "A nomalism API package for performing HTTP requests on API endpoints",
|
|
4
|
-
"version": "0.40.
|
|
4
|
+
"version": "0.40.86",
|
|
5
5
|
"author": "Nomalism <it.nomalism@gmail.com> (https://https://nomalism.com/)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"prepack": "npm run lint && npm run build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nomalism-com/types": "^0.40.
|
|
26
|
+
"@nomalism-com/types": "^0.40.86",
|
|
27
27
|
"axios": "^1.13.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@swc/core": "^1.15.
|
|
30
|
+
"@swc/core": "^1.15.8",
|
|
31
31
|
"@types/node": "^24.10.4",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
33
|
-
"@typescript-eslint/parser": "^8.
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
|
33
|
+
"@typescript-eslint/parser": "^8.52.0",
|
|
34
34
|
"eslint": "^9.39.2",
|
|
35
35
|
"eslint-config-prettier": "^10.1.8",
|
|
36
36
|
"eslint-import-resolver-typescript": "^4.4.4",
|