依旧修pyright喵喵喵~
This commit is contained in:
@@ -176,7 +176,7 @@ def _remove_obsolete_keys(target: TOMLDocument | dict | Table, reference: TOMLDo
|
||||
if key not in reference:
|
||||
del target[key]
|
||||
elif isinstance(target.get(key), dict | Table) and isinstance(reference.get(key), dict | Table):
|
||||
_remove_obsolete_keys(target[key], reference[key])
|
||||
_remove_obsolete_keys(target[key], reference[key]) # type: ignore
|
||||
|
||||
|
||||
def _update_dict(target: TOMLDocument | dict | Table, source: TOMLDocument | dict):
|
||||
@@ -433,9 +433,9 @@ class Config(ValidatedConfigBase):
|
||||
class APIAdapterConfig(ValidatedConfigBase):
|
||||
"""API Adapter配置类"""
|
||||
|
||||
models: list[ModelInfo] = Field(..., min_items=1, description="模型列表")
|
||||
models: list[ModelInfo] = Field(..., min_length=1, description="模型列表")
|
||||
model_task_config: ModelTaskConfig = Field(..., description="模型任务配置")
|
||||
api_providers: list[APIProvider] = Field(..., min_items=1, description="API提供商列表")
|
||||
api_providers: list[APIProvider] = Field(..., min_length=1, description="API提供商列表")
|
||||
|
||||
def __init__(self, **data):
|
||||
super().__init__(**data)
|
||||
|
||||
@@ -177,7 +177,9 @@ class ValidatedConfigBase(BaseModel):
|
||||
element_index = field_path[1]
|
||||
|
||||
# 尝试获取父字段的类型信息
|
||||
parent_field_info = cls.model_fields.get(parent_field)
|
||||
parent_field_info = None
|
||||
if isinstance(parent_field, str):
|
||||
parent_field_info = cls.model_fields.get(parent_field)
|
||||
|
||||
if parent_field_info and hasattr(parent_field_info, "annotation"):
|
||||
expected_type = parent_field_info.annotation
|
||||
@@ -214,7 +216,9 @@ class ValidatedConfigBase(BaseModel):
|
||||
# 处理模型类型错误
|
||||
elif error_type in ["model_type", "dict_type", "is_instance_of"]:
|
||||
field_name = field_path[0] if field_path else "unknown"
|
||||
field_info = cls.model_fields.get(field_name)
|
||||
field_info = None
|
||||
if isinstance(field_name, str):
|
||||
field_info = cls.model_fields.get(field_name)
|
||||
|
||||
if field_info and hasattr(field_info, "annotation"):
|
||||
expected_type = field_info.annotation
|
||||
|
||||
@@ -638,15 +638,15 @@ class PlanningSystemConfig(ValidatedConfigBase):
|
||||
"""规划系统配置 (日程与月度计划)"""
|
||||
|
||||
# --- 日程生成 (原 ScheduleConfig) ---
|
||||
schedule_enable: bool = Field(True, description="是否启用每日日程生成功能")
|
||||
schedule_guidelines: str = Field("", description="日程生成指导原则")
|
||||
schedule_enable: bool = Field(default=True, description="是否启用每日日程生成功能")
|
||||
schedule_guidelines: str = Field(default="", description="日程生成指导原则")
|
||||
|
||||
# --- 月度计划 (原 MonthlyPlanSystemConfig) ---
|
||||
monthly_plan_enable: bool = Field(True, description="是否启用月度计划系统")
|
||||
monthly_plan_guidelines: str = Field("", description="月度计划生成指导原则")
|
||||
max_plans_per_month: int = Field(10, description="每月最多生成的计划数量")
|
||||
avoid_repetition_days: int = Field(7, description="避免在多少天内重复使用同一个月度计划")
|
||||
completion_threshold: int = Field(3, description="一个月度计划被使用多少次后算作完成")
|
||||
monthly_plan_enable: bool = Field(default=True, description="是否启用月度计划系统")
|
||||
monthly_plan_guidelines: str = Field(default="", description="月度计划生成指导原则")
|
||||
max_plans_per_month: int = Field(default=10, description="每月最多生成的计划数量")
|
||||
avoid_repetition_days: int = Field(default=7, description="避免在多少天内重复使用同一个月度计划")
|
||||
completion_threshold: int = Field(default=3, description="一个月度计划被使用多少次后算作完成")
|
||||
|
||||
|
||||
class DependencyManagementConfig(ValidatedConfigBase):
|
||||
|
||||
Reference in New Issue
Block a user