echo-ai-sdk-ts 2.6.0 → 2.6.1
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.js +32 -27
- package/dist/index.mjs +32 -27
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1769,23 +1769,23 @@ function getName(value) {
|
|
|
1769
1769
|
return (typeof value === "object" && value !== null && ("name" in value && value.name && String(value.name) || "url" in value && value.url && String(value.url) || "filename" in value && value.filename && String(value.filename) || "path" in value && value.path && String(value.path)) || "").split(/[\\/]/).pop() || void 0;
|
|
1770
1770
|
}
|
|
1771
1771
|
var isAsyncIterable = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
1772
|
-
var maybeMultipartFormRequestOptions = async (opts,
|
|
1772
|
+
var maybeMultipartFormRequestOptions = async (opts, fetch7) => {
|
|
1773
1773
|
if (!hasUploadableValue(opts.body))
|
|
1774
1774
|
return opts;
|
|
1775
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1775
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1776
1776
|
};
|
|
1777
|
-
var multipartFormRequestOptions = async (opts,
|
|
1778
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1777
|
+
var multipartFormRequestOptions = async (opts, fetch7) => {
|
|
1778
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1779
1779
|
};
|
|
1780
1780
|
var supportsFormDataMap = /* @__PURE__ */ new WeakMap();
|
|
1781
1781
|
function supportsFormData(fetchObject) {
|
|
1782
|
-
const
|
|
1783
|
-
const cached = supportsFormDataMap.get(
|
|
1782
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
1783
|
+
const cached = supportsFormDataMap.get(fetch7);
|
|
1784
1784
|
if (cached)
|
|
1785
1785
|
return cached;
|
|
1786
1786
|
const promise = (async () => {
|
|
1787
1787
|
try {
|
|
1788
|
-
const FetchResponse = "Response" in
|
|
1788
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
1789
1789
|
const data = new FormData();
|
|
1790
1790
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
1791
1791
|
return false;
|
|
@@ -1795,11 +1795,11 @@ function supportsFormData(fetchObject) {
|
|
|
1795
1795
|
return true;
|
|
1796
1796
|
}
|
|
1797
1797
|
})();
|
|
1798
|
-
supportsFormDataMap.set(
|
|
1798
|
+
supportsFormDataMap.set(fetch7, promise);
|
|
1799
1799
|
return promise;
|
|
1800
1800
|
}
|
|
1801
|
-
var createForm = async (body,
|
|
1802
|
-
if (!await supportsFormData(
|
|
1801
|
+
var createForm = async (body, fetch7) => {
|
|
1802
|
+
if (!await supportsFormData(fetch7)) {
|
|
1803
1803
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
1804
1804
|
}
|
|
1805
1805
|
const form = new FormData();
|
|
@@ -8432,18 +8432,18 @@ function getName2(value, stripPath) {
|
|
|
8432
8432
|
return stripPath ? val.split(/[\\/]/).pop() || void 0 : val;
|
|
8433
8433
|
}
|
|
8434
8434
|
var isAsyncIterable2 = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
8435
|
-
var multipartFormRequestOptions2 = async (opts,
|
|
8436
|
-
return { ...opts, body: await createForm2(opts.body,
|
|
8435
|
+
var multipartFormRequestOptions2 = async (opts, fetch7, stripFilenames = true) => {
|
|
8436
|
+
return { ...opts, body: await createForm2(opts.body, fetch7, stripFilenames) };
|
|
8437
8437
|
};
|
|
8438
8438
|
var supportsFormDataMap2 = /* @__PURE__ */ new WeakMap();
|
|
8439
8439
|
function supportsFormData2(fetchObject) {
|
|
8440
|
-
const
|
|
8441
|
-
const cached = supportsFormDataMap2.get(
|
|
8440
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
8441
|
+
const cached = supportsFormDataMap2.get(fetch7);
|
|
8442
8442
|
if (cached)
|
|
8443
8443
|
return cached;
|
|
8444
8444
|
const promise = (async () => {
|
|
8445
8445
|
try {
|
|
8446
|
-
const FetchResponse = "Response" in
|
|
8446
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
8447
8447
|
const data = new FormData();
|
|
8448
8448
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
8449
8449
|
return false;
|
|
@@ -8453,11 +8453,11 @@ function supportsFormData2(fetchObject) {
|
|
|
8453
8453
|
return true;
|
|
8454
8454
|
}
|
|
8455
8455
|
})();
|
|
8456
|
-
supportsFormDataMap2.set(
|
|
8456
|
+
supportsFormDataMap2.set(fetch7, promise);
|
|
8457
8457
|
return promise;
|
|
8458
8458
|
}
|
|
8459
|
-
var createForm2 = async (body,
|
|
8460
|
-
if (!await supportsFormData2(
|
|
8459
|
+
var createForm2 = async (body, fetch7, stripFilenames = true) => {
|
|
8460
|
+
if (!await supportsFormData2(fetch7)) {
|
|
8461
8461
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
8462
8462
|
}
|
|
8463
8463
|
const form = new FormData();
|
|
@@ -12975,6 +12975,7 @@ var EchoVoice = class {
|
|
|
12975
12975
|
};
|
|
12976
12976
|
|
|
12977
12977
|
// src/widget/connector.ts
|
|
12978
|
+
var import_cross_fetch = __toESM(require("cross-fetch"));
|
|
12978
12979
|
var APIConnector = class {
|
|
12979
12980
|
baseUrl;
|
|
12980
12981
|
headers;
|
|
@@ -13002,7 +13003,7 @@ var APIConnector = class {
|
|
|
13002
13003
|
const controller = new AbortController();
|
|
13003
13004
|
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
13004
13005
|
try {
|
|
13005
|
-
const response = await
|
|
13006
|
+
const response = await (0, import_cross_fetch.default)(url, {
|
|
13006
13007
|
method,
|
|
13007
13008
|
headers: this.headers,
|
|
13008
13009
|
body: body ? JSON.stringify(body) : void 0,
|
|
@@ -13022,6 +13023,7 @@ var APIConnector = class {
|
|
|
13022
13023
|
var import_zod4 = require("zod");
|
|
13023
13024
|
|
|
13024
13025
|
// src/rag/knowledge.ts
|
|
13026
|
+
var import_cross_fetch2 = __toESM(require("cross-fetch"));
|
|
13025
13027
|
var fs = __toESM(require("fs/promises"));
|
|
13026
13028
|
function cosineSimilarity(a, b) {
|
|
13027
13029
|
if (a.length !== b.length) return 0;
|
|
@@ -13150,7 +13152,7 @@ var KnowledgeBase = class {
|
|
|
13150
13152
|
return chunks.length;
|
|
13151
13153
|
}
|
|
13152
13154
|
async ingestURL(url) {
|
|
13153
|
-
const response = await
|
|
13155
|
+
const response = await (0, import_cross_fetch2.default)(url);
|
|
13154
13156
|
const html = await response.text();
|
|
13155
13157
|
const text = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
13156
13158
|
return this.ingestText(text, url);
|
|
@@ -13355,6 +13357,7 @@ var ConversationAnalytics = class {
|
|
|
13355
13357
|
};
|
|
13356
13358
|
|
|
13357
13359
|
// src/analytics/handoff.ts
|
|
13360
|
+
var import_cross_fetch3 = __toESM(require("cross-fetch"));
|
|
13358
13361
|
var crypto2 = __toESM(require("crypto"));
|
|
13359
13362
|
var HandoffManager = class {
|
|
13360
13363
|
webhookUrl;
|
|
@@ -13463,7 +13466,7 @@ var HandoffManager = class {
|
|
|
13463
13466
|
headers["X-Webhook-Signature"] = `sha256=${hmac.digest("hex")}`;
|
|
13464
13467
|
}
|
|
13465
13468
|
try {
|
|
13466
|
-
await
|
|
13469
|
+
await (0, import_cross_fetch3.default)(this.webhookUrl, { method: "POST", headers, body });
|
|
13467
13470
|
} catch (e) {
|
|
13468
13471
|
console.error(`[HandoffManager] Webhook dispatch failed: ${e.message}`);
|
|
13469
13472
|
}
|
|
@@ -14149,6 +14152,7 @@ var SlackAdapter = class extends ChannelAdapter {
|
|
|
14149
14152
|
};
|
|
14150
14153
|
|
|
14151
14154
|
// src/channels/telegram.ts
|
|
14155
|
+
var import_cross_fetch4 = __toESM(require("cross-fetch"));
|
|
14152
14156
|
var TelegramAdapter = class extends ChannelAdapter {
|
|
14153
14157
|
token;
|
|
14154
14158
|
polling = false;
|
|
@@ -14168,7 +14172,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14168
14172
|
async runPollingLoop() {
|
|
14169
14173
|
while (this.polling) {
|
|
14170
14174
|
try {
|
|
14171
|
-
const response = await
|
|
14175
|
+
const response = await (0, import_cross_fetch4.default)(`https://api.telegram.org/bot${this.token}/getUpdates?offset=${this.offset}&timeout=30`);
|
|
14172
14176
|
const data = await response.json();
|
|
14173
14177
|
if (data.ok && data.result && data.result.length > 0) {
|
|
14174
14178
|
for (const update of data.result) {
|
|
@@ -14187,7 +14191,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14187
14191
|
}
|
|
14188
14192
|
}
|
|
14189
14193
|
async sendMessage(chatId, text) {
|
|
14190
|
-
await
|
|
14194
|
+
await (0, import_cross_fetch4.default)(`https://api.telegram.org/bot${this.token}/sendMessage`, {
|
|
14191
14195
|
method: "POST",
|
|
14192
14196
|
headers: { "Content-Type": "application/json" },
|
|
14193
14197
|
body: JSON.stringify({ chat_id: chatId, text })
|
|
@@ -14196,6 +14200,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14196
14200
|
};
|
|
14197
14201
|
|
|
14198
14202
|
// src/deployment/huggingface_manager.ts
|
|
14203
|
+
var import_cross_fetch5 = __toESM(require("cross-fetch"));
|
|
14199
14204
|
var InferenceEndpointManager = class {
|
|
14200
14205
|
token;
|
|
14201
14206
|
baseUrl = "https://api.endpoints.huggingface.cloud/v2";
|
|
@@ -14232,7 +14237,7 @@ var InferenceEndpointManager = class {
|
|
|
14232
14237
|
}
|
|
14233
14238
|
}
|
|
14234
14239
|
};
|
|
14235
|
-
const res = await
|
|
14240
|
+
const res = await (0, import_cross_fetch5.default)(url, {
|
|
14236
14241
|
method: "POST",
|
|
14237
14242
|
headers: this.headers,
|
|
14238
14243
|
body: JSON.stringify(payload)
|
|
@@ -14248,7 +14253,7 @@ var InferenceEndpointManager = class {
|
|
|
14248
14253
|
*/
|
|
14249
14254
|
async getEndpointStatus(accountId, endpointName) {
|
|
14250
14255
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}`;
|
|
14251
|
-
const res = await
|
|
14256
|
+
const res = await (0, import_cross_fetch5.default)(url, { headers: this.headers });
|
|
14252
14257
|
if (!res.ok) throw new Error("Could not fetch endpoint status");
|
|
14253
14258
|
const data = await res.json();
|
|
14254
14259
|
return data.status.state;
|
|
@@ -14258,7 +14263,7 @@ var InferenceEndpointManager = class {
|
|
|
14258
14263
|
*/
|
|
14259
14264
|
async pauseEndpoint(accountId, endpointName) {
|
|
14260
14265
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/pause`;
|
|
14261
|
-
const res = await
|
|
14266
|
+
const res = await (0, import_cross_fetch5.default)(url, { method: "POST", headers: this.headers });
|
|
14262
14267
|
if (!res.ok) throw new Error("Failed to pause endpoint");
|
|
14263
14268
|
}
|
|
14264
14269
|
/**
|
|
@@ -14266,7 +14271,7 @@ var InferenceEndpointManager = class {
|
|
|
14266
14271
|
*/
|
|
14267
14272
|
async resumeEndpoint(accountId, endpointName) {
|
|
14268
14273
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/resume`;
|
|
14269
|
-
const res = await
|
|
14274
|
+
const res = await (0, import_cross_fetch5.default)(url, { method: "POST", headers: this.headers });
|
|
14270
14275
|
if (!res.ok) throw new Error("Failed to resume endpoint");
|
|
14271
14276
|
}
|
|
14272
14277
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1676,23 +1676,23 @@ function getName(value) {
|
|
|
1676
1676
|
return (typeof value === "object" && value !== null && ("name" in value && value.name && String(value.name) || "url" in value && value.url && String(value.url) || "filename" in value && value.filename && String(value.filename) || "path" in value && value.path && String(value.path)) || "").split(/[\\/]/).pop() || void 0;
|
|
1677
1677
|
}
|
|
1678
1678
|
var isAsyncIterable = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
1679
|
-
var maybeMultipartFormRequestOptions = async (opts,
|
|
1679
|
+
var maybeMultipartFormRequestOptions = async (opts, fetch7) => {
|
|
1680
1680
|
if (!hasUploadableValue(opts.body))
|
|
1681
1681
|
return opts;
|
|
1682
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1682
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1683
1683
|
};
|
|
1684
|
-
var multipartFormRequestOptions = async (opts,
|
|
1685
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1684
|
+
var multipartFormRequestOptions = async (opts, fetch7) => {
|
|
1685
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1686
1686
|
};
|
|
1687
1687
|
var supportsFormDataMap = /* @__PURE__ */ new WeakMap();
|
|
1688
1688
|
function supportsFormData(fetchObject) {
|
|
1689
|
-
const
|
|
1690
|
-
const cached = supportsFormDataMap.get(
|
|
1689
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
1690
|
+
const cached = supportsFormDataMap.get(fetch7);
|
|
1691
1691
|
if (cached)
|
|
1692
1692
|
return cached;
|
|
1693
1693
|
const promise = (async () => {
|
|
1694
1694
|
try {
|
|
1695
|
-
const FetchResponse = "Response" in
|
|
1695
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
1696
1696
|
const data = new FormData();
|
|
1697
1697
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
1698
1698
|
return false;
|
|
@@ -1702,11 +1702,11 @@ function supportsFormData(fetchObject) {
|
|
|
1702
1702
|
return true;
|
|
1703
1703
|
}
|
|
1704
1704
|
})();
|
|
1705
|
-
supportsFormDataMap.set(
|
|
1705
|
+
supportsFormDataMap.set(fetch7, promise);
|
|
1706
1706
|
return promise;
|
|
1707
1707
|
}
|
|
1708
|
-
var createForm = async (body,
|
|
1709
|
-
if (!await supportsFormData(
|
|
1708
|
+
var createForm = async (body, fetch7) => {
|
|
1709
|
+
if (!await supportsFormData(fetch7)) {
|
|
1710
1710
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
1711
1711
|
}
|
|
1712
1712
|
const form = new FormData();
|
|
@@ -8339,18 +8339,18 @@ function getName2(value, stripPath) {
|
|
|
8339
8339
|
return stripPath ? val.split(/[\\/]/).pop() || void 0 : val;
|
|
8340
8340
|
}
|
|
8341
8341
|
var isAsyncIterable2 = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
8342
|
-
var multipartFormRequestOptions2 = async (opts,
|
|
8343
|
-
return { ...opts, body: await createForm2(opts.body,
|
|
8342
|
+
var multipartFormRequestOptions2 = async (opts, fetch7, stripFilenames = true) => {
|
|
8343
|
+
return { ...opts, body: await createForm2(opts.body, fetch7, stripFilenames) };
|
|
8344
8344
|
};
|
|
8345
8345
|
var supportsFormDataMap2 = /* @__PURE__ */ new WeakMap();
|
|
8346
8346
|
function supportsFormData2(fetchObject) {
|
|
8347
|
-
const
|
|
8348
|
-
const cached = supportsFormDataMap2.get(
|
|
8347
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
8348
|
+
const cached = supportsFormDataMap2.get(fetch7);
|
|
8349
8349
|
if (cached)
|
|
8350
8350
|
return cached;
|
|
8351
8351
|
const promise = (async () => {
|
|
8352
8352
|
try {
|
|
8353
|
-
const FetchResponse = "Response" in
|
|
8353
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
8354
8354
|
const data = new FormData();
|
|
8355
8355
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
8356
8356
|
return false;
|
|
@@ -8360,11 +8360,11 @@ function supportsFormData2(fetchObject) {
|
|
|
8360
8360
|
return true;
|
|
8361
8361
|
}
|
|
8362
8362
|
})();
|
|
8363
|
-
supportsFormDataMap2.set(
|
|
8363
|
+
supportsFormDataMap2.set(fetch7, promise);
|
|
8364
8364
|
return promise;
|
|
8365
8365
|
}
|
|
8366
|
-
var createForm2 = async (body,
|
|
8367
|
-
if (!await supportsFormData2(
|
|
8366
|
+
var createForm2 = async (body, fetch7, stripFilenames = true) => {
|
|
8367
|
+
if (!await supportsFormData2(fetch7)) {
|
|
8368
8368
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
8369
8369
|
}
|
|
8370
8370
|
const form = new FormData();
|
|
@@ -12882,6 +12882,7 @@ var EchoVoice = class {
|
|
|
12882
12882
|
};
|
|
12883
12883
|
|
|
12884
12884
|
// src/widget/connector.ts
|
|
12885
|
+
import fetch2 from "cross-fetch";
|
|
12885
12886
|
var APIConnector = class {
|
|
12886
12887
|
baseUrl;
|
|
12887
12888
|
headers;
|
|
@@ -12909,7 +12910,7 @@ var APIConnector = class {
|
|
|
12909
12910
|
const controller = new AbortController();
|
|
12910
12911
|
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
12911
12912
|
try {
|
|
12912
|
-
const response = await
|
|
12913
|
+
const response = await fetch2(url, {
|
|
12913
12914
|
method,
|
|
12914
12915
|
headers: this.headers,
|
|
12915
12916
|
body: body ? JSON.stringify(body) : void 0,
|
|
@@ -12929,6 +12930,7 @@ var APIConnector = class {
|
|
|
12929
12930
|
import { z as z4 } from "zod";
|
|
12930
12931
|
|
|
12931
12932
|
// src/rag/knowledge.ts
|
|
12933
|
+
import fetch3 from "cross-fetch";
|
|
12932
12934
|
import * as fs from "fs/promises";
|
|
12933
12935
|
function cosineSimilarity(a, b) {
|
|
12934
12936
|
if (a.length !== b.length) return 0;
|
|
@@ -13057,7 +13059,7 @@ var KnowledgeBase = class {
|
|
|
13057
13059
|
return chunks.length;
|
|
13058
13060
|
}
|
|
13059
13061
|
async ingestURL(url) {
|
|
13060
|
-
const response = await
|
|
13062
|
+
const response = await fetch3(url);
|
|
13061
13063
|
const html = await response.text();
|
|
13062
13064
|
const text = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
13063
13065
|
return this.ingestText(text, url);
|
|
@@ -13262,6 +13264,7 @@ var ConversationAnalytics = class {
|
|
|
13262
13264
|
};
|
|
13263
13265
|
|
|
13264
13266
|
// src/analytics/handoff.ts
|
|
13267
|
+
import fetch4 from "cross-fetch";
|
|
13265
13268
|
import * as crypto2 from "crypto";
|
|
13266
13269
|
var HandoffManager = class {
|
|
13267
13270
|
webhookUrl;
|
|
@@ -13370,7 +13373,7 @@ var HandoffManager = class {
|
|
|
13370
13373
|
headers["X-Webhook-Signature"] = `sha256=${hmac.digest("hex")}`;
|
|
13371
13374
|
}
|
|
13372
13375
|
try {
|
|
13373
|
-
await
|
|
13376
|
+
await fetch4(this.webhookUrl, { method: "POST", headers, body });
|
|
13374
13377
|
} catch (e) {
|
|
13375
13378
|
console.error(`[HandoffManager] Webhook dispatch failed: ${e.message}`);
|
|
13376
13379
|
}
|
|
@@ -14056,6 +14059,7 @@ var SlackAdapter = class extends ChannelAdapter {
|
|
|
14056
14059
|
};
|
|
14057
14060
|
|
|
14058
14061
|
// src/channels/telegram.ts
|
|
14062
|
+
import fetch5 from "cross-fetch";
|
|
14059
14063
|
var TelegramAdapter = class extends ChannelAdapter {
|
|
14060
14064
|
token;
|
|
14061
14065
|
polling = false;
|
|
@@ -14075,7 +14079,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14075
14079
|
async runPollingLoop() {
|
|
14076
14080
|
while (this.polling) {
|
|
14077
14081
|
try {
|
|
14078
|
-
const response = await
|
|
14082
|
+
const response = await fetch5(`https://api.telegram.org/bot${this.token}/getUpdates?offset=${this.offset}&timeout=30`);
|
|
14079
14083
|
const data = await response.json();
|
|
14080
14084
|
if (data.ok && data.result && data.result.length > 0) {
|
|
14081
14085
|
for (const update of data.result) {
|
|
@@ -14094,7 +14098,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14094
14098
|
}
|
|
14095
14099
|
}
|
|
14096
14100
|
async sendMessage(chatId, text) {
|
|
14097
|
-
await
|
|
14101
|
+
await fetch5(`https://api.telegram.org/bot${this.token}/sendMessage`, {
|
|
14098
14102
|
method: "POST",
|
|
14099
14103
|
headers: { "Content-Type": "application/json" },
|
|
14100
14104
|
body: JSON.stringify({ chat_id: chatId, text })
|
|
@@ -14103,6 +14107,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14103
14107
|
};
|
|
14104
14108
|
|
|
14105
14109
|
// src/deployment/huggingface_manager.ts
|
|
14110
|
+
import fetch6 from "cross-fetch";
|
|
14106
14111
|
var InferenceEndpointManager = class {
|
|
14107
14112
|
token;
|
|
14108
14113
|
baseUrl = "https://api.endpoints.huggingface.cloud/v2";
|
|
@@ -14139,7 +14144,7 @@ var InferenceEndpointManager = class {
|
|
|
14139
14144
|
}
|
|
14140
14145
|
}
|
|
14141
14146
|
};
|
|
14142
|
-
const res = await
|
|
14147
|
+
const res = await fetch6(url, {
|
|
14143
14148
|
method: "POST",
|
|
14144
14149
|
headers: this.headers,
|
|
14145
14150
|
body: JSON.stringify(payload)
|
|
@@ -14155,7 +14160,7 @@ var InferenceEndpointManager = class {
|
|
|
14155
14160
|
*/
|
|
14156
14161
|
async getEndpointStatus(accountId, endpointName) {
|
|
14157
14162
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}`;
|
|
14158
|
-
const res = await
|
|
14163
|
+
const res = await fetch6(url, { headers: this.headers });
|
|
14159
14164
|
if (!res.ok) throw new Error("Could not fetch endpoint status");
|
|
14160
14165
|
const data = await res.json();
|
|
14161
14166
|
return data.status.state;
|
|
@@ -14165,7 +14170,7 @@ var InferenceEndpointManager = class {
|
|
|
14165
14170
|
*/
|
|
14166
14171
|
async pauseEndpoint(accountId, endpointName) {
|
|
14167
14172
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/pause`;
|
|
14168
|
-
const res = await
|
|
14173
|
+
const res = await fetch6(url, { method: "POST", headers: this.headers });
|
|
14169
14174
|
if (!res.ok) throw new Error("Failed to pause endpoint");
|
|
14170
14175
|
}
|
|
14171
14176
|
/**
|
|
@@ -14173,7 +14178,7 @@ var InferenceEndpointManager = class {
|
|
|
14173
14178
|
*/
|
|
14174
14179
|
async resumeEndpoint(accountId, endpointName) {
|
|
14175
14180
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/resume`;
|
|
14176
|
-
const res = await
|
|
14181
|
+
const res = await fetch6(url, { method: "POST", headers: this.headers });
|
|
14177
14182
|
if (!res.ok) throw new Error("Failed to resume endpoint");
|
|
14178
14183
|
}
|
|
14179
14184
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echo-ai-sdk-ts",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Echo AI SDK: Tier 5 Cloud Native (AWS Bedrock/SageMaker, GCP Vertex, Azure OpenAI/ML)",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@huggingface/inference": "^4.13.15",
|
|
19
19
|
"cors": "^2.8.5",
|
|
20
|
+
"cross-fetch": "^4.1.0",
|
|
20
21
|
"express": "^4.18.2",
|
|
21
22
|
"zod": "^3.25.76",
|
|
22
23
|
"zod-to-json-schema": "^3.25.1"
|
|
@@ -38,4 +39,4 @@
|
|
|
38
39
|
"typescript": "^5.3.3",
|
|
39
40
|
"vitest": "^1.3.1"
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
+
}
|