omnius 1.0.138 → 1.0.139
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 +22 -11
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -626338,11 +626338,7 @@ Join: ${newUrl}`);
|
|
|
626338
626338
|
lastEditMs = now;
|
|
626339
626339
|
const html = renderTelegramLiveProgressHTML(progressLines, accumulated);
|
|
626340
626340
|
if (!html.trim()) return;
|
|
626341
|
-
|
|
626342
|
-
msg.chatId,
|
|
626343
|
-
liveMessageId,
|
|
626344
|
-
html
|
|
626345
|
-
).catch(() => {
|
|
626341
|
+
void this.editLiveMessage(msg.chatId, liveMessageId, html).catch(() => {
|
|
626346
626342
|
});
|
|
626347
626343
|
} else if (!liveMessageId && !liveMessagePromise && !msg.guestQueryId) {
|
|
626348
626344
|
const html = renderTelegramLiveProgressHTML(progressLines, accumulated);
|
|
@@ -626358,7 +626354,6 @@ Join: ${newUrl}`);
|
|
|
626358
626354
|
}).finally(() => {
|
|
626359
626355
|
liveMessagePromise = null;
|
|
626360
626356
|
});
|
|
626361
|
-
await liveMessagePromise;
|
|
626362
626357
|
}
|
|
626363
626358
|
}
|
|
626364
626359
|
}
|
|
@@ -626496,6 +626491,7 @@ ${conversationStream}`
|
|
|
626496
626491
|
try {
|
|
626497
626492
|
if (stream && typeof stream[Symbol.asyncIterator] === "function") {
|
|
626498
626493
|
try {
|
|
626494
|
+
let lastTokenEmitMs = 0;
|
|
626499
626495
|
for await (const chunk of stream) {
|
|
626500
626496
|
if (chunk.type !== "content") continue;
|
|
626501
626497
|
const piece = chunk.content;
|
|
@@ -626512,8 +626508,19 @@ ${conversationStream}`
|
|
|
626512
626508
|
} else {
|
|
626513
626509
|
this.bumpTelegramInferenceTokens(inferenceId, 1, 0);
|
|
626514
626510
|
accumulated += piece;
|
|
626515
|
-
const
|
|
626516
|
-
if (
|
|
626511
|
+
const now = Date.now();
|
|
626512
|
+
if (now - lastTokenEmitMs > 120) {
|
|
626513
|
+
lastTokenEmitMs = now;
|
|
626514
|
+
const partial = extractPartialTelegramReplyJson(accumulated);
|
|
626515
|
+
if (partial !== null) void onToken(partial);
|
|
626516
|
+
}
|
|
626517
|
+
}
|
|
626518
|
+
}
|
|
626519
|
+
const finalPartial = extractPartialTelegramReplyJson(accumulated);
|
|
626520
|
+
if (finalPartial !== null) {
|
|
626521
|
+
try {
|
|
626522
|
+
await onToken(finalPartial);
|
|
626523
|
+
} catch {
|
|
626517
626524
|
}
|
|
626518
626525
|
}
|
|
626519
626526
|
} catch (err) {
|
|
@@ -630042,7 +630049,7 @@ ${caption}\r
|
|
|
630042
630049
|
}
|
|
630043
630050
|
}
|
|
630044
630051
|
/** Make a Telegram Bot API call with rate-limit retry */
|
|
630045
|
-
async apiCall(method, body) {
|
|
630052
|
+
async apiCall(method, body, _retryDepth = 0) {
|
|
630046
630053
|
const url = `https://api.telegram.org/bot${this.botToken}/${method}`;
|
|
630047
630054
|
const options2 = {
|
|
630048
630055
|
method: "POST",
|
|
@@ -630060,9 +630067,13 @@ ${caption}\r
|
|
|
630060
630067
|
const res = await fetch(url, options2);
|
|
630061
630068
|
const data = await res.json();
|
|
630062
630069
|
if (data["error_code"] === 429 && data["parameters"]?.retry_after) {
|
|
630063
|
-
const waitSec = data["parameters"].retry_after;
|
|
630070
|
+
const waitSec = Math.min(3, data["parameters"].retry_after);
|
|
630071
|
+
const isLiveEdit = method === "editMessageText";
|
|
630072
|
+
if (isLiveEdit || _retryDepth >= 1) {
|
|
630073
|
+
return data;
|
|
630074
|
+
}
|
|
630064
630075
|
await new Promise((r2) => setTimeout(r2, waitSec * 1e3));
|
|
630065
|
-
return this.apiCall(method, body);
|
|
630076
|
+
return this.apiCall(method, body, _retryDepth + 1);
|
|
630066
630077
|
}
|
|
630067
630078
|
return data;
|
|
630068
630079
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.139",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.139",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED