fix: remember direct recipients for connection tests

This commit is contained in:
xmanrui 2026-08-19 11:24:50 +08:00
parent fb61c4235f
commit 3ac70a7c65
34 changed files with 397 additions and 178 deletions

View file

@ -31,7 +31,7 @@ export function connectionTestMessage(botName, channelLabel = '机器人') {
}
export function connectionTestTargetUnavailable(channelLabel = '机器人') {
const error = new Error(`请先私聊${channelLabel}发送 /status,再点击“检查连接”。`);
const error = new Error(`${channelLabel}尚未收到可用于测试的私聊消息。`);
error.code = 'test-target-unavailable';
return error;
}

View file

@ -101,6 +101,12 @@ export class TextHarnessBridge {
return Promise.resolve();
}
this.#acceptedMessageIds.add(messageId);
if (normalized.kind === 'direct') {
rememberConnectionTestTarget(
this.#state,
normalized.connectionTestTarget ?? normalized.replyTarget,
);
}
const key = `${kind}:${conversationId}`;
const pending = this.#pendingInteractions.get(key);
@ -252,9 +258,6 @@ export class TextHarnessBridge {
if (!hasImages && command === '/status') {
await this.#harness.ensureRunning({ signal: this.#signal });
await this.#bot.sendText(target, `${this.#descriptor.label}机器人与 DeepSeek Harness 连接正常。`);
if (message.kind === 'direct') {
rememberConnectionTestTarget(this.#state, message.connectionTestTarget ?? target);
}
return;
}
const workspaceCommand = !hasImages