From 889c1f27910eab6adf2db10cb015ab455fd38e67 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Sat, 22 Mar 2025 12:37:55 +0100 Subject: [PATCH] Remove unused JSON loading and serialization methods from PromptBuilder --- lib/src/prompt_builder.dart | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/lib/src/prompt_builder.dart b/lib/src/prompt_builder.dart index 2c6bd43..6c9acc4 100644 --- a/lib/src/prompt_builder.dart +++ b/lib/src/prompt_builder.dart @@ -1,8 +1,7 @@ class PromptBuilder { final String clientId; final Map _nodes = {}; - final Map> _outputToNode = - {}; // Maps output tags to node IDs + final Map> _outputToNode = {}; int _nodeIdCounter = 1; PromptBuilder({required this.clientId}); @@ -391,37 +390,4 @@ class PromptBuilder { return []; } } - - /// Loads nodes from a JSON map - void loadFromJson(Map json) { - _nodes.clear(); - _outputToNode.clear(); - - json.forEach((nodeId, nodeData) { - _nodes[nodeId] = nodeData; - - // Register outputs of this node - final classType = nodeData["class_type"]; - final defaultOutputs = _getDefaultOutputs(classType); - for (var i = 0; i < defaultOutputs.length; i++) { - final outputTag = nodeData["_meta"]?["outputTags"] - ?[defaultOutputs[i]] ?? - defaultOutputs[i]; - _outputToNode[outputTag] = { - "nodeId": nodeId, - "outputIndex": i.toString() - }; - } - }); - - // Update the node ID counter to avoid collisions - _nodeIdCounter = - _nodes.keys.map(int.parse).fold(0, (max, id) => id > max ? id : max) + - 1; - } - - /// Converts the current nodes to a JSON map - Map toJson() { - return Map.from(_nodes); - } }