/** * Copyright (c) 2023 MERCENARIES.AI PTE. LTD. * All rights reserved. */ import { ChatRenderer } from 'omni-client-services'; // An extension to render markdown in a chat message class OmniComponentMetaRenderer extends ChatRenderer { // opts: https://marked.js.org/using_advanced constructor(opts?: NonNullable) { opts ??= {}; super({ id: 'omni/component-meta' }, opts); } async load(): Promise {} render(content: { type: string; value: any }): string { let text = ''; if (content.value?.source) { // TODO: [security] Filter all strings for XSS text = `
Authors:

`; } else { text = `

`; } // const escapedContent = escapeHtmlSpecialChars(text); // const sanitizedHtml = DOMPurify.sanitize(escapedContent); return text; } } export default OmniComponentMetaRenderer;