feat(data-process): 支持单项生成五十条数据

This commit is contained in:
caoxiaozhu
2026-07-27 09:11:51 +08:00
parent 25d75f40c7
commit 9428c6b785
7 changed files with 400 additions and 86 deletions

View File

@@ -5,6 +5,8 @@ from typing import Any, Literal
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
from app.modules.data_process.constants import MAX_QA_PAIRS_PER_ITEM
def _config_value(config: dict[str, Any], snake_name: str, camel_name: str, default: Any) -> Any:
if snake_name in config:
@@ -89,8 +91,14 @@ def _validate_process_config(config: dict[str, Any]) -> None:
pairs = _config_value(config, snake_name, camel_name, None)
if pairs is None:
continue
if isinstance(pairs, bool) or not isinstance(pairs, int) or not 1 <= pairs <= 5:
raise ValueError(f"{snake_name} must be an integer in [1, 5]")
if (
isinstance(pairs, bool)
or not isinstance(pairs, int)
or not 1 <= pairs <= MAX_QA_PAIRS_PER_ITEM
):
raise ValueError(
f"{snake_name} must be an integer in [1, {MAX_QA_PAIRS_PER_ITEM}]"
)
class DataProcessStatus(StrEnum):