From fdf79d26e5a5641f4fda052d89acf883b1906075 Mon Sep 17 00:00:00 2001 From: "DESKTOP-CNFQ7PM\\Primere" Date: Fri, 20 Dec 2024 10:08:48 +0100 Subject: [PATCH] V 1.0.5 - Network tag loader --- components/utility.py | 74 ++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/components/utility.py b/components/utility.py index 95242a6..c24e1c3 100644 --- a/components/utility.py +++ b/components/utility.py @@ -144,31 +144,32 @@ def clear_prompt(NETWORK_START, NETWORK_END, promptstring, modelname=False): if (Match > 0): Matches.append(Match) - LabelEndIndex = sorted(Matches)[0] - MatchedString = promptstring[LabelStartIndex:(LabelEndIndex + 1)] - if len(MatchedString) > 0 and (modelname == False or (modelname != False and modelname in MatchedString)): - if '<' in MatchedString: - endString = '>' - Match = promptstring.find(endString, (LabelStartIndex + 1)) - if (Match > 0): - LabelEndIndex = Match - MatchedString = promptstring[LabelStartIndex:(LabelEndIndex + 1)] + if len(Matches) > 0: + LabelEndIndex = sorted(Matches)[0] + MatchedString = promptstring[LabelStartIndex:(LabelEndIndex + 1)] + if len(MatchedString) > 0 and (modelname == False or (modelname != False and modelname in MatchedString)): + if '<' in MatchedString: + endString = '>' + Match = promptstring.find(endString, (LabelStartIndex + 1)) + if (Match > 0): + LabelEndIndex = Match + MatchedString = promptstring[LabelStartIndex:(LabelEndIndex + 1)] + promptstring_temp = promptstring_temp.replace(MatchedString, "") + + if '{' in MatchedString: + endString = '}' + Match = promptstring.find(endString, (LabelStartIndex + 1)) + if (Match > 0): + LabelEndIndex = Match + MatchedString = promptstring[LabelStartIndex:(LabelEndIndex + 1)] + promptstring_temp = promptstring_temp.replace(MatchedString, "") + + if ')' in MatchedString: + MatchedString = promptstring[(LabelStartIndex - 1):(LabelEndIndex + 1)] promptstring_temp = promptstring_temp.replace(MatchedString, "") - if '{' in MatchedString: - endString = '}' - Match = promptstring.find(endString, (LabelStartIndex + 1)) - if (Match > 0): - LabelEndIndex = Match - MatchedString = promptstring[LabelStartIndex:(LabelEndIndex + 1)] - promptstring_temp = promptstring_temp.replace(MatchedString, "") - - if ')' in MatchedString: - MatchedString = promptstring[(LabelStartIndex - 1):(LabelEndIndex + 1)] promptstring_temp = promptstring_temp.replace(MatchedString, "") - promptstring_temp = promptstring_temp.replace(MatchedString, "") - return promptstring_temp.replace('()', '').replace(' , ,', ',').replace('||', '').replace('{,', '').replace(' ', ' ').replace(', ,', ',').strip(', ') @@ -193,22 +194,23 @@ def get_networks_prompt(NETWORK_START, NETWORK_END, promptstring): if (Match > 0): Matches.append(Match) - LabelEndIndex = sorted(Matches)[0] - MatchedString = promptstring[(LabelStartIndex + len(LABEL)):(LabelEndIndex)] - if len(MatchedString) > 0: - networkdata = MatchedString.split(":") - if len(networkdata) == 1: - networkdata.append('1') - if LABEL == ' 0: + LabelEndIndex = sorted(Matches)[0] + MatchedString = promptstring[(LabelStartIndex + len(LABEL)):(LabelEndIndex)] + if len(MatchedString) > 0: + networkdata = MatchedString.split(":") + if len(networkdata) == 1: + networkdata.append('1') + if LABEL == '