Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Filter reference duplicates
Tomas Valenta7b33b46e1036
diff --git a/editor/schema.ts b/editor/schema.tsindex 0627e7a05..5956d556d 100644--- a/editor/schema.ts+++ b/editor/schema.ts@@ -87,7 +87,9 @@ const serializer = new MarkdownSerializer({export function html2markdown(html: string): [string, Reference[]] {const node = createDocument(html, schema)const markdown = serializer.serialize(node)+const references: Reference[] = []+node.descendants(n => {if (n.type.name === ReferenceExtension.name) {references.push({@@ -97,5 +99,11 @@ export function html2markdown(html: string): [string, Reference[]] {}})- return [markdown, references]+ const uniqueReferences = references.filter((reference, index, self) =>+ index === self.findIndex((r) => (+ r.type === reference.type && r.value === reference.value+ ))+ )++ return [markdown, uniqueReferences]}