@chen_hu_hu/pi-qq 1.3.3 → 1.3.4
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/CHANGELOG.md +14 -1
- package/README-zh.md +5 -3
- package/README.md +5 -3
- package/doc/enhance-status.md +427 -0
- package/index.ts +38 -31
- package/package.json +1 -1
- package/src/attachments/attachment-download.ts +13 -8
- package/src/attachments/attachment-failure.ts +4 -2
- package/src/attachments/file-attachments.ts +11 -4
- package/src/infra/file-logger.ts +6 -2
- package/src/infra/i18n.ts +525 -0
- package/src/infra/power-status.ts +116 -0
- package/src/infra/settings.ts +28 -8
- package/src/qq/inbound-attachments.ts +2 -1
- package/src/qq/inbound-command.ts +17 -16
- package/src/qq/qq-bot.ts +4 -7
- package/src/qq/qq-diagnostics.ts +28 -21
- package/src/qq/qq-message-handler.ts +2 -1
- package/src/qq/qr-login.ts +9 -8
- package/src/qq/reply-sender.ts +4 -3
- package/src/qq/status-report.ts +112 -0
- package/src/quota/reply-quota-report.ts +36 -8
- package/src/relay/bubble-writer.ts +4 -3
- package/src/relay/run-stream-relay.ts +2 -2
- package/src/relay/stream-block-format.ts +6 -2
- package/src/relay/stream-session.ts +3 -4
|
@@ -143,7 +143,7 @@ export class RunFeedback {
|
|
|
143
143
|
writer,
|
|
144
144
|
};
|
|
145
145
|
this.run = run;
|
|
146
|
-
log.debug("run", "started", { msgId: run.msgId?.slice(0, 8) ?? "?" });
|
|
146
|
+
log.debug("run", "run started", { msgId: run.msgId?.slice(0, 8) ?? "?" });
|
|
147
147
|
|
|
148
148
|
const keepTyping = () => {
|
|
149
149
|
void bot.sendTyping({ scope: "c2c", targetId: run.openid }, 60).catch(() => {});
|
|
@@ -245,7 +245,7 @@ export class RunFeedback {
|
|
|
245
245
|
if (run.currentText.trim()) this.lastCompletedText = run.currentText;
|
|
246
246
|
if (!run.hadError && run.writer.hasPushed) this.recovery = null;
|
|
247
247
|
this.run = null;
|
|
248
|
-
log.debug("run", "ended", {
|
|
248
|
+
log.debug("run", "run ended", {
|
|
249
249
|
msgId: run.msgId?.slice(0, 8) ?? "?",
|
|
250
250
|
elapsedMs: Date.now() - run.startedAt,
|
|
251
251
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { t } from "../infra/i18n";
|
|
2
|
+
|
|
3
|
+
export function thinkingHeader(): string {
|
|
4
|
+
return `**💭 ${t("stream.thinking")}**\n\n`;
|
|
5
|
+
}
|
|
2
6
|
const ARG_MAX_CHARS = 200;
|
|
3
7
|
const RESULT_MAX_CHARS = 600;
|
|
4
8
|
const RESULT_MAX_LINES = 8;
|
|
@@ -109,7 +113,7 @@ function resultText(result: unknown): string {
|
|
|
109
113
|
export function formatToolResult(result: unknown, isError: boolean): string {
|
|
110
114
|
let text = resultText(result);
|
|
111
115
|
text = text.replace(/\r\n/g, "\n").replace(/\s+$/, "");
|
|
112
|
-
if (!text) text = "
|
|
116
|
+
if (!text) text = t("stream.noOutput");
|
|
113
117
|
text = truncateText(text, RESULT_MAX_CHARS, RESULT_MAX_LINES);
|
|
114
118
|
if (isError) text = `❌ ${text}`;
|
|
115
119
|
const fence = backtickFence(text, 3);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getNextMsgSeq, StreamContentType, StreamInputState } from "@tencent-connect/qqbot-nodejs/protocol";
|
|
2
|
+
import { t } from "../infra/i18n";
|
|
2
3
|
import type {
|
|
3
4
|
Credentials,
|
|
4
5
|
MessageApi,
|
|
@@ -164,13 +165,11 @@ export class AppendStream {
|
|
|
164
165
|
} catch (err) {
|
|
165
166
|
const reason = err instanceof Error ? err.message : String(err);
|
|
166
167
|
if (attempt >= MAX_RETRIES || !this.isRateLimitError(err)) {
|
|
167
|
-
this.opts.onDebug?.(
|
|
168
|
+
this.opts.onDebug?.(t("log.streamFrameFailed", { index: req.index, attempts: attempt + 1, reason }));
|
|
168
169
|
throw err;
|
|
169
170
|
}
|
|
170
171
|
const delay = base * 2 ** attempt;
|
|
171
|
-
this.opts.onDebug?.(
|
|
172
|
-
`frame index=${req.index} rate limited (attempt ${attempt + 1}), retry in ${delay}ms: ${reason}`,
|
|
173
|
-
);
|
|
172
|
+
this.opts.onDebug?.(t("log.streamFrameRateLimited", { index: req.index, attempt: attempt + 1, delay, reason }));
|
|
174
173
|
await new Promise((r) => setTimeout(r, delay));
|
|
175
174
|
}
|
|
176
175
|
}
|