Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app_gradio/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ def update_rule_list(rule_type_mapping, rule_type):
return gr.CheckboxGroup(
choices=rule_type_mapping.get(rule_type, []),
value=[],
label="rule_list"
label="rule_list",
elem_classes="limited-height-checkboxgroup"
)


Expand Down Expand Up @@ -388,12 +389,14 @@ def get_data_column_mapping():
)
rule_list = gr.CheckboxGroup(
choices=rule_type_mapping.get(rule_type_options[0], []),
label="Rule List"
label="Rule List",
elem_classes="limited-height-checkboxgroup"
)
# LLM evaluator list
llm_list = gr.CheckboxGroup(
choices=llm_options,
label="LLM List"
label="LLM List",
elem_classes="limited-height-checkboxgroup"
)

gr.Markdown("### EvalPipline Configuration")
Expand Down
5 changes: 5 additions & 0 deletions app_gradio/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
a {
text-decoration: none;
}
/* 限制 Rule List 和 LLM List 的高度 */
.limited-height-checkboxgroup .wrap {
max-height: 160px !important;
overflow-y: auto !important;
}
Comment on lines +30 to +34
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This CSS block can be improved for better maintainability:

  1. Avoid !important: Using !important can make stylesheets difficult to maintain and debug as it breaks the natural CSS cascade. It's better to use more specific selectors if you need to override Gradio's default styles. If !important is truly necessary here to override inline styles from the Gradio library, consider adding a comment explaining why.
  2. Use English for comments: For consistency with the rest of the codebase and to ensure all contributors can understand it, it's best to write comments in English.

Here's a suggested revision that applies these points:

Suggested change
/* 限制 Rule List 和 LLM List 的高度 */
.limited-height-checkboxgroup .wrap {
max-height: 160px !important;
overflow-y: auto !important;
}
/* Limit the height of the checkbox group and enable scrolling */
.limited-height-checkboxgroup .wrap {
max-height: 160px;
overflow-y: auto;
}

</style></head>

<body>
Expand Down
Binary file added docs/assets/gradio_demo.old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/gradio_demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.