mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-02 01:27:14 +00:00
style:fmt
This commit is contained in:
@@ -155,7 +155,7 @@ class BaseOutputParser(ABC):
|
||||
if i < 0:
|
||||
return None
|
||||
count = 1
|
||||
for j, c in enumerate(s[i + 1:], start=i + 1):
|
||||
for j, c in enumerate(s[i + 1 :], start=i + 1):
|
||||
if c == "]":
|
||||
count -= 1
|
||||
elif c == "[":
|
||||
@@ -163,13 +163,13 @@ class BaseOutputParser(ABC):
|
||||
if count == 0:
|
||||
break
|
||||
assert count == 0
|
||||
return s[i: j + 1]
|
||||
return s[i : j + 1]
|
||||
else:
|
||||
i = s.find("{")
|
||||
if i < 0:
|
||||
return None
|
||||
count = 1
|
||||
for j, c in enumerate(s[i + 1:], start=i + 1):
|
||||
for j, c in enumerate(s[i + 1 :], start=i + 1):
|
||||
if c == "}":
|
||||
count -= 1
|
||||
elif c == "{":
|
||||
@@ -177,7 +177,7 @@ class BaseOutputParser(ABC):
|
||||
if count == 0:
|
||||
break
|
||||
assert count == 0
|
||||
return s[i: j + 1]
|
||||
return s[i : j + 1]
|
||||
|
||||
def parse_prompt_response(self, model_out_text) -> T:
|
||||
"""
|
||||
@@ -194,9 +194,9 @@ class BaseOutputParser(ABC):
|
||||
# if "```" in cleaned_output:
|
||||
# cleaned_output, _ = cleaned_output.split("```")
|
||||
if cleaned_output.startswith("```json"):
|
||||
cleaned_output = cleaned_output[len("```json"):]
|
||||
cleaned_output = cleaned_output[len("```json") :]
|
||||
if cleaned_output.startswith("```"):
|
||||
cleaned_output = cleaned_output[len("```"):]
|
||||
cleaned_output = cleaned_output[len("```") :]
|
||||
if cleaned_output.endswith("```"):
|
||||
cleaned_output = cleaned_output[: -len("```")]
|
||||
cleaned_output = cleaned_output.strip()
|
||||
|
Reference in New Issue
Block a user