feat(subscription): add membership access preflight

This commit is contained in:
chengma
2026-07-21 17:38:05 +08:00
parent ca46c34dfe
commit 9ee48dc2aa
14 changed files with 788 additions and 4 deletions
+6
View File
@@ -1973,6 +1973,7 @@ class ProductSuiteTab(QWidget):
config=None,
config_path=None,
status_callback=None,
subscription_preflight_callback=None,
):
super().__init__(parent)
self.setObjectName("productSuiteTab")
@@ -1982,6 +1983,7 @@ class ProductSuiteTab(QWidget):
self.cmhub_config_path = self.config.get("cmhub_config_path") or appconfig.cmhub_config_file_path(self.config)
self.product_suite_prompt_path = appconfig.product_suite_prompt_path(self.config)
self.status_callback = status_callback
self.subscription_preflight_callback = subscription_preflight_callback
self.accounts = []
self._states = {}
self._retired_states = []
@@ -4392,6 +4394,8 @@ class ProductSuiteTab(QWidget):
def start_ai_write(self, checked=False):
if not self._require_default_gateway("商品套图AI帮写"):
return
if self.subscription_preflight_callback is not None and not self.subscription_preflight_callback("开始 AI 帮写"):
return
state = self._displayed_state
if state is None:
return
@@ -4729,6 +4733,8 @@ class ProductSuiteTab(QWidget):
retry_job_id=None,
confirm_direct_retry=False,
):
if self.subscription_preflight_callback is not None and not self.subscription_preflight_callback("生成商品套图"):
return False
if not self._ensure_generation_gateway():
return False
if state.generation_running():