mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-12 13:00:44 +08:00
fix: preserve quoted message context across channels
This commit is contained in:
parent
c2be2389b0
commit
94e114b9b3
46 changed files with 4242 additions and 321 deletions
|
|
@ -35,7 +35,6 @@ import {
|
|||
hasInboundImages,
|
||||
imagePromptDiagnostic,
|
||||
imagePromptUserMessage,
|
||||
promptContentForMessage,
|
||||
} from './image-prompt.mjs';
|
||||
import {
|
||||
hasInboundFiles,
|
||||
|
|
@ -47,6 +46,10 @@ import {
|
|||
validHarnessQuestion,
|
||||
} from './harness-question.mjs';
|
||||
import { deliverOutboundArtifacts } from './semantic/artifact-delivery.mjs';
|
||||
import {
|
||||
hasReplyReference,
|
||||
promptContentForInboundMessage,
|
||||
} from './semantic/reply-reference.mjs';
|
||||
import {
|
||||
createDeliveryReceipt,
|
||||
createTextDeliveryBlock,
|
||||
|
|
@ -283,7 +286,8 @@ export class TextHarnessBridge {
|
|||
plainText: Boolean(text)
|
||||
&& normalized.plainText !== false
|
||||
&& !hasInboundImages(normalized)
|
||||
&& !hasInboundFiles(normalized),
|
||||
&& !hasInboundFiles(normalized)
|
||||
&& !hasReplyReference(normalized),
|
||||
});
|
||||
if (batch.handled) {
|
||||
if (batch.kind === 'submit') {
|
||||
|
|
@ -301,7 +305,8 @@ export class TextHarnessBridge {
|
|||
plainText: Boolean(text)
|
||||
&& normalized.plainText !== false
|
||||
&& !hasInboundImages(normalized)
|
||||
&& !hasInboundFiles(normalized),
|
||||
&& !hasInboundFiles(normalized)
|
||||
&& !hasReplyReference(normalized),
|
||||
});
|
||||
if (batch.handled) {
|
||||
return this.#finishLocalMessage(normalized, messageId, batch.message);
|
||||
|
|
@ -575,7 +580,8 @@ export class TextHarnessBridge {
|
|||
}
|
||||
const hasImages = hasInboundImages(message);
|
||||
const hasFiles = hasInboundFiles(message);
|
||||
if (!text && !hasImages && !hasFiles) {
|
||||
const hasReply = hasReplyReference(message);
|
||||
if (!text && !hasImages && !hasFiles && !hasReply) {
|
||||
await this.#bot.sendText(target, t('目前支持文字、图片和文件消息。'));
|
||||
return;
|
||||
}
|
||||
|
|
@ -669,8 +675,8 @@ export class TextHarnessBridge {
|
|||
);
|
||||
}
|
||||
}
|
||||
let content = hasImages
|
||||
? await promptContentForMessage(message, { signal: this.#signal })
|
||||
let content = hasImages || hasReply
|
||||
? await promptContentForInboundMessage(message, { signal: this.#signal })
|
||||
: undefined;
|
||||
const snapshot = this.#acceptedMessageIds.get(messageId);
|
||||
let contextEnhanced = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue