Skip to content

Commit

Permalink
rename graph to liteGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
isamu committed Jun 21, 2024
1 parent 050cd57 commit 99de9d6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ export default defineComponent({
let lite2graph = {};
let graph: LGraph | undefined = undefined;
let liteGraph: LGraph | undefined = undefined;
onMounted(() => {
const agents = agentlist.agents.reduce((tmp: any, agent) => {
tmp[agent.agentId] = agent;
return tmp;
}, {});
lite2graph = setAgentToLiteGraph(agents);
graph = new LiteGraph.LGraph();
liteGraph = new LiteGraph.LGraph();
if (!load()) {
graph.configure(defaultData);
liteGraph.configure(defaultData);
}
new LGraphCanvas(canvasRef.value, graph);
new LGraphCanvas(canvasRef.value, liteGraph);
graph.start();
liteGraph.start();
});
const download = () => {
if (graph) {
const data = graph.serialize();
if (liteGraph) {
const data = liteGraph.serialize();
console.log(JSON.stringify(data));
const graphData = liteGraph2GraphData(data, lite2graph as any);
console.log(graphData);
Expand All @@ -62,22 +62,22 @@ export default defineComponent({
const localStorageKey = "graphai-litegraph-data";
const save = () => {
if (graph) {
const data = graph.serialize();
if (liteGraph) {
const data = liteGraph.serialize();
localStorage.setItem(localStorageKey, JSON.stringify(data));
}
};
const load = () => {
const graphString = localStorage.getItem(localStorageKey);
if (graphString && graph) {
if (graphString && liteGraph) {
const data = JSON.parse(graphString);
graph.configure(data);
liteGraph.configure(data);
}
return !!graphString;
};
const reset = () => {
if (graph) {
graph.configure(defaultData);
if (liteGraph) {
liteGraph.configure(defaultData);
}
};
return {
Expand Down

0 comments on commit 99de9d6

Please sign in to comment.