chore: auto release commit (2026-06-15 17:32:47)
All checks were successful
技能自动化发布 / release (push) Successful in 7s
All checks were successful
技能自动化发布 / release (push) Successful in 7s
This commit is contained in:
31
examples/real_browser_rpa/scripts/util/constants.py
Normal file
31
examples/real_browser_rpa/scripts/util/constants.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""示例常量(复制到新 skill 时请替换为目标站点与业务字段)。"""
|
||||
|
||||
SKILL_SLUG = "example-real-browser-rpa"
|
||||
LOG_LOGGER_NAME = "openclaw.skill.example_real_browser_rpa"
|
||||
|
||||
TARGET_PLATFORM = "target_platform"
|
||||
LEASE_HOLDER = "example-real-browser-rpa"
|
||||
LEASE_TTL_SEC = "1800"
|
||||
|
||||
DEFAULT_START_URL = "https://example.com"
|
||||
DEFAULT_MAX_ITEMS = 100
|
||||
DEFAULT_MAX_SCROLLS = 40
|
||||
DEFAULT_NO_NEW_ROUNDS_LIMIT = 5
|
||||
HUMAN_WAIT_TIMEOUT = 180
|
||||
|
||||
RESULT_END_TEXT = "没有更多结果了"
|
||||
|
||||
# 示例 selector — 复制到新 skill 时按目标站点 DOM 替换
|
||||
SEARCH_INPUT_SELECTORS = (
|
||||
'input[type="search"]',
|
||||
'input[name="q"]',
|
||||
'input[placeholder*="搜索"]',
|
||||
)
|
||||
SEARCH_BUTTON_SELECTOR = 'button:has-text("搜索")'
|
||||
RESULT_CONTAINER_SELECTOR = "#search-result-container"
|
||||
RESULT_ITEM_SELECTOR = "[data-result-item]"
|
||||
SCROLL_CONTAINER_SELECTORS = (
|
||||
"#search-result-container",
|
||||
".search-result-scroll",
|
||||
".route-scroll-container",
|
||||
)
|
||||
34
examples/real_browser_rpa/scripts/util/logging.py
Normal file
34
examples/real_browser_rpa/scripts/util/logging.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""示例结构化日志工具。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
from util.constants import LOG_LOGGER_NAME
|
||||
|
||||
|
||||
def get_logger(name: str | None = None) -> logging.Logger:
|
||||
return logging.getLogger(name or LOG_LOGGER_NAME)
|
||||
|
||||
|
||||
def mask_text(value: str, *, keep_start: int = 2, keep_end: int = 2) -> str:
|
||||
s = (value or "").strip()
|
||||
if len(s) >= 11 and s.isdigit():
|
||||
return s[:3] + "****" + s[-4:]
|
||||
if len(s) > keep_start + keep_end:
|
||||
return s[:keep_start] + "****" + s[-keep_end:]
|
||||
return "****"
|
||||
|
||||
|
||||
def safe_log_value(value: Any) -> str:
|
||||
if value is None:
|
||||
return ""
|
||||
text = str(value)
|
||||
if re.fullmatch(r"\d{7,}", text):
|
||||
return mask_text(text)
|
||||
if "@" in text and len(text) > 6:
|
||||
local, _, domain = text.partition("@")
|
||||
return f"{mask_text(local, keep_start=1, keep_end=1)}@{domain}"
|
||||
return text
|
||||
Reference in New Issue
Block a user