mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
1c30bb8ce6
* fix(telegram): preserve sticker media paths * fix(telegram): address PR validation failures * fix(telegram): preserve sticker media context * test(telegram): fix sticker proof checks --------- Co-authored-by: Vincent Koc <25068+vincentkoc@users.noreply.github.com>
28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
// Runner attachment facade keeps media attachment normalization/cache creation
|
|
// available from the public runner module without exposing implementation files.
|
|
import type { MsgContext } from "../auto-reply/templating.js";
|
|
import {
|
|
MediaAttachmentCache,
|
|
type MediaAttachmentCacheOptions,
|
|
normalizeAttachments,
|
|
} from "./attachments.js";
|
|
import type { MediaAttachment } from "./types.js";
|
|
|
|
/** Normalizes message context media fields for the media-understanding runner. */
|
|
export function normalizeMediaAttachments(ctx: MsgContext): MediaAttachment[] {
|
|
const attachments = normalizeAttachments(ctx);
|
|
// Cached Telegram sticker descriptions already cover the current attachment,
|
|
// but supplemental quote media still needs normal understanding.
|
|
return ctx.SkipStickerMediaUnderstanding
|
|
? attachments.filter((attachment) => attachment.index !== 0)
|
|
: attachments;
|
|
}
|
|
|
|
/** Creates the lazy attachment cache used by image, audio, video, and document providers. */
|
|
export function createMediaAttachmentCache(
|
|
attachments: MediaAttachment[],
|
|
options?: MediaAttachmentCacheOptions,
|
|
): MediaAttachmentCache {
|
|
return new MediaAttachmentCache(attachments, options);
|
|
}
|