mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-24 22:37:38 -05:00
24 lines
504 B
TypeScript
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');
|