Jarvis-Brain 0.1.7.11__tar.gz → 0.1.7.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Jarvis_Brain
3
- Version: 0.1.7.11
3
+ Version: 0.1.7.15
4
4
  Summary: Jarvis brain mcp
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: beautifulsoup4
@@ -104,16 +104,21 @@ def register_check_selector(mcp: FastMCP, browser_manager, client_manager: DPPro
104
104
  exist_flag = False
105
105
  if len(target_eles) != 0:
106
106
  exist_flag = True
107
+ if len(target_eles) > page_size:
108
+ target_eles = target_eles[offset:offset + page_size]
109
+ slice_seg = max(300, one_turn_max_token // (page_size + 6))
107
110
  if attr_name == "text":
108
- ele_text_list = [i.text.replace("\n", "") for i in target_eles]
109
- attr_output = "\n".join(ele_text_list)
111
+ ele_attr_list = [i.text.replace("\n", "") for i in target_eles]
112
+ ele_attr_list = [attr_str[:slice_seg] for attr_str in ele_attr_list]
113
+ # 如果经过截断遍历后的字符串长度与截断长度相等,则默认截断了
114
+ ele_attr_list = [attr_str + "..." if len(attr_str) == slice_seg else attr_str for attr_str in ele_attr_list]
115
+ attr_output = "\n".join(ele_attr_list)
110
116
  else:
111
- attr_output = json.dumps([i.attr(attr_name) for i in target_eles])
112
- if len(attr_output) > page_size:
113
- attr_output = attr_output[offset:offset + page_size]
117
+ ele_attr_list = [i.attr(attr_name) for i in target_eles]
118
+ ele_attr_list = [attr_str[:slice_seg] for attr_str in ele_attr_list]
119
+ ele_attr_list = [attr_str + "..." if len(attr_str) == slice_seg else attr_str for attr_str in ele_attr_list]
120
+ attr_output = json.dumps(ele_attr_list)
114
121
  # 对attr_output逐个截断,截断的长度为:一轮最大token除以元素个数+3个点+两个引号和逗号
115
- slice_=max(300, one_turn_max_token // (page_size + 6))
116
- attr_output = [attr_str[:slice_] + "..."for attr_str in attr_output]
117
122
  return dp_mcp_message_pack(
118
123
  f"已完成tab页:【{tab_id}】对:【{css_selector}】的检查",
119
124
  tab_id=tab_id,
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "Jarvis_Brain" # 别人下载时用的名字,必须在 PyPI 上唯一
3
- version = "0.1.7.11"
3
+ version = "0.1.7.15"
4
4
  description = "Jarvis brain mcp"
5
5
  dependencies = [
6
6
  "fastmcp",
File without changes