Files
open-webui/src/lib/utils/apps.ts
T
2026-10-13 17:22:11 +04:00

24 lines
504 B
TypeScript

import type { Embed } from '$lib/apis/apps';
export const getAppMessageText = (message?: {
content?: string;
data?: { app?: { embeds?: Embed[] } };
}) =>
[
message?.content,
...(message?.data?.app?.embeds ?? []).map((embed) =>
[
embed.author?.name,
embed.title,
embed.description,
...(embed.fields ?? []).map((field) => `${field.name}: ${field.value}`),
embed.footer?.text,
embed.url
]
.filter(Boolean)
.join('\n')
)
]
.filter(Boolean)
.join('\n\n');