mobile-mcp-ai 2.6.10__py3-none-any.whl → 2.6.12__py3-none-any.whl

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.
mobile_mcp/config.py CHANGED
@@ -102,6 +102,31 @@ class Config:
102
102
  "false"
103
103
  ).lower() == "true"
104
104
 
105
+ # ==================== Token 优化(省钱模式)====================
106
+ # 启用 Token 优化(默认开启,只精简格式,不影响准确度)
107
+ TOKEN_OPTIMIZATION_ENABLED: bool = os.getenv(
108
+ "TOKEN_OPTIMIZATION_ENABLED",
109
+ "true"
110
+ ).lower() == "true"
111
+
112
+ # list_elements 最大返回元素数量(默认 0 = 不限制,确保准确度)
113
+ MAX_ELEMENTS_RETURN: int = int(os.getenv("MAX_ELEMENTS_RETURN", "0"))
114
+
115
+ # take_screenshot_with_som 最大返回元素数量(默认 0 = 不限制)
116
+ MAX_SOM_ELEMENTS_RETURN: int = int(os.getenv("MAX_SOM_ELEMENTS_RETURN", "0"))
117
+
118
+ # 精简返回信息(只移除冗余提示文字,不影响数据)
119
+ COMPACT_RESPONSE: bool = os.getenv(
120
+ "COMPACT_RESPONSE",
121
+ "true"
122
+ ).lower() == "true"
123
+
124
+ # 精简工具描述(减少每次请求的 token)
125
+ COMPACT_TOOL_DESCRIPTION: bool = os.getenv(
126
+ "COMPACT_TOOL_DESCRIPTION",
127
+ "true"
128
+ ).lower() == "true"
129
+
105
130
  @classmethod
106
131
  def get_ai_platform(cls) -> Optional[str]:
107
132
  """获取优先使用的AI平台"""
@@ -137,6 +162,13 @@ class Config:
137
162
  "device": {
138
163
  "default_device_id": cls.DEFAULT_DEVICE_ID,
139
164
  "lock_orientation": cls.LOCK_SCREEN_ORIENTATION,
165
+ },
166
+ "token_optimization": {
167
+ "enabled": cls.TOKEN_OPTIMIZATION_ENABLED,
168
+ "max_elements": cls.MAX_ELEMENTS_RETURN,
169
+ "max_som_elements": cls.MAX_SOM_ELEMENTS_RETURN,
170
+ "compact_response": cls.COMPACT_RESPONSE,
171
+ "compact_tool_desc": cls.COMPACT_TOOL_DESCRIPTION,
140
172
  }
141
173
  }
142
174