heyio 0.1.7 → 0.1.8
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.
|
@@ -187,14 +187,15 @@ async function executeOnSession(prompt, callback) {
|
|
|
187
187
|
const session = await ensureOrchestratorSession();
|
|
188
188
|
let accumulated = "";
|
|
189
189
|
const unsubDelta = session.on("assistant.message_delta", (event) => {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
const delta = event.data.deltaContent;
|
|
191
|
+
accumulated += delta;
|
|
192
|
+
callback(delta, false);
|
|
192
193
|
});
|
|
193
194
|
try {
|
|
194
195
|
const result = await session.sendAndWait({ prompt }, SEND_TIMEOUT_MS);
|
|
195
196
|
unsubDelta();
|
|
196
197
|
const finalText = result?.data.content ?? accumulated;
|
|
197
|
-
callback(
|
|
198
|
+
callback("", true);
|
|
198
199
|
return finalText;
|
|
199
200
|
}
|
|
200
201
|
catch (err) {
|
|
@@ -202,7 +203,7 @@ async function executeOnSession(prompt, callback) {
|
|
|
202
203
|
// If we accumulated partial text, return it gracefully on timeout
|
|
203
204
|
if (accumulated && err instanceof Error && err.message.includes("timeout")) {
|
|
204
205
|
console.error("[io] Session sendAndWait timed out, returning partial response");
|
|
205
|
-
callback(
|
|
206
|
+
callback("", true);
|
|
206
207
|
return accumulated;
|
|
207
208
|
}
|
|
208
209
|
// Session-level errors: invalidate and let caller retry
|
package/dist/telegram/bot.js
CHANGED
|
@@ -32,7 +32,10 @@ export function createBot() {
|
|
|
32
32
|
let pendingEdit;
|
|
33
33
|
const editReply = async (content) => {
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
const truncated = content.length > TELEGRAM_MAX_LENGTH
|
|
36
|
+
? content.slice(0, TELEGRAM_MAX_LENGTH - 20) + "\n\n[…truncated]"
|
|
37
|
+
: content;
|
|
38
|
+
await ctx.api.editMessageText(chatId, placeholder.message_id, truncated);
|
|
36
39
|
}
|
|
37
40
|
catch (err) {
|
|
38
41
|
const message = err instanceof Error ? err.message : String(err);
|