feat(product-suite): compact controls and remember settings
This commit is contained in:
@@ -112,6 +112,14 @@ DEFAULT_CONFIG = {
|
||||
"dry_run": False,
|
||||
"max_parallel_accounts": 1,
|
||||
},
|
||||
"product_suite": {
|
||||
"last_settings": {
|
||||
"platform": "Shopee",
|
||||
"country": "中国台湾",
|
||||
"language": "繁体中文",
|
||||
"ratio": "1:1",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
DEFAULT_AI_MODELS_CONFIG = {
|
||||
@@ -426,9 +434,22 @@ def _normalize_config_values(config, migrate_old_cmhub_connect_timeout=False):
|
||||
9999,
|
||||
DEFAULT_CONFIG["shopee_update"]["max_items_per_run"],
|
||||
)
|
||||
suite = config.get("product_suite")
|
||||
if not isinstance(suite, dict):
|
||||
suite = {}
|
||||
config["product_suite"] = suite
|
||||
suite["last_settings"] = _normalize_product_suite_last_settings(
|
||||
suite.get("last_settings")
|
||||
)
|
||||
return config
|
||||
|
||||
|
||||
def _normalize_product_suite_last_settings(value):
|
||||
from . import product_suite
|
||||
|
||||
return product_suite.last_suite_settings(value)
|
||||
|
||||
|
||||
def _clamp_int(value, minimum, maximum, default):
|
||||
try:
|
||||
number = int(value)
|
||||
@@ -673,6 +694,14 @@ def ai_config(config=None) -> dict:
|
||||
return copy.deepcopy(_config_or_load(config).get("ai", DEFAULT_CONFIG["ai"]))
|
||||
|
||||
|
||||
def product_suite_last_settings(config=None) -> dict:
|
||||
cfg = _config_or_load(config)
|
||||
suite = cfg.get("product_suite", {})
|
||||
if not isinstance(suite, dict):
|
||||
suite = {}
|
||||
return _normalize_product_suite_last_settings(suite.get("last_settings"))
|
||||
|
||||
|
||||
def normalize_generate_mode(value=None, generate_cover=None) -> str:
|
||||
text = str(value or "").strip().lower()
|
||||
if text in AI_GENERATE_MODES:
|
||||
|
||||
Reference in New Issue
Block a user