--- before/wechat_rpa/admin_backend.py +++ wechat_rpa/admin_backend.py @@ -1921,6 +1921,9 @@ endpoint_mode = str(item.get("endpoint_mode") or "auto").strip().lower() if endpoint_mode not in model_protocol.ENDPOINT_MODES: raise ValueError(f"不支持的地址模式:{endpoint_mode}") + config_error = model_protocol.chat_config_error(kind, base_url, item.get("model") or "") + if config_error and item.get("enabled", True): + raise ValueError(config_error) with self.connect() as db: db.execute("BEGIN IMMEDIATE") @@ -2720,6 +2723,12 @@ headers["Authorization"] = f"Bearer {api_key}" started = time.perf_counter() try: + config_error = model_protocol.chat_config_error( + provider_type_value, str(config.get("api_base") or endpoint), + str(config.get("model") or ""), + ) + if config_error: + raise ValueError(config_error) status, raw = _perform_http_request( endpoint, method=method, @@ -2740,6 +2749,9 @@ 429: "请求受限、余额不足或调用频率过高", } message = labels.get(status, f"模型服务返回 HTTP {status}") + # Ark may use HTTP 404 for a model which exists but is not activated. + if "has not activated the model" in detail.lower(): + message = "账号尚未开通该模型服务,请在火山方舟控制台开通,并确认 API Key 所属账号和项目" if detail: message += f":{detail}" return {