From 8eb941e1b044d11a54f95919c434ccc278735826 Mon Sep 17 00:00:00 2001 From: AlekPet Date: Sun, 29 Jun 2025 15:51:05 +0300 Subject: [PATCH] Disabled DeepLX nodes by default, run_deeplx equal false. --- DeepLXTranslateNode/README.md | 7 +++++-- DeepLXTranslateNode/deeplx_translate_node.py | 8 ++++---- __init__.py | 18 ++++++++++++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/DeepLXTranslateNode/README.md b/DeepLXTranslateNode/README.md index 5422d81..f56b26d 100644 --- a/DeepLXTranslateNode/README.md +++ b/DeepLXTranslateNode/README.md @@ -109,7 +109,10 @@ You can also call the automatic installer by running shell `run_install_deeplx_w ### Note -On first launch, a `config.json` file will be created where you can specify the initial values ​​from which language to translate and to which language. You can also disable DeepLXTranslate nodes using the 'run_deeplx' property. +On first launch, a `config.json` file will be created where you can specify the initial values ​​from which language to translate and to which language. +**Warning:** DeepLX nodes are disabled by default. **At the moment, the DeepLX module is not working and the executable file is being compiled. Use at your own risk.** +If you still want to use these nodes, change the `"run_deeplx"` parameter to `true` in `config.js`. + **Default config.json values:** ```json @@ -118,7 +121,7 @@ On first launch, a `config.json` file will be created where you can specify the "__commnet": "Please check the list of available languages ​​before specifying, especially target_lang! Property run_deeplx disable DeepLXTranslate nodes. See README file", "source_lang": "Russian", "target_lang": "English", - "run_deeplx": true + "run_deeplx": false } } ``` diff --git a/DeepLXTranslateNode/deeplx_translate_node.py b/DeepLXTranslateNode/deeplx_translate_node.py index 10d5c90..89ab4b6 100644 --- a/DeepLXTranslateNode/deeplx_translate_node.py +++ b/DeepLXTranslateNode/deeplx_translate_node.py @@ -109,10 +109,10 @@ if not os.path.exists(config_path): with open(config_path, "w", encoding="utf-8") as f: defaultJSON = { "settings": { - "__commnet": "Please check the list of available languages ​​before specifying, especially target_lang! Property run_deeplx disable DeepLXTranslate nodes. See README file", + "__commnet": "Please check the list of available languages ​​before specifying, especially target_lang! Property run_deeplx enable or disable DeepLXTranslate nodes. See README file", "source_lang": "Russian", "target_lang": "English", - "run_deeplx": True + "run_deeplx": False } } json.dump(defaultJSON, f, ensure_ascii=False, indent=4) @@ -153,9 +153,9 @@ PATH_TO_DEEPLX_SERVER = os.path.join(NODE_DIR, "DeepLX") PATH_TO_GO = os.path.join(NODE_DIR, "go", "bin") # We check whether the user has disabled the launch of the DeepLX server. -if not SETTINGS.get("run_deeplx", True): # Setting whether to run DeepLX server +if not SETTINGS.get("run_deeplx", False): # Setting whether to run DeepLX server DEEPLX_SERVER_RUNNING = False - raise Exception("User disabled DeepLX server startup in config.json (proprety: 'run_deeplx')") + raise Exception("DeepLX nodes are disabled by default, read README: https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet/tree/master/DeepLXTranslateNode#note", "warning") ### Automatical install Golang (Go) and DeepLX ### diff --git a/__init__.py b/__init__.py index 6efae25..9843179 100644 --- a/__init__.py +++ b/__init__.py @@ -499,19 +499,29 @@ failed_nodes_text = "" len_nodes = len(nodes_list_dict) for key, node in enumerate(nodes_list_dict): currentNode = nodes_list_dict[node] - if currentNode.get("error", None) is None: + + currentNodeVals = currentNode.get("error") + + if currentNodeVals is None: status = "\033[92m[Loading]" else: - status = "\033[1;31;40m[Failed]" + color_error = "\033[1;31;40m" + status = color_error + " [Failed]" error_message = currentNode.get("error", "Error") - failed_nodes_text += f"\033[93m{node} -> \033[1;31;40m{error_message}\033[0m\n" + + if(len(currentNodeVals.args) == 2 and currentNodeVals.args[1] == "warning"): + color_error = "\033[33m" + status = color_error + "[Warning]" + error_message = currentNodeVals.args[0] + + failed_nodes_text += f"\033[93m{node} -> {color_error}{error_message}\033[0m\n" message = currentNode.get("message", "No message available") printColorInfo(f"{message}{status}\033[0m") if key == len_nodes - 1 and failed_nodes_text: printColorInfo( - f"\n\033[1;31;40m* Nodes have been temporarily disabled due to the error *\033[0m\n{failed_nodes_text}" + f"\n\033[1;31;40m* Nodes have been temporarily disabled due to the error or specially *\033[0m\n{failed_nodes_text}" ) printColorInfo(f"### [END] ComfyUI AlekPet Nodes ###", "\033[1;35m")