jarvis-ai-assistant 0.1.128__py3-none-any.whl → 0.1.129__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.

Potentially problematic release.


This version of jarvis-ai-assistant might be problematic. Click here for more details.

@@ -0,0 +1,143 @@
1
+ from typing import Dict, Any
2
+ import os
3
+
4
+ from yaspin import yaspin
5
+
6
+ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
7
+
8
+ class ReadCodeTool:
9
+ name = "read_code"
10
+ description = "用于读取代码文件并在每行前添加行号的工具"
11
+ parameters = {
12
+ "type": "object",
13
+ "properties": {
14
+ "files": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "object",
18
+ "properties": {
19
+ "path": {"type": "string"},
20
+ "start_line": {"type": "number", "default": 1},
21
+ "end_line": {"type": "number", "default": -1}
22
+ },
23
+ "required": ["path"]
24
+ },
25
+ "description": "要读取的文件列表"
26
+ }
27
+ },
28
+ "required": ["files"]
29
+ }
30
+
31
+ def _handle_single_file(self, filepath: str, start_line: int = 1, end_line: int = -1) -> Dict[str, Any]:
32
+ try:
33
+ abs_path = os.path.abspath(filepath)
34
+ with yaspin(text=f"正在读取文件: {abs_path}...", color="cyan") as spinner:
35
+ # 文件存在性检查
36
+ if not os.path.exists(abs_path):
37
+ return {
38
+ "success": False,
39
+ "stdout": "",
40
+ "stderr": f"文件不存在: {abs_path}"
41
+ }
42
+
43
+ # 文件大小限制检查(10MB)
44
+ if os.path.getsize(abs_path) > 10 * 1024 * 1024:
45
+ return {
46
+ "success": False,
47
+ "stdout": "",
48
+ "stderr": "文件过大 (>10MB)"
49
+ }
50
+
51
+ # 读取文件内容
52
+ with open(abs_path, 'r', encoding='utf-8') as f:
53
+ lines = f.readlines()
54
+
55
+ total_lines = len(lines)
56
+
57
+ # 处理特殊值-1表示文件末尾
58
+ if end_line == -1:
59
+ end_line = total_lines
60
+ else:
61
+ end_line = max(1, min(end_line, total_lines)) if end_line >= 0 else total_lines + end_line + 1
62
+
63
+ start_line = max(1, min(start_line, total_lines)) if start_line >= 0 else total_lines + start_line + 1
64
+
65
+ if start_line > end_line:
66
+ spinner.fail("❌")
67
+ return {
68
+ "success": False,
69
+ "stdout": "",
70
+ "stderr": f"无效的行范围 [{start_line}-{end_line}] (总行数: {total_lines})"
71
+ }
72
+
73
+ # 添加行号并构建输出内容
74
+ selected_lines = lines[start_line-1:end_line]
75
+ numbered_content = "".join(
76
+ [f"{i:4d} | {line}"
77
+ for i, line in enumerate(selected_lines, start=start_line)]
78
+ )
79
+
80
+ # 构建输出格式
81
+ output = (
82
+ f"\n🔍 文件: {abs_path}\n"
83
+ f"📄 原始行号: {start_line}-{end_line} (共{end_line - start_line + 1}行) | 显示行号: 1-{len(selected_lines)}\n\n"
84
+ f"{numbered_content}\n"
85
+ f"{'='*80}\n"
86
+ )
87
+
88
+ spinner.ok("✅")
89
+ return {
90
+ "success": True,
91
+ "stdout": output,
92
+ "stderr": ""
93
+ }
94
+
95
+ except Exception as e:
96
+ PrettyOutput.print(str(e), OutputType.ERROR)
97
+ return {
98
+ "success": False,
99
+ "stdout": "",
100
+ "stderr": f"文件读取失败: {str(e)}"
101
+ }
102
+
103
+ def execute(self, args: Dict) -> Dict[str, Any]:
104
+ try:
105
+ if "files" not in args or not isinstance(args["files"], list):
106
+ return {
107
+ "success": False,
108
+ "stdout": "",
109
+ "stderr": "参数中必须包含文件列表"
110
+ }
111
+
112
+ all_outputs = []
113
+ overall_success = True
114
+
115
+ for file_info in args["files"]:
116
+ if not isinstance(file_info, dict) or "path" not in file_info:
117
+ continue
118
+
119
+ result = self._handle_single_file(
120
+ file_info["path"].strip(),
121
+ file_info.get("start_line", 1),
122
+ file_info.get("end_line", -1)
123
+ )
124
+
125
+ if result["success"]:
126
+ all_outputs.append(result["stdout"])
127
+ else:
128
+ all_outputs.append(f"❌ {file_info['path']}: {result['stderr']}")
129
+ overall_success = False
130
+
131
+ return {
132
+ "success": overall_success,
133
+ "stdout": "\n".join(all_outputs),
134
+ "stderr": ""
135
+ }
136
+
137
+ except Exception as e:
138
+ PrettyOutput.print(str(e), OutputType.ERROR)
139
+ return {
140
+ "success": False,
141
+ "stdout": "",
142
+ "stderr": f"代码读取失败: {str(e)}"
143
+ }
@@ -354,45 +354,41 @@ arguments:
354
354
  if result["success"]:
355
355
  # If the output exceeds 4k characters, use a large model to summarize
356
356
  if get_context_token_count(output) > self.max_token_count:
357
- with yaspin(text="正在总结输出...", color="yellow") as spinner:
358
- try:
359
-
360
- model = PlatformRegistry.get_global_platform_registry().get_normal_platform()
361
-
362
- # If the output exceeds the maximum context length, only take the last part
363
- max_count = self.max_token_count
364
- if get_context_token_count(output) > max_count:
365
- output_to_summarize = output[-max_count:]
366
- truncation_notice = f"\n(注意:由于输出过长,仅总结最后 {max_count} 个字符)"
367
- else:
368
- output_to_summarize = output
369
- truncation_notice = ""
370
-
371
- prompt = f"""请总结以下工具的执行结果,提取关键信息和重要结果。注意:
372
- 1. 保留所有重要的数值、路径、错误信息等
373
- 2. 保持结果的准确性
374
- 3. 用简洁的语言描述主要内容
375
- 4. 如果有错误信息,确保包含在总结中
376
-
377
- 工具名称: {name}
378
- 执行结果:
379
- {output_to_summarize}
380
-
381
- 请提供总结:"""
382
-
383
- summary = model.chat_until_success(prompt)
384
- output = f"""--- 原始输出过长,以下是总结 ---{truncation_notice}
385
-
386
- {summary}
387
-
388
- --- 总结结束 ---"""
389
- spinner.text = "总结完成"
390
- spinner.ok("")
391
- except Exception as e:
392
- spinner.text = "总结失败"
393
- spinner.fail("❌")
394
- PrettyOutput.print(f"总结失败: {str(e)}", OutputType.ERROR)
395
- output = f"输出过长 ({len(output)} 字符),建议查看原始输出。\n前300字符预览:\n{output[:300]}..."
357
+ PrettyOutput.section("输出过长,正在总结...", OutputType.SYSTEM)
358
+ try:
359
+
360
+ model = PlatformRegistry.get_global_platform_registry().get_normal_platform()
361
+ model.set_suppress_output(False)
362
+ # If the output exceeds the maximum context length, only take the last part
363
+ max_count = self.max_token_count
364
+ if get_context_token_count(output) > max_count:
365
+ output_to_summarize = output[-max_count:]
366
+ truncation_notice = f"\n(注意:由于输出过长,仅总结最后 {max_count} 个字符)"
367
+ else:
368
+ output_to_summarize = output
369
+ truncation_notice = ""
370
+
371
+ prompt = f"""请总结以下工具的执行结果,提取关键信息和重要结果。注意:
372
+ 1. 保留所有重要的数值、路径、错误信息等
373
+ 2. 保持结果的准确性
374
+ 3. 用简洁的语言描述主要内容
375
+ 4. 如果有错误信息,确保包含在总结中
376
+
377
+ 工具名称: {name}
378
+ 执行结果:
379
+ {output_to_summarize}
380
+
381
+ 请提供总结:"""
382
+
383
+ summary = model.chat_until_success(prompt)
384
+ output = f"""--- 原始输出过长,以下是总结 ---{truncation_notice}
385
+
386
+ {summary}
387
+
388
+ --- 总结结束 ---"""
389
+ except Exception as e:
390
+ PrettyOutput.print(f"总结失败: {str(e)}", OutputType.ERROR)
391
+ output = f"输出过长 ({len(output)} 字符),建议查看原始输出。\n前300字符预览:\n{output[:300]}..."
396
392
  return output
397
393
 
398
394
  except Exception as e:
@@ -9,6 +9,8 @@ from yaspin import yaspin
9
9
  from jarvis.jarvis_platform.registry import PlatformRegistry
10
10
 
11
11
  class ToolGenerator:
12
+ """工具生成器类,用于自动创建与Jarvis系统集成的新工具"""
13
+
12
14
  name = "tool_generator"
13
15
  description = "使用LLM自动生成与系统集成的新工具"
14
16
  parameters = {
@@ -31,8 +33,14 @@ class ToolGenerator:
31
33
  }
32
34
 
33
35
  def execute(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
34
- """Generate and save a new tool using LLM"""
35
- # Get fresh model instance for each execution
36
+ """
37
+ 执行工具生成过程
38
+ Args:
39
+ arguments: 包含工具生成所需参数的字典
40
+ Returns:
41
+ 包含执行结果的字典,包含success、stdout和stderr字段
42
+ """
43
+ # 获取代码生成平台实例
36
44
  model = PlatformRegistry.get_global_platform_registry().get_codegen_platform()
37
45
 
38
46
  try:
@@ -40,37 +48,37 @@ class ToolGenerator:
40
48
  description = arguments["description"]
41
49
  input_spec = arguments["input_spec"]
42
50
 
43
- # Generate tool implementation using LLM
51
+ # 使用LLM生成工具实现代码
44
52
  with yaspin(text="正在生成工具...", color="cyan") as spinner:
45
53
  prompt = self._create_prompt(tool_name, description, input_spec)
46
54
  llm_response = model.chat_until_success(prompt)
47
55
  spinner.text = "工具生成完成"
48
56
  spinner.ok("✅")
49
57
 
50
- # Extract implementation with more flexible parsing
58
+ # 从LLM响应中提取实现代码
51
59
  with yaspin(text="正在提取工具实现...", color="cyan") as spinner:
52
60
  implementation = self._extract_code(llm_response)
53
61
  if not implementation:
54
62
  return {
55
63
  "success": False,
56
64
  "stdout": "",
57
- "stderr": "Could not extract valid Python code from LLM response"
65
+ "stderr": "无法从LLM响应中提取有效的Python代码"
58
66
  }
59
67
  spinner.text = "工具实现提取完成"
60
68
  spinner.ok("✅")
61
69
 
62
- # Validate return value format
70
+ # 验证生成的工具代码是否符合返回值格式要求
63
71
  with yaspin(text="正在验证工具返回值格式...", color="cyan") as spinner:
64
72
  if not self._validate_return_value_format(implementation):
65
73
  return {
66
74
  "success": False,
67
75
  "stdout": "",
68
- "stderr": "Generated tool does not follow required return value format"
76
+ "stderr": "生成的工具不符合要求的返回值格式"
69
77
  }
70
78
  spinner.text = "工具返回值格式验证完成"
71
79
  spinner.ok("✅")
72
80
 
73
- # Save the new tool
81
+ # 保存生成的新工具
74
82
  with yaspin(text="正在保存工具...", color="cyan") as spinner:
75
83
  tools_dir = Path.home() / ".jarvis" / "tools"
76
84
  tools_dir.mkdir(parents=True, exist_ok=True)
@@ -83,7 +91,7 @@ class ToolGenerator:
83
91
 
84
92
  return {
85
93
  "success": True,
86
- "stdout": f"Tool successfully generated at: {tool_file}",
94
+ "stdout": f"工具成功生成于: {tool_file}",
87
95
  "stderr": ""
88
96
  }
89
97
 
@@ -91,11 +99,19 @@ class ToolGenerator:
91
99
  return {
92
100
  "success": False,
93
101
  "stdout": "",
94
- "stderr": f"Tool generation failed: {str(e)}"
102
+ "stderr": f"工具生成失败: {str(e)}"
95
103
  }
96
104
 
97
105
  def _create_prompt(self, tool_name: str, description: str, input_spec: str) -> str:
98
- """创建用于工具生成的LLM提示"""
106
+ """
107
+ 创建用于工具生成的LLM提示
108
+ Args:
109
+ tool_name: 工具名称
110
+ description: 工具描述
111
+ input_spec: 输入规范
112
+ Returns:
113
+ 格式化后的提示字符串
114
+ """
99
115
  example_code = '''
100
116
  <TOOL>
101
117
  from typing import Dict, Any
@@ -176,20 +192,32 @@ class CustomTool:
176
192
  '''
177
193
 
178
194
  def _extract_code(self, response: str) -> str:
179
- """Flexibly extract Python code from LLM response"""
180
- # Find the first occurrence of <TOOL> and </TOOL>
195
+ """
196
+ 从LLM响应中提取Python代码
197
+ Args:
198
+ response: LLM的响应字符串
199
+ Returns:
200
+ 提取到的Python代码字符串
201
+ """
202
+ # 查找第一个<TOOL>和</TOOL>标签之间的内容
181
203
  sm = re.search(r'<TOOL>(.*?)</TOOL>', response, re.DOTALL)
182
204
  if sm:
183
205
  return sm.group(1)
184
206
  return ""
185
207
 
186
208
  def _validate_return_value_format(self, code: str) -> bool:
187
- """Validate that execute method returns correct format"""
209
+ """
210
+ 验证execute方法的返回值格式是否正确
211
+ Args:
212
+ code: 要验证的代码字符串
213
+ Returns:
214
+ 布尔值,表示格式是否正确
215
+ """
188
216
  required_fields = ["success", "stdout", "stderr"]
189
- # Look for execute method
217
+ # 检查execute方法是否存在
190
218
  if "def execute(self, args: Dict) -> Dict:" not in code and \
191
219
  "def execute(self, args: Dict) -> Dict[str, Any]:" not in code:
192
220
  return False
193
221
 
194
- # Check for required fields in return statement
195
- return all(field in code for field in required_fields)
222
+ # 检查返回值中是否包含所有必需字段
223
+ return all(field in code for field in required_fields)
@@ -1,24 +1,24 @@
1
1
  """
2
- Jarvis Utils Module
3
- This module provides utility functions and classes used throughout the Jarvis system.
4
- It includes various helper functions, configuration management, and common operations.
5
- The module is organized into several submodules:
6
- - config: Configuration management
7
- - embedding: Text embedding utilities
8
- - git_utils: Git repository operations
9
- - input: User input handling
10
- - methodology: Methodology management
11
- - output: Output formatting
12
- - utils: General utilities
2
+ Jarvis工具模块
3
+ 该模块提供了Jarvis系统中使用的各种实用函数和类。
4
+ 包含多种辅助函数、配置管理和常见操作。
5
+ 该模块组织为以下几个子模块:
6
+ - config: 配置管理
7
+ - embedding: 文本嵌入工具
8
+ - git_utils: Git仓库操作
9
+ - input: 用户输入处理
10
+ - methodology: 方法论管理
11
+ - output: 输出格式化
12
+ - utils: 通用工具
13
13
  """
14
14
  import os
15
15
  import colorama
16
16
  from rich.traceback import install as install_rich_traceback
17
- # Re-export from new modules
18
- # These imports are required for project functionality and may be used dynamically
19
- # Initialize colorama for cross-platform colored text
17
+ # 从新模块重新导出
18
+ # 这些导入是项目功能所必需的,可能会被动态使用
19
+ # 初始化colorama以支持跨平台的彩色文本
20
20
  colorama.init()
21
- # Disable tokenizers parallelism to avoid issues with multiprocessing
21
+ # 禁用tokenizers并行以避免多进程问题
22
22
  os.environ["TOKENIZERS_PARALLELISM"] = "false"
23
- # Install rich traceback handler for better error messages
24
- install_rich_traceback()
23
+ # 安装rich traceback处理器以获得更好的错误信息
24
+ install_rich_traceback()
@@ -1,138 +1,174 @@
1
1
  import os
2
2
  """
3
- Configuration Management Module
4
- This module provides functions to retrieve various configuration settings for the Jarvis system.
5
- All configurations are read from environment variables with fallback default values.
6
- The module is organized into several categories:
7
- - System Configuration
8
- - Model Configuration
9
- - Execution Configuration
10
- - Text Processing Configuration
3
+ 配置管理模块
4
+ 该模块提供了获取Jarvis系统各种配置设置的函数。
5
+ 所有配置都从环境变量中读取,带有回退默认值。
6
+ 该模块组织为以下几个类别:
7
+ - 系统配置
8
+ - 模型配置
9
+ - 执行配置
10
+ - 文本处理配置
11
11
  """
12
12
  def get_max_token_count() -> int:
13
13
  """
14
- Get the maximum token count for API requests.
14
+ 获取API请求的最大token数量。
15
15
 
16
- Returns:
17
- int: Maximum token count, default is 131072 (128k)
16
+ 返回:
17
+ int: 最大token数量,默认为131072128k
18
18
  """
19
19
  return int(os.getenv('JARVIS_MAX_TOKEN_COUNT', '131072')) # 默认128k
20
20
 
21
21
  def get_thread_count() -> int:
22
22
  """
23
- Get the number of threads to use for parallel processing.
23
+ 获取用于并行处理的线程数。
24
24
 
25
- Returns:
26
- int: Thread count, default is 1
25
+ 返回:
26
+ int: 线程数,默认为1
27
27
  """
28
28
  return int(os.getenv('JARVIS_THREAD_COUNT', '1'))
29
29
  def dont_use_local_model() -> bool:
30
30
  """
31
- Check if local models should be avoided.
31
+ 检查是否应避免使用本地模型。
32
32
 
33
- Returns:
34
- bool: True if local models should not be used, default is False
33
+ 返回:
34
+ bool: 如果不使用本地模型则返回True,默认为False
35
35
  """
36
36
  return os.getenv('JARVIS_DONT_USE_LOCAL_MODEL', 'false') == 'true'
37
37
 
38
38
  def is_auto_complete() -> bool:
39
39
  """
40
- Check if auto-completion is enabled.
40
+ 检查是否启用了自动补全功能。
41
41
 
42
- Returns:
43
- bool: True if auto-completion is enabled, default is False
42
+ 返回:
43
+ bool: 如果启用了自动补全则返回True,默认为False
44
44
  """
45
45
  return os.getenv('JARVIS_AUTO_COMPLETE', 'false') == 'true'
46
46
 
47
47
  def is_use_methodology() -> bool:
48
48
  """
49
- Check if methodology should be used.
49
+ 检查是否应使用方法论。
50
50
 
51
- Returns:
52
- bool: True if methodology should be used, default is True
51
+ 返回:
52
+ bool: 如果使用方法论则返回True,默认为True
53
53
  """
54
54
  return os.getenv('JARVIS_USE_METHODOLOGY', 'true') == 'true'
55
55
  def is_record_methodology() -> bool:
56
56
  """
57
- Check if methodology should be recorded.
57
+ 检查是否应记录方法论。
58
58
 
59
- Returns:
60
- bool: True if methodology should be recorded, default is True
59
+ 返回:
60
+ bool: 如果记录方法论则返回True,默认为True
61
61
  """
62
62
  return os.getenv('JARVIS_RECORD_METHODOLOGY', 'true') == 'true'
63
63
  def is_need_summary() -> bool:
64
64
  """
65
- Check if summary generation is required.
65
+ 检查是否需要生成摘要。
66
66
 
67
- Returns:
68
- bool: True if summary is needed, default is True
67
+ 返回:
68
+ bool: 如果需要摘要则返回True,默认为True
69
69
  """
70
70
  return os.getenv('JARVIS_NEED_SUMMARY', 'true') == 'true'
71
71
  def get_min_paragraph_length() -> int:
72
72
  """
73
- Get the minimum paragraph length for text processing.
73
+ 获取文本处理的最小段落长度。
74
74
 
75
- Returns:
76
- int: Minimum length in characters, default is 50
75
+ 返回:
76
+ int: 最小字符长度,默认为50
77
77
  """
78
78
  return int(os.getenv('JARVIS_MIN_PARAGRAPH_LENGTH', '50'))
79
79
  def get_max_paragraph_length() -> int:
80
80
  """
81
- Get the maximum paragraph length for text processing.
81
+ 获取文本处理的最大段落长度。
82
82
 
83
- Returns:
84
- int: Maximum length in characters, default is 12800
83
+ 返回:
84
+ int: 最大字符长度,默认为12800
85
85
  """
86
86
  return int(os.getenv('JARVIS_MAX_PARAGRAPH_LENGTH', '12800'))
87
87
  def get_shell_name() -> str:
88
88
  """
89
- Get the system shell name.
89
+ 获取系统shell名称。
90
90
 
91
- Returns:
92
- str: Shell name (e.g., bash, zsh), default is bash
91
+ 返回:
92
+ str: Shell名称(例如bash, zsh),默认为bash
93
93
  """
94
94
  return os.getenv('SHELL', 'bash')
95
95
  def get_normal_platform_name() -> str:
96
96
  """
97
- Get the platform name for normal operations.
97
+ 获取正常操作的平台名称。
98
98
 
99
- Returns:
100
- str: Platform name, default is 'kimi'
99
+ 返回:
100
+ str: 平台名称,默认为'kimi'
101
101
  """
102
102
  return os.getenv('JARVIS_PLATFORM', 'kimi')
103
103
  def get_normal_model_name() -> str:
104
104
  """
105
- Get the model name for normal operations.
105
+ 获取正常操作的模型名称。
106
106
 
107
- Returns:
108
- str: Model name, default is 'kimi'
107
+ 返回:
108
+ str: 模型名称,默认为'kimi'
109
109
  """
110
110
  return os.getenv('JARVIS_MODEL', 'kimi')
111
111
  def get_codegen_platform_name() -> str:
112
+ """
113
+ 获取代码生成的平台名称。
114
+
115
+ 返回:
116
+ str: 平台名称,默认为'kimi'
117
+ """
112
118
  return os.getenv('JARVIS_CODEGEN_PLATFORM', os.getenv('JARVIS_PLATFORM', 'kimi'))
113
119
  def get_codegen_model_name() -> str:
120
+ """
121
+ 获取代码生成的模型名称。
122
+
123
+ 返回:
124
+ str: 模型名称,默认为'kimi'
125
+ """
114
126
  return os.getenv('JARVIS_CODEGEN_MODEL', os.getenv('JARVIS_MODEL', 'kimi'))
115
127
  def get_thinking_platform_name() -> str:
128
+ """
129
+ 获取思考操作的平台名称。
130
+
131
+ 返回:
132
+ str: 平台名称,默认为'kimi'
133
+ """
116
134
  return os.getenv('JARVIS_THINKING_PLATFORM', os.getenv('JARVIS_PLATFORM', 'kimi'))
117
135
  def get_thinking_model_name() -> str:
136
+ """
137
+ 获取思考操作的模型名称。
138
+
139
+ 返回:
140
+ str: 模型名称,默认为'kimi'
141
+ """
118
142
  return os.getenv('JARVIS_THINKING_MODEL', os.getenv('JARVIS_MODEL', 'kimi'))
119
143
  def get_cheap_platform_name() -> str:
144
+ """
145
+ 获取低成本操作的平台名称。
146
+
147
+ 返回:
148
+ str: 平台名称,默认为'kimi'
149
+ """
120
150
  return os.getenv('JARVIS_CHEAP_PLATFORM', os.getenv('JARVIS_PLATFORM', 'kimi'))
121
151
  def get_cheap_model_name() -> str:
152
+ """
153
+ 获取低成本操作的模型名称。
154
+
155
+ 返回:
156
+ str: 模型名称,默认为'kimi'
157
+ """
122
158
  return os.getenv('JARVIS_CHEAP_MODEL', os.getenv('JARVIS_MODEL', 'kimi'))
123
159
  def is_execute_tool_confirm() -> bool:
124
160
  """
125
- Check if tool execution requires confirmation.
161
+ 检查工具执行是否需要确认。
126
162
 
127
- Returns:
128
- bool: True if confirmation is required, default is False
163
+ 返回:
164
+ bool: 如果需要确认则返回True,默认为False
129
165
  """
130
166
  return os.getenv('JARVIS_EXECUTE_TOOL_CONFIRM', 'false') == 'true'
131
167
  def is_confirm_before_apply_patch() -> bool:
132
168
  """
133
- Check if patch application requires confirmation.
169
+ 检查应用补丁前是否需要确认。
134
170
 
135
- Returns:
136
- bool: True if confirmation is required, default is False
171
+ 返回:
172
+ bool: 如果需要确认则返回True,默认为False
137
173
  """
138
- return os.getenv('JARVIS_CONFIRM_BEFORE_APPLY_PATCH', 'false') == 'true'
174
+ return os.getenv('JARVIS_CONFIRM_BEFORE_APPLY_PATCH', 'false') == 'true'