release v0.5.3

Former-commit-id: f6bc89581b3cd129448da2defc23848de6f494ed
This commit is contained in:
hiyouga
2024-02-29 00:34:19 +08:00
parent a2c881fa08
commit 544e7a491b
10 changed files with 116 additions and 67 deletions

View File

@@ -44,11 +44,14 @@ def can_quantize(finetuning_type: str) -> Dict[str, Any]:
def check_json_schema(text: str, lang: str) -> None:
try:
tools = json.loads(text)
for tool in tools:
assert "name" in tool
except AssertionError:
if tools:
assert isinstance(tools, list)
for tool in tools:
if "name" not in tool:
raise ValueError("Name not found.")
except ValueError:
gr.Warning(ALERTS["err_tool_name"][lang])
except json.JSONDecodeError:
except Exception:
gr.Warning(ALERTS["err_json_schema"][lang])