Add multimodal image inputs to Face turns

This commit is contained in:
Meta Vens 2026-05-24 03:28:40 +01:00
commit c430e709fd
12 changed files with 281 additions and 16 deletions

View file

@ -34,7 +34,7 @@ export function buildDiscordReplyPrompt(
? context.recentMessages
.map(
(message) =>
`- [${message.timestamp}] ${message.authorName}: ${message.content}`,
`- [${message.timestamp}] ${message.authorName}: ${message.content}${renderAttachmentSuffix(message)}`,
)
.join("\n")
: "- No recent messages captured.";
@ -116,7 +116,7 @@ export function renderMarkdownBundle(context: ContextBundle): string {
? context.recentMessages
.map(
(message) =>
`- [${message.timestamp}] ${message.authorName} (${message.authorId}): ${message.content}`,
`- [${message.timestamp}] ${message.authorName} (${message.authorId}): ${message.content}${renderAttachmentSuffix(message)}`,
)
.join("\n")
: "- No recent messages captured.";
@ -183,6 +183,20 @@ export function renderMarkdownBundle(context: ContextBundle): string {
].join("\n");
}
function renderAttachmentSuffix(message: ContextBundle["recentMessages"][number]): string {
const attachments = message.attachments ?? [];
if (attachments.length === 0) {
return "";
}
return ` [media: ${attachments.map((attachment) => {
const kind = attachment.kind === "image" ? "image" : "attachment";
const name = attachment.filename ?? attachment.id ?? "unnamed";
const dimensions = attachment.width && attachment.height ? ` ${attachment.width}x${attachment.height}` : "";
const local = attachment.localPath ? ` local=${attachment.localPath}` : "";
return `${kind} ${name}${dimensions}${local}`;
}).join("; ")}]`;
}
function renderVoidSelfState(context: ContextBundle): string {
if (!context.voidSelfState) {
return "- No private persistent self-state was attached.";