Refactor config system to use Pydantic validation
Refactored configuration classes to inherit from a new ValidatedConfigBase using Pydantic for robust validation and error reporting. Updated api_ada_configs.py, config.py, config_base.py, and official_configs.py to replace dataclasses with Pydantic models, add field validation, and improve error messages. This change enhances configuration reliability and developer feedback for misconfigurations. Also includes minor code cleanups and removal of unused variables in other modules.
This commit is contained in:
@@ -95,7 +95,7 @@ class MainSystem:
|
||||
from random import choices
|
||||
|
||||
# 分离彩蛋和权重
|
||||
egg_texts, weights = zip(*phrases)
|
||||
egg_texts, weights = zip(*phrases, strict=False)
|
||||
|
||||
# 使用choices进行带权重的随机选择
|
||||
selected_egg = choices(egg_texts, weights=weights, k=1)
|
||||
|
||||
Reference in New Issue
Block a user