be more specific for error message (#1409)

### What problem does this PR solve?

#918 

### Type of change

- [x] Refactoring
This commit is contained in:
KevinHuSh
2024-07-08 09:32:44 +08:00
committed by GitHub
parent dcb3fb2073
commit b3ebc66b13
9 changed files with 126 additions and 61 deletions

View File

@@ -35,7 +35,10 @@ class CategorizeParam(GenerateParam):
def check(self):
super().check()
self.check_empty(self.category_description, "Category examples")
self.check_empty(self.category_description, "[Categorize] Category examples")
for k, v in self.category_description.items():
if not k: raise ValueError(f"[Categorize] Category name can not be empty!")
if not v["to"]: raise ValueError(f"[Categorize] 'To' of category {k} can not be empty!")
def get_prompt(self):
cate_lines = []