import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' interface AgentMarkdownProps { content: string className?: string } /** 简单检测是否含 Markdown 结构(标题/表格/引用/列表/粗体) */ export function looksLikeMarkdown(text: string): boolean { const t = text.trim() if (!t) return false return ( /^#{1,3}\s/m.test(t) || /^\|.+\|/m.test(t) || /^>\s/m.test(t) || /^[-*]\s/m.test(t) || /^\d+\.\s/m.test(t) || /\*\*[^*]+\*\*/.test(t) || /```/.test(t) ) } /** Agent 结论富文本:对齐 aiops AgentMarkdown,使用本产品色板 */ export function AgentMarkdown({ content, className = '' }: AgentMarkdownProps) { return (
{children}
), ul: ({ children }) => ({children}), table: ({ children }) => (
{children}
)
}
return (
{children}
)
},
hr: () =>