import React from 'react';
import { handleDoubleClick } from '~/utils';
export const CodeVariableGfm = ({ children }: { children: React.ReactNode }) => {
return (
{children}
);
};
const regex = /{{(.*?)}}/g;
export const PromptVariableGfm = ({
children,
}: {
children: React.ReactNode & React.ReactNode[];
}) => {
const renderContent = (child: React.ReactNode) => {
if (typeof child === 'object' && child !== null) {
return child;
}
if (typeof child !== 'string') {
return child;
}
const parts = child.split(regex);
return parts.map((part, index) =>
index % 2 === 1 ? (
{`{{${part}}}`}
) : (
part
),
);
};
return
{React.Children.map(children, (child) => renderContent(child))}
; };