Skip to content

feat: BaseTextQuality根据score来判断#379

Merged
shijinpjlab merged 1 commit intoMigoXLab:devfrom
shijinpjlab:dev_0401
Apr 1, 2026
Merged

feat: BaseTextQuality根据score来判断#379
shijinpjlab merged 1 commit intoMigoXLab:devfrom
shijinpjlab:dev_0401

Conversation

@shijinpjlab
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the text quality evaluation logic in base_text_quality.py to determine status and labels based on a numerical score of 1 rather than a type string. The review feedback suggests refactoring the repeated score comparison into a boolean variable to improve readability and restoring explanatory comments for the counter-intuitive status field logic.

Comment on lines 50 to +54
result = EvalDetail(
metric=cls.__name__,
status=not is_good, # True if Bad (issues found), False if Good
status=False if response_model.score == 1 else True,
score=response_model.score,
label=["QUALITY_GOOD"] if is_good else [f"{response_model.type}.{response_model.name}"],
label=["QUALITY_GOOD"] if response_model.score == 1 else [f"{response_model.type}.{response_model.name}"],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

条件 response_model.score == 1 在此处被重复使用了两次。建议将其提取为一个布尔变量(如 is_good),这样可以提高代码的可读性并遵循 DRY(Don't Repeat Yourself)原则。此外,建议保留关于 status 字段含义的注释,因为 status=False 表示“良好”这种逻辑比较反直觉,注释有助于后续维护。这符合 PEP 8 关于代码清晰度的建议。

Suggested change
result = EvalDetail(
metric=cls.__name__,
status=not is_good, # True if Bad (issues found), False if Good
status=False if response_model.score == 1 else True,
score=response_model.score,
label=["QUALITY_GOOD"] if is_good else [f"{response_model.type}.{response_model.name}"],
label=["QUALITY_GOOD"] if response_model.score == 1 else [f"{response_model.type}.{response_model.name}"],
is_good = response_model.score == 1
result = EvalDetail(
metric=cls.__name__,
status=not is_good, # False 表示质量良好,True 表示存在问题
score=response_model.score,
label=["QUALITY_GOOD"] if is_good else [f"{response_model.type}.{response_model.name}"],

@shijinpjlab shijinpjlab merged commit 2dcae95 into MigoXLab:dev Apr 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant