From fbc77e0b617db9b7ac7776f9fe64662a12652dea Mon Sep 17 00:00:00 2001 From: Priyan Vaithilingam Date: Wed, 3 May 2023 11:16:03 -0400 Subject: [PATCH] addedmore logic --- chain-forge/src/ScriptNode.js | 4 ++-- python-backend/app.py | 6 ++++++ python-backend/promptengine/utils.py | 2 -- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/chain-forge/src/ScriptNode.js b/chain-forge/src/ScriptNode.js index 458c8ee..f248735 100644 --- a/chain-forge/src/ScriptNode.js +++ b/chain-forge/src/ScriptNode.js @@ -29,7 +29,7 @@ const ScriptNode = ({ data, id }) => { useEffect(() => { if (!data.scriptFiles) setDataPropsForNode(id, { scriptFiles: { f0: '' } }); - }, []); + }, [data.scriptFiles, id, setDataPropsForNode]); // Whenever 'data' changes, update the input fields to reflect the current state. useEffect(() => { @@ -42,7 +42,7 @@ const ScriptNode = ({ data, id }) => { ) })); - }, [data.scriptFiles]); + }, [data.scriptFiles, handleInputChange]); // Add a field const handleAddField = useCallback(() => { diff --git a/python-backend/app.py b/python-backend/app.py index d8ab807..4070ee5 100644 --- a/python-backend/app.py +++ b/python-backend/app.py @@ -270,6 +270,12 @@ def execute(): for script_path in data['script_paths']: # get the folder of the script_path: script_folder = os.path.dirname(script_path) + # check that the script_folder is valid, and it contains __init__.py + if not os.path.exists(script_folder): + print(script_folder, 'is not a valid script path.') + print(os.path.exists(script_folder)) + continue + # add it to the path: sys.path.append(script_folder) print(f'added {script_folder} to sys.path') diff --git a/python-backend/promptengine/utils.py b/python-backend/promptengine/utils.py index 179337b..456a7e6 100644 --- a/python-backend/promptengine/utils.py +++ b/python-backend/promptengine/utils.py @@ -8,8 +8,6 @@ DALAI_RESPONSE = None openai.api_key = os.environ.get("OPENAI_API_KEY") - - """ Supported LLM coding assistants """ class LLM(Enum): ChatGPT = 0