-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
Please make some good docs for @gorules/jdm-editor
want to implement it in my project but not able to do so as it has no docs available for GraphSimulator.
Even the AI's aren't trained on it.
Nor solution available in stack overflow.
import React, { useState, useRef, Suspense } from "react";
import "@gorules/jdm-editor/dist/style.css";
import { FaPlay } from "react-icons/fa";
const JdmConfigProvider = React.lazy(() =>
import("@gorules/jdm-editor").then((m) => ({ default: m.JdmConfigProvider }))
);
const DecisionGraph = React.lazy(() =>
import("@gorules/jdm-editor").then((m) => ({ default: m.DecisionGraph }))
);
const GraphSimulator = React.lazy(() =>
import("@gorules/jdm-editor").then((m) => ({ default: m.GraphSimulator }))
);
const DecisionGraphWrapper = () => {
const [graph, setGraph] = useState(null);
const handleRun = (request, response) => {
console.log("Request:", request);
console.log("Output:", response.output);
console.log("Trace:", response.metadata);
};
const panels = [
{
id: "simulator",
title: "Simulator",
icon: <FaPlay />,
renderPanel: () => (
<GraphSimulator
onChange={(res) => console.log("Sim result:", res)}
onRun={handleRun}
/>
),
},
];
return (
<Suspense fallback={<div>Loading Editor...</div>}>
<JdmConfigProvider>
<div className="h-screen">
<DecisionGraph value={graph} onChange={setGraph} panels={panels} />
</div>
</JdmConfigProvider>
</Suspense>
);
};
export default DecisionGraphWrapper;
This is a code for a react page.
It cannot run simulator.
After clicking the run button
always facing this error/alert -
"Invalid format
Unable to format request, invalid JSON format"
please make some good docs for it
docs are available only for - JdmConfigProvider and DecisionGraph
Metadata
Metadata
Assignees
Labels
No labels

