Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
poc of validate config (#24837)
Asuka Minato9f528d23d442
diff --git a/api/core/app/app_config/features/more_like_this/manager.py b/api/core/app/app_config/features/more_like_this/manager.pyindex 496e1beeecf..f0ec6b0f6f9 100644--- a/api/core/app/app_config/features/more_like_this/manager.py+++ b/api/core/app/app_config/features/more_like_this/manager.py@@ -1,3 +1,14 @@+from pydantic import BaseModel, Field, ValidationError+++class MoreLikeThisConfig(BaseModel):+ enabled: bool = False+++class AppConfigModel(BaseModel):+ more_like_this: MoreLikeThisConfig = Field(default_factory=MoreLikeThisConfig)++class MoreLikeThisConfigManager:@classmethoddef convert(cls, config: dict) -> bool:@@ -6,31 +17,14 @@ class MoreLikeThisConfigManager::param config: model config args"""- more_like_this = False- more_like_this_dict = config.get("more_like_this")- if more_like_this_dict:- if more_like_this_dict.get("enabled"):- more_like_this = True-- return more_like_this+ validated_config, _ = cls.validate_and_set_defaults(config)+ return AppConfigModel.model_validate(validated_config).more_like_this.enabled@classmethoddef validate_and_set_defaults(cls, config: dict) -> tuple[dict, list[str]]:- """- Validate and set defaults for more like this feature-- :param config: app model config args- """- if not config.get("more_like_this"):- config["more_like_this"] = {"enabled": False}-- if not isinstance(config["more_like_this"], dict):- raise ValueError("more_like_this must be of dict type")-- if "enabled" not in config["more_like_this"] or not config["more_like_this"]["enabled"]:- config["more_like_this"]["enabled"] = False-- if not isinstance(config["more_like_this"]["enabled"], bool):- raise ValueError("enabled in more_like_this must be of boolean type")-- return config, ["more_like_this"]+ try:+ return AppConfigModel.model_validate(config).dict(), ["more_like_this"]+ except ValidationError as e:+ raise ValueError(+ "more_like_this must be of dict type and enabled in more_like_this must be of boolean type"+ )