feat(product-suite): persist context and confirm actions
This commit is contained in:
@@ -113,6 +113,7 @@ DEFAULT_CONFIG = {
|
||||
"max_parallel_accounts": 1,
|
||||
},
|
||||
"product_suite": {
|
||||
"last_account_alias": "",
|
||||
"last_settings": {
|
||||
"platform": "Shopee",
|
||||
"country": "中国台湾",
|
||||
@@ -442,6 +443,9 @@ def _normalize_config_values(config, migrate_old_cmhub_connect_timeout=False):
|
||||
if not isinstance(suite, dict):
|
||||
suite = {}
|
||||
config["product_suite"] = suite
|
||||
suite["last_account_alias"] = _normalize_product_suite_last_account_alias(
|
||||
suite.get("last_account_alias")
|
||||
)
|
||||
suite["last_settings"] = _normalize_product_suite_last_settings(
|
||||
suite.get("last_settings")
|
||||
)
|
||||
@@ -454,6 +458,10 @@ def _normalize_product_suite_last_settings(value):
|
||||
return product_suite.last_suite_settings(value)
|
||||
|
||||
|
||||
def _normalize_product_suite_last_account_alias(value):
|
||||
return str(value or "").strip() if isinstance(value, str) else ""
|
||||
|
||||
|
||||
def _clamp_int(value, minimum, maximum, default):
|
||||
try:
|
||||
number = int(value)
|
||||
@@ -706,6 +714,16 @@ def product_suite_last_settings(config=None) -> dict:
|
||||
return _normalize_product_suite_last_settings(suite.get("last_settings"))
|
||||
|
||||
|
||||
def product_suite_last_account_alias(config=None) -> str:
|
||||
cfg = _config_or_load(config)
|
||||
suite = cfg.get("product_suite", {})
|
||||
if not isinstance(suite, dict):
|
||||
suite = {}
|
||||
return _normalize_product_suite_last_account_alias(
|
||||
suite.get("last_account_alias")
|
||||
)
|
||||
|
||||
|
||||
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