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

Files changed (41) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/agent.py +138 -144
  3. jarvis/jarvis_codebase/main.py +87 -54
  4. jarvis/jarvis_coder/git_utils.py +4 -7
  5. jarvis/jarvis_coder/main.py +17 -22
  6. jarvis/jarvis_coder/patch_handler.py +141 -441
  7. jarvis/jarvis_coder/plan_generator.py +64 -36
  8. jarvis/jarvis_platform/main.py +1 -1
  9. jarvis/jarvis_rag/main.py +1 -1
  10. jarvis/jarvis_smart_shell/main.py +15 -15
  11. jarvis/main.py +24 -24
  12. jarvis/models/ai8.py +22 -22
  13. jarvis/models/base.py +17 -13
  14. jarvis/models/kimi.py +31 -31
  15. jarvis/models/ollama.py +28 -28
  16. jarvis/models/openai.py +22 -24
  17. jarvis/models/oyi.py +25 -25
  18. jarvis/models/registry.py +33 -34
  19. jarvis/tools/ask_user.py +5 -5
  20. jarvis/tools/base.py +2 -2
  21. jarvis/tools/chdir.py +9 -9
  22. jarvis/tools/codebase_qa.py +4 -4
  23. jarvis/tools/coder.py +4 -4
  24. jarvis/tools/file_ops.py +1 -1
  25. jarvis/tools/generator.py +23 -23
  26. jarvis/tools/methodology.py +4 -4
  27. jarvis/tools/rag.py +4 -4
  28. jarvis/tools/registry.py +38 -38
  29. jarvis/tools/search.py +42 -42
  30. jarvis/tools/shell.py +13 -13
  31. jarvis/tools/sub_agent.py +16 -16
  32. jarvis/tools/thinker.py +41 -41
  33. jarvis/tools/webpage.py +17 -17
  34. jarvis/utils.py +59 -60
  35. {jarvis_ai_assistant-0.1.96.dist-info → jarvis_ai_assistant-0.1.97.dist-info}/METADATA +1 -1
  36. jarvis_ai_assistant-0.1.97.dist-info/RECORD +47 -0
  37. jarvis_ai_assistant-0.1.96.dist-info/RECORD +0 -47
  38. {jarvis_ai_assistant-0.1.96.dist-info → jarvis_ai_assistant-0.1.97.dist-info}/LICENSE +0 -0
  39. {jarvis_ai_assistant-0.1.96.dist-info → jarvis_ai_assistant-0.1.97.dist-info}/WHEEL +0 -0
  40. {jarvis_ai_assistant-0.1.96.dist-info → jarvis_ai_assistant-0.1.97.dist-info}/entry_points.txt +0 -0
  41. {jarvis_ai_assistant-0.1.96.dist-info → jarvis_ai_assistant-0.1.97.dist-info}/top_level.txt +0 -0
jarvis/tools/thinker.py CHANGED
@@ -4,22 +4,22 @@ from jarvis.models.registry import PlatformRegistry
4
4
 
5
5
  class ThinkerTool:
6
6
  name = "thinker"
7
- description = "使用思维链推理方式分析复杂问题,适用于需要多步推理、逻辑分析或创造性思考的场景"
7
+ description = "Use chain of thought reasoning to analyze complex problems, suitable for scenarios that require multi-step reasoning, logical analysis, or creative thinking"
8
8
  parameters = {
9
9
  "type": "object",
10
10
  "properties": {
11
11
  "question": {
12
12
  "type": "string",
13
- "description": "需要分析的问题或任务"
13
+ "description": "The problem or task to analyze"
14
14
  },
15
15
  "context": {
16
16
  "type": "string",
17
- "description": "问题相关的上下文信息或背景知识",
17
+ "description": "Context information or background knowledge related to the problem",
18
18
  "default": ""
19
19
  },
20
20
  "goal": {
21
21
  "type": "string",
22
- "description": "期望达成的具体目标或结果",
22
+ "description": "The specific goal or result to achieve",
23
23
  "default": ""
24
24
  }
25
25
  },
@@ -27,63 +27,63 @@ class ThinkerTool:
27
27
  }
28
28
 
29
29
  def __init__(self):
30
- """初始化思考工具"""
30
+ """Initialize thinker tool"""
31
31
  self.model = PlatformRegistry.get_global_platform_registry().get_thinking_platform()
32
32
 
33
33
  def _generate_prompt(self, question: str, context: str, goal: str) -> str:
34
- """生成提示词
34
+ """Generate prompt
35
35
 
36
36
  Args:
37
- question: 问题
38
- context: 上下文
39
- goal: 期望目标
37
+ question: problem
38
+ context: context
39
+ goal: goal
40
40
 
41
41
  Returns:
42
- str: 完整的提示词
42
+ str: complete prompt
43
43
  """
44
44
  # 基础提示词
45
- prompt = f"""你是一个擅长深度思考和逻辑推理的助手。请帮助分析问题并给出解决方案。
45
+ prompt = f"""You are a helpful assistant that is good at deep thinking and logical reasoning. Please help analyze the problem and provide a solution.
46
46
 
47
- 请按以下方式思考:
48
- 1. 仔细理解问题和目标
49
- 2. 进行系统性分析和推理
50
- 3. 考虑多个可能的解决方案
51
- 4. 给出最佳建议和具体行动步骤
47
+ Please think as follows:
48
+ 1. Carefully understand the problem and goal
49
+ 2. Conduct a systematic analysis and reasoning
50
+ 3. Consider multiple possible solutions
51
+ 4. Provide the best suggestions and specific action steps
52
52
 
53
- 问题:
53
+ Problem:
54
54
  {question}
55
55
  """
56
56
  # 如果有目标,添加到提示词中
57
57
  if goal:
58
58
  prompt += f"""
59
- 期望目标:
59
+ Goal:
60
60
  {goal}
61
61
  """
62
62
 
63
63
  # 如果有上下文,添加到提示词中
64
64
  if context:
65
65
  prompt += f"""
66
- 相关上下文:
66
+ Related context:
67
67
  {context}
68
68
  """
69
69
 
70
- prompt += "\n请开始分析:"
70
+ prompt += "\nPlease start analyzing:"
71
71
  return prompt
72
72
 
73
73
  def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
74
- """执行思考分析
74
+ """Execute thinking analysis
75
75
 
76
76
  Args:
77
- args: 包含参数的字典
78
- - question: 问题
79
- - context: 上下文(可选)
80
- - goal: 期望目标(可选)
77
+ args: dictionary containing parameters
78
+ - question: problem
79
+ - context: context (optional)
80
+ - goal: goal (optional)
81
81
 
82
82
  Returns:
83
- Dict[str, Any]: 执行结果
83
+ Dict[str, Any]: execution result
84
84
  """
85
85
  try:
86
- # 获取参数
86
+ # Get parameters
87
87
  question = args["question"]
88
88
  context = args.get("context", "")
89
89
  goal = args.get("goal", "")
@@ -91,20 +91,20 @@ class ThinkerTool:
91
91
  # 生成提示词
92
92
  prompt = self._generate_prompt(question, context, goal)
93
93
 
94
- # 记录开始分析
95
- PrettyOutput.print(f"开始分析问题: {question}", OutputType.INFO)
94
+ # Record start analysis
95
+ PrettyOutput.print(f"Start analyzing problem: {question}", OutputType.INFO)
96
96
  if context:
97
- PrettyOutput.print("包含上下文信息", OutputType.INFO)
97
+ PrettyOutput.print("Contains context information", OutputType.INFO)
98
98
  if goal:
99
- PrettyOutput.print(f"目标: {goal}", OutputType.INFO)
99
+ PrettyOutput.print(f"Goal: {goal}", OutputType.INFO)
100
100
 
101
101
  # 调用模型进行分析
102
- response = self.model.chat(prompt)
102
+ response = self.model.chat_until_success(prompt)
103
103
 
104
104
  if not response:
105
105
  return {
106
106
  "success": False,
107
- "error": "未能获得有效的分析结果"
107
+ "error": "Failed to obtain valid analysis results"
108
108
  }
109
109
 
110
110
  return {
@@ -114,22 +114,22 @@ class ThinkerTool:
114
114
  }
115
115
 
116
116
  except Exception as e:
117
- PrettyOutput.print(f"思考分析失败: {str(e)}", OutputType.ERROR)
117
+ PrettyOutput.print(f"Thinking analysis failed: {str(e)}", OutputType.ERROR)
118
118
  return {
119
119
  "success": False,
120
- "error": f"执行失败: {str(e)}"
120
+ "error": f"Execution failed: {str(e)}"
121
121
  }
122
122
 
123
123
  def main():
124
- """命令行直接运行工具"""
124
+ """Run tool directly from command line"""
125
125
  import argparse
126
126
 
127
127
  load_env_from_file()
128
128
 
129
- parser = argparse.ArgumentParser(description='深度思考分析工具')
130
- parser.add_argument('--question', required=True, help='需要分析的问题')
131
- parser.add_argument('--context', help='问题相关的上下文信息')
132
- parser.add_argument('--goal', help='期望达成的具体目标或结果')
129
+ parser = argparse.ArgumentParser(description='Deep thinking analysis tool')
130
+ parser.add_argument('--question', required=True, help='The problem to analyze')
131
+ parser.add_argument('--context', help='Context information related to the problem')
132
+ parser.add_argument('--goal', help='Specific goal or result to achieve')
133
133
  args = parser.parse_args()
134
134
 
135
135
  tool = ThinkerTool()
@@ -140,7 +140,7 @@ def main():
140
140
  })
141
141
 
142
142
  if result["success"]:
143
- PrettyOutput.print("\n分析结果:", OutputType.INFO)
143
+ PrettyOutput.print("\nAnalysis results:", OutputType.INFO)
144
144
  PrettyOutput.print(result["stdout"], OutputType.INFO)
145
145
  else:
146
146
  PrettyOutput.print(result["error"], OutputType.ERROR)
jarvis/tools/webpage.py CHANGED
@@ -5,56 +5,56 @@ from jarvis.utils import PrettyOutput, OutputType
5
5
 
6
6
  class WebpageTool:
7
7
  name = "read_webpage"
8
- description = "读取网页内容,提取标题和正文文本"
8
+ description = "Read webpage content, extract title and text"
9
9
  parameters = {
10
10
  "type": "object",
11
11
  "properties": {
12
12
  "url": {
13
13
  "type": "string",
14
- "description": "需要读取的网页URL"
14
+ "description": "The URL of the webpage to read"
15
15
  }
16
16
  },
17
17
  "required": ["url"]
18
18
  }
19
19
 
20
20
  def execute(self, args: Dict) -> Dict[str, Any]:
21
- """读取网页内容"""
21
+ """Read webpage content"""
22
22
  try:
23
23
  url = args["url"]
24
24
 
25
- # 设置请求头
25
+ # Set request headers
26
26
  headers = {
27
27
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
28
28
  }
29
29
 
30
- # 发送请求
31
- PrettyOutput.print(f"正在读取网页: {url}", OutputType.INFO)
30
+ # Send request
31
+ PrettyOutput.print(f"Reading webpage: {url}", OutputType.INFO)
32
32
  response = requests.get(url, headers=headers, timeout=10)
33
33
  response.raise_for_status()
34
34
 
35
- # 使用正确的编码
35
+ # Use correct encoding
36
36
  response.encoding = response.apparent_encoding
37
37
 
38
- # 解析HTML
38
+ # Parse HTML
39
39
  soup = BeautifulSoup(response.text, 'html.parser')
40
40
 
41
- # 移除scriptstyle标签
41
+ # Remove script and style tags
42
42
  for script in soup(["script", "style"]):
43
43
  script.decompose()
44
44
 
45
- # 提取标题
45
+ # Extract title
46
46
  title = soup.title.string if soup.title else ""
47
- title = title.strip() if title else "无标题"
47
+ title = title.strip() if title else "No title"
48
48
 
49
- # 提取正文
49
+ # Extract text
50
50
  text = soup.get_text(separator='\n', strip=True)
51
51
  lines = [line.strip() for line in text.splitlines() if line.strip()]
52
52
 
53
- # 构建输出
53
+ # Build output
54
54
  output = [
55
- f"标题: {title}",
55
+ f"Title: {title}",
56
56
  "",
57
- "正文内容:",
57
+ "Text content:",
58
58
  "\n".join(lines)
59
59
  ]
60
60
 
@@ -67,10 +67,10 @@ class WebpageTool:
67
67
  except requests.RequestException as e:
68
68
  return {
69
69
  "success": False,
70
- "error": f"网页请求失败: {str(e)}"
70
+ "error": f"Webpage request failed: {str(e)}"
71
71
  }
72
72
  except Exception as e:
73
73
  return {
74
74
  "success": False,
75
- "error": f"解析网页失败: {str(e)}"
75
+ "error": f"Failed to parse webpage: {str(e)}"
76
76
  }
jarvis/utils.py CHANGED
@@ -22,52 +22,52 @@ os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"
22
22
  os.environ["TOKENIZERS_PARALLELISM"] = "false"
23
23
 
24
24
  class OutputType(Enum):
25
- SYSTEM = "system" # AI助手消息
26
- CODE = "code" # 代码相关
27
- RESULT = "result" # 工具执行结果
28
- ERROR = "error" # 错误信息
29
- INFO = "info" # 系统提示
30
- PLANNING = "planning" # 任务规划
31
- PROGRESS = "progress" # 执行进度
32
- SUCCESS = "success" # 成功信息
33
- WARNING = "warning" # 警告信息
34
- DEBUG = "debug" # 调试信息
35
- USER = "user" # 用户输入
36
- TOOL = "tool" # 工具调用
25
+ SYSTEM = "system" # AI assistant message
26
+ CODE = "code" # Code related
27
+ RESULT = "result" # Tool execution result
28
+ ERROR = "error" # Error information
29
+ INFO = "info" # System prompt
30
+ PLANNING = "planning" # Task planning
31
+ PROGRESS = "progress" # Execution progress
32
+ SUCCESS = "success" # Success information
33
+ WARNING = "warning" # Warning information
34
+ DEBUG = "debug" # Debug information
35
+ USER = "user" # User input
36
+ TOOL = "tool" # Tool call
37
37
 
38
38
  class PrettyOutput:
39
39
  """美化输出类"""
40
40
 
41
41
  # 颜色方案 - 只使用前景色
42
42
  COLORS = {
43
- OutputType.SYSTEM: Fore.CYAN, # 青色 - AI助手
44
- OutputType.CODE: Fore.GREEN, # 绿色 - 代码
45
- OutputType.RESULT: Fore.BLUE, # 蓝色 - 结果
46
- OutputType.ERROR: Fore.RED, # 红色 - 错误
47
- OutputType.INFO: Fore.YELLOW, # 黄色 - 提示
48
- OutputType.PLANNING: Fore.MAGENTA, # 紫色 - 规划
49
- OutputType.PROGRESS: Fore.WHITE, # 白色 - 进度
50
- OutputType.SUCCESS: Fore.GREEN, # 绿色 - 成功
51
- OutputType.WARNING: Fore.YELLOW, # 黄色 - 警告
52
- OutputType.DEBUG: Fore.BLUE, # 蓝色 - 调试
53
- OutputType.USER: Fore.GREEN, # 绿色 - 用户
54
- OutputType.TOOL: Fore.YELLOW, # 黄色 - 工具
43
+ OutputType.SYSTEM: Fore.CYAN, # Cyan - AI assistant
44
+ OutputType.CODE: Fore.GREEN, # Green - Code
45
+ OutputType.RESULT: Fore.BLUE, # Blue - Result
46
+ OutputType.ERROR: Fore.RED, # Red - Error
47
+ OutputType.INFO: Fore.YELLOW, # Yellow - Prompt
48
+ OutputType.PLANNING: Fore.MAGENTA, # Magenta - Planning
49
+ OutputType.PROGRESS: Fore.WHITE, # White - Progress
50
+ OutputType.SUCCESS: Fore.GREEN, # Green - Success
51
+ OutputType.WARNING: Fore.YELLOW, # Yellow - Warning
52
+ OutputType.DEBUG: Fore.BLUE, # Blue - Debug
53
+ OutputType.USER: Fore.GREEN, # Green - User
54
+ OutputType.TOOL: Fore.YELLOW, # Yellow - Tool
55
55
  }
56
56
 
57
57
  # 图标方案
58
58
  ICONS = {
59
- OutputType.SYSTEM: "🤖", # 机器人 - AI助手
60
- OutputType.CODE: "📝", # 记事本 - 代码
61
- OutputType.RESULT: "✨", # 闪光 - 结果
62
- OutputType.ERROR: "❌", # 错误 - 错误
63
- OutputType.INFO: "ℹ️", # 信息 - 提示
64
- OutputType.PLANNING: "📋", # 剪贴板 - 规划
65
- OutputType.PROGRESS: "⏳", # 沙漏 - 进度
66
- OutputType.SUCCESS: "✅", # 勾选 - 成功
67
- OutputType.WARNING: "⚠️", # 警告 - 警告
68
- OutputType.DEBUG: "🔍", # 放大镜 - 调试
69
- OutputType.USER: "👤", # 用户 - 用户
70
- OutputType.TOOL: "🔧", # 扳手 - 工具
59
+ OutputType.SYSTEM: "🤖", # Robot - AI assistant
60
+ OutputType.CODE: "📝", # Notebook - Code
61
+ OutputType.RESULT: "✨", # Flash - Result
62
+ OutputType.ERROR: "❌", # Error - Error
63
+ OutputType.INFO: "ℹ️", # Info - Prompt
64
+ OutputType.PLANNING: "📋", # Clipboard - Planning
65
+ OutputType.PROGRESS: "⏳", # Hourglass - Progress
66
+ OutputType.SUCCESS: "✅", # Checkmark - Success
67
+ OutputType.WARNING: "⚠️", # Warning - Warning
68
+ OutputType.DEBUG: "🔍", # Magnifying glass - Debug
69
+ OutputType.USER: "👤", # User - User
70
+ OutputType.TOOL: "🔧", # Wrench - Tool
71
71
  }
72
72
 
73
73
  # 前缀方案
@@ -88,7 +88,7 @@ class PrettyOutput:
88
88
 
89
89
  @staticmethod
90
90
  def format(text: str, output_type: OutputType, timestamp: bool = True) -> str:
91
- """格式化输出文本"""
91
+ """Format output text"""
92
92
  color = PrettyOutput.COLORS.get(output_type, "")
93
93
  icon = PrettyOutput.ICONS.get(output_type, "")
94
94
  prefix = PrettyOutput.PREFIXES.get(output_type, "")
@@ -103,15 +103,15 @@ class PrettyOutput:
103
103
 
104
104
  @staticmethod
105
105
  def print(text: str, output_type: OutputType, timestamp: bool = True):
106
- """打印格式化的输出"""
106
+ """Print formatted output"""
107
107
  print(PrettyOutput.format(text, output_type, timestamp))
108
108
  if output_type == OutputType.ERROR:
109
109
  import traceback
110
- PrettyOutput.print(f"错误追踪: {traceback.format_exc()}", OutputType.INFO)
110
+ PrettyOutput.print(f"Error trace: {traceback.format_exc()}", OutputType.INFO)
111
111
 
112
112
  @staticmethod
113
113
  def section(title: str, output_type: OutputType = OutputType.INFO):
114
- """打印带分隔线的段落标题"""
114
+ """Print paragraph title with separator"""
115
115
  width = 60
116
116
  color = PrettyOutput.COLORS.get(output_type, "")
117
117
  print(f"\n{color}" + "=" * width + f"{ColoramaStyle.RESET_ALL}")
@@ -120,19 +120,19 @@ class PrettyOutput:
120
120
 
121
121
  @staticmethod
122
122
  def print_stream(text: str):
123
- """打印流式输出,不换行"""
123
+ """Print stream output, no line break"""
124
124
  color = PrettyOutput.COLORS.get(OutputType.SYSTEM, "")
125
125
  sys.stdout.write(f"{color}{text}{ColoramaStyle.RESET_ALL}")
126
126
  sys.stdout.flush()
127
127
 
128
128
  @staticmethod
129
129
  def print_stream_end():
130
- """流式输出结束,打印换行"""
130
+ """Stream output end, print line break"""
131
131
  sys.stdout.write("\n")
132
132
  sys.stdout.flush()
133
133
 
134
134
  def get_multiline_input(tip: str) -> str:
135
- """获取多行输入,支持方向键、历史记录等功能"""
135
+ """Get multi-line input, support direction key, history function, etc."""
136
136
  print(f"{Fore.GREEN}{tip}{ColoramaStyle.RESET_ALL}")
137
137
 
138
138
  # 创建输入会话,启用历史记录
@@ -166,13 +166,13 @@ def get_multiline_input(tip: str) -> str:
166
166
  lines.append(line)
167
167
 
168
168
  except KeyboardInterrupt:
169
- PrettyOutput.print("\n输入已取消", OutputType.INFO)
169
+ PrettyOutput.print("\nInput cancelled", OutputType.INFO)
170
170
  return "__interrupt__"
171
171
 
172
172
  return "\n".join(lines)
173
173
 
174
174
  def load_env_from_file():
175
- """从~/.jarvis_env加载环境变量"""
175
+ """Load environment variables from ~/.jarvis_env"""
176
176
  env_file = Path.home() / ".jarvis_env"
177
177
 
178
178
  if env_file.exists():
@@ -195,17 +195,17 @@ def while_success(func, sleep_time: float = 0.1):
195
195
  try:
196
196
  return func()
197
197
  except Exception as e:
198
- PrettyOutput.print(f"执行失败: {str(e)}, {sleep_time}s后重试...", OutputType.ERROR)
198
+ PrettyOutput.print(f"Execution failed: {str(e)}, retry in {sleep_time}s...", OutputType.ERROR)
199
199
  time.sleep(sleep_time)
200
200
  continue
201
201
 
202
202
  def while_true(func, sleep_time: float = 0.1):
203
- """循环执行函数,直到函数返回True"""
203
+ """Loop execution function, until the function returns True"""
204
204
  while True:
205
205
  ret = func()
206
206
  if ret:
207
207
  break
208
- PrettyOutput.print(f"执行失败,{sleep_time}s后重试...", OutputType.WARNING)
208
+ PrettyOutput.print(f"Execution failed, retry in {sleep_time}s...", OutputType.WARNING)
209
209
  time.sleep(sleep_time)
210
210
  return ret
211
211
 
@@ -218,7 +218,7 @@ def find_git_root(dir="."):
218
218
 
219
219
  def load_embedding_model():
220
220
  model_name = "BAAI/bge-large-zh-v1.5"
221
- PrettyOutput.print(f"正在加载嵌入模型: {model_name}...", OutputType.INFO)
221
+ PrettyOutput.print(f"Loading embedding model: {model_name}...", OutputType.INFO)
222
222
  try:
223
223
  # 首先尝试离线加载
224
224
  embedding_model = SentenceTransformer(
@@ -226,22 +226,22 @@ def load_embedding_model():
226
226
  cache_folder=os.path.expanduser("~/.cache/huggingface/hub"),
227
227
  local_files_only=True
228
228
  )
229
- PrettyOutput.print("使用本地缓存加载模型成功", OutputType.SUCCESS)
229
+ PrettyOutput.print("Successfully loaded model using local cache", OutputType.SUCCESS)
230
230
  except Exception as local_error:
231
- PrettyOutput.print(f"本地加载失败,尝试在线下载: {str(local_error)}", OutputType.WARNING)
231
+ PrettyOutput.print(f"Failed to load locally, trying to download online: {str(local_error)}", OutputType.WARNING)
232
232
  # 如果离线加载失败,尝试在线下载
233
233
  embedding_model = SentenceTransformer(
234
234
  model_name,
235
235
  cache_folder=os.path.expanduser("~/.cache/huggingface/hub")
236
236
  )
237
- PrettyOutput.print("模型下载并加载成功", OutputType.SUCCESS)
237
+ PrettyOutput.print("Successfully downloaded and loaded model", OutputType.SUCCESS)
238
238
 
239
239
  return embedding_model
240
240
 
241
241
  def load_rerank_model():
242
- """加载重排序模型"""
242
+ """Load reranking model"""
243
243
  model_name = "BAAI/bge-reranker-v2-m3"
244
- PrettyOutput.print(f"正在加载重排序模型: {model_name}...", OutputType.INFO)
244
+ PrettyOutput.print(f"Loading reranking model: {model_name}...", OutputType.INFO)
245
245
 
246
246
  try:
247
247
  # 首先尝试离线加载
@@ -255,9 +255,9 @@ def load_rerank_model():
255
255
  local_files_only=True,
256
256
  cache_dir=os.path.expanduser("~/.cache/huggingface/hub")
257
257
  )
258
- PrettyOutput.print("使用本地缓存加载模型成功", OutputType.SUCCESS)
258
+ PrettyOutput.print("Successfully loaded model using local cache", OutputType.SUCCESS)
259
259
  except Exception as local_error:
260
- PrettyOutput.print(f"本地加载失败,尝试在线下载: {str(local_error)}", OutputType.WARNING)
260
+ PrettyOutput.print(f"Failed to load locally, trying to download online: {str(local_error)}", OutputType.WARNING)
261
261
  # 如果离线加载失败,尝试在线下载
262
262
  tokenizer = AutoTokenizer.from_pretrained(
263
263
  model_name,
@@ -267,7 +267,7 @@ def load_rerank_model():
267
267
  model_name,
268
268
  cache_dir=os.path.expanduser("~/.cache/huggingface/hub")
269
269
  )
270
- PrettyOutput.print("模型下载并加载成功", OutputType.SUCCESS)
270
+ PrettyOutput.print("Successfully downloaded and loaded model", OutputType.SUCCESS)
271
271
 
272
272
  # 如果有 GPU 就使用 GPU
273
273
  if torch.cuda.is_available():
@@ -280,7 +280,7 @@ def get_max_context_length():
280
280
  return int(os.getenv('JARVIS_MAX_CONTEXT_LENGTH', '131072')) # 默认128k
281
281
 
282
282
  def is_long_context(files: list) -> bool:
283
- """检测文件列表是否属于长上下文(总字符数超过最大上下文长度的80%)"""
283
+ """Check if the file list belongs to a long context (total characters exceed 80% of the maximum context length)"""
284
284
  max_length = get_max_context_length()
285
285
  threshold = max_length * 0.8
286
286
  total_chars = 0
@@ -291,11 +291,10 @@ def is_long_context(files: list) -> bool:
291
291
  content = f.read()
292
292
  total_chars += len(content)
293
293
 
294
- # 提前终止检查如果已经超过阈值
295
294
  if total_chars > threshold:
296
295
  return True
297
296
  except Exception as e:
298
- PrettyOutput.print(f"无法读取文件 {file_path}: {e}", OutputType.WARNING)
297
+ PrettyOutput.print(f"Failed to read file {file_path}: {e}", OutputType.WARNING)
299
298
  continue
300
299
 
301
300
  return total_chars > threshold
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.96
3
+ Version: 0.1.97
4
4
  Summary: Jarvis: An AI assistant that uses tools to interact with the system
5
5
  Home-page: https://github.com/skyfireitdiy/Jarvis
6
6
  Author: skyfire
@@ -0,0 +1,47 @@
1
+ jarvis/__init__.py,sha256=H5VVLl_TbloHsL4Uo5ZiI3kdTZALf6RmT-dv6Xy76a8,50
2
+ jarvis/agent.py,sha256=9dfXBYO2QPYpiIXJixgoc1-CKHBDQcBlhskWrb0ZNYc,19636
3
+ jarvis/main.py,sha256=mV_rW268R2CWnwDLUqmCqVOzEZBodwJoTzPiz979QF8,5919
4
+ jarvis/utils.py,sha256=nqmOuQtmoIsc67iQNuWADwbXf2D3cbGjXan5VXLaTYk,11373
5
+ jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ jarvis/jarvis_codebase/main.py,sha256=8A4VwK_MjAknT6ANj5Ptgf3wDD6e8rFOQVcU4gcVvH8,31183
7
+ jarvis/jarvis_coder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ jarvis/jarvis_coder/git_utils.py,sha256=Rm0odJSbI3KGo8rTAAv1YsuudgjROlbHl7UBVOcxK3c,2237
9
+ jarvis/jarvis_coder/main.py,sha256=l8q4xEvxSlha0kHJ3GarDCeu3mIu1un6OFeWALbQAqY,25144
10
+ jarvis/jarvis_coder/patch_handler.py,sha256=FJy8NxECVExBudBlbOchoBKaLJQyG8z-KorjNkXUig0,9649
11
+ jarvis/jarvis_coder/plan_generator.py,sha256=ODBeCT7pSv-SA0l22q8nAOwn2Usqr1TKHci8zMVpwmk,4474
12
+ jarvis/jarvis_platform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ jarvis/jarvis_platform/main.py,sha256=R0b51en28HaMpqc2jxP4xnOUXYIQa4GBUs0vC_acD34,4882
14
+ jarvis/jarvis_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ jarvis/jarvis_rag/main.py,sha256=gVHdF_WyzJEoOgda6xVe-P9R2iAIRNf_vj6xZ1WPvrw,32766
16
+ jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ jarvis/jarvis_smart_shell/main.py,sha256=nTIErwnib9z8a67f5k3PqlhTvbXffo4BVpAANXWekos,3895
18
+ jarvis/models/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
19
+ jarvis/models/ai8.py,sha256=ZRNO3aRjmICRjCXl-_F9pTNQTY4j1tUd-WJoJpb9n4Y,11958
20
+ jarvis/models/base.py,sha256=5QQAghMmVsg7jXvQN9ZzVoqCmMR0jb9bKgAVR3eOjQ8,2005
21
+ jarvis/models/kimi.py,sha256=wLXEA-17yLVvMRn-SAMGwQ_gx6mBaGhlSsP8F5pfoL0,16391
22
+ jarvis/models/ollama.py,sha256=E8JDe378yMreglSVN5c_9lHAGBbuzHcYG05v07mS2BI,5724
23
+ jarvis/models/openai.py,sha256=tAvz2Pne7woDXUppD7Ina461mVQCxy0vG5cwv5MHpLg,4404
24
+ jarvis/models/oyi.py,sha256=iA8E5vzN9VIt-rlzpT5wmbyl7umVU1_y5yo_5gz3DXc,14534
25
+ jarvis/models/registry.py,sha256=wswPmR8gzsyFnJ6TcTh58Py4uj6N0vApblyuXI7NeOQ,9062
26
+ jarvis/tools/__init__.py,sha256=7Rqyj5hBAv5cWDVr5T9ZTZASO7ssBHeQNm2_4ZARdkA,72
27
+ jarvis/tools/ask_user.py,sha256=u1opLhuHUmqz7bvlpj44x0vgMlKrTzFuFqc6YFaajW0,1953
28
+ jarvis/tools/base.py,sha256=c0DMoDDPxmsqUYJR989zgUs7nIYRY6GWBrAdusIZKjc,656
29
+ jarvis/tools/chdir.py,sha256=YMrzj6V3JHxX94e8adz97x1_E5aWjUoEwkhDM4T2DEs,2793
30
+ jarvis/tools/codebase_qa.py,sha256=AJEJYnmw3ro5PEqUQGbNEpqY7YwwjXvYpEzmZheMptk,2446
31
+ jarvis/tools/coder.py,sha256=HKBIbDwkpK05Zh4-ZDhmkB4x0HL-wNZL8T_ojwCk7KM,2383
32
+ jarvis/tools/file_ops.py,sha256=lRoKl6d53wT3-sun_JqGLY6MO4RiXfxJL3ybP-chzTQ,3845
33
+ jarvis/tools/generator.py,sha256=5iw8-uLwMcwSzQ2DouoWYa4WYm_7ZmYfdJBU50z9SUE,6040
34
+ jarvis/tools/methodology.py,sha256=zsEr-i5mifJH1BXg0JgrmPaToTBcbjGdm_aM88vVmug,5199
35
+ jarvis/tools/rag.py,sha256=zUrAJNis_HmTDCfSztmulqYt4ulaYHRb6fd-EMXRO9c,4528
36
+ jarvis/tools/registry.py,sha256=-Qwt_2wcahN2XBwRtziZgm6eVF18jOvtLwgXgwre1nA,9471
37
+ jarvis/tools/search.py,sha256=qbSfHJ5RHx8cHSdcmOfTFMQCNg6IxztKH5Vg4FtVTdE,9075
38
+ jarvis/tools/shell.py,sha256=6XIDzdTf67PDIObUZqLtHvhnlOLSyuV_GlfFwQJsSaU,2580
39
+ jarvis/tools/sub_agent.py,sha256=7YPY3qUocH7RjE3MDKFGlXKlAMIQv3-ufPRzlNXwo7w,2676
40
+ jarvis/tools/thinker.py,sha256=VFq0z9geAtGsRCbd8S73Rk7afAuGm3KQp6t5nayUJVg,4800
41
+ jarvis/tools/webpage.py,sha256=_ts9ioSFR2wcMwjId_aV-jqSWpbiydU_beJQyn_aAv4,2405
42
+ jarvis_ai_assistant-0.1.97.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
43
+ jarvis_ai_assistant-0.1.97.dist-info/METADATA,sha256=23tqwSyUw2Nx2F6Q3VPuQBjAfi76ae2B6cafd2ZgboA,12766
44
+ jarvis_ai_assistant-0.1.97.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
45
+ jarvis_ai_assistant-0.1.97.dist-info/entry_points.txt,sha256=1D14s9v6rwpNzVD0muwe0tCKffJDEvLRBlEShbSFSbQ,331
46
+ jarvis_ai_assistant-0.1.97.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
47
+ jarvis_ai_assistant-0.1.97.dist-info/RECORD,,
@@ -1,47 +0,0 @@
1
- jarvis/__init__.py,sha256=wUQ-PX-BDcjJtfA4ZlQb8sktjNJbfk0kiOu3_ZHJKyM,50
2
- jarvis/agent.py,sha256=vjWR-bIyac7nL3qMUOhastXMdT9PqufwRjT-h_hAnk0,19403
3
- jarvis/main.py,sha256=kHvlVDmjznWvXugl56M4HRb1Uedkn8lKsMEKr8tNy1Q,5824
4
- jarvis/utils.py,sha256=gIpS62j9cbKndvXQ7E36RQCaNOgl5bl2PRPcpiZZvew,11292
5
- jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- jarvis/jarvis_codebase/main.py,sha256=li3ccKSs4RwQw8EK35RssC3IHDg1PjEji0pNCC-HMtE,29885
7
- jarvis/jarvis_coder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- jarvis/jarvis_coder/git_utils.py,sha256=u5mUe_R3JDJthDoamlNOkrN3bJKf-47pf8YqCvtmYK4,2284
9
- jarvis/jarvis_coder/main.py,sha256=ZgmASwDsRLUx8_E_9Cnr2n_pXnyp-lHWAA1IGHwsfb8,25294
10
- jarvis/jarvis_coder/patch_handler.py,sha256=MPVdhWPECWMRbJa3Qg9BX_GBfbPhoq9tA7_OakTJoUA,21476
11
- jarvis/jarvis_coder/plan_generator.py,sha256=xtiYEE-RhexBWamBnsat_pUyzzc4IdP5PCI6p8wyqLE,2845
12
- jarvis/jarvis_platform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- jarvis/jarvis_platform/main.py,sha256=uOv5TlxKVWO_lD2mnB7KAILkqCbezhOwiJ6g_CRQBlU,4868
14
- jarvis/jarvis_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- jarvis/jarvis_rag/main.py,sha256=Gu8llgtBaRTg7sKMB-3pRLb0Tjs1ee_mbZLOku0kDPk,32752
16
- jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- jarvis/jarvis_smart_shell/main.py,sha256=wqTbbXMaM3X6YIdOtNVF6B3Ua7fxu0XTeXBR7lfdWg0,3812
18
- jarvis/models/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
19
- jarvis/models/ai8.py,sha256=ARzNIg7v7-Vy5TtHHmTGV3Fn8rXbNxKw2pe_BylyADE,11887
20
- jarvis/models/base.py,sha256=qIpO32lejPhaZk5T3VIua3td4gEguXMaeFER5kXYwLY,1782
21
- jarvis/models/kimi.py,sha256=cB1tC_ifdTAZUEqndzNTIcgHWi4w4tM8zdzSOcDhOrQ,16348
22
- jarvis/models/ollama.py,sha256=fLVGGBfE5S_sFDiQ1ZC6-Oz9AY6EMnRqvILLi7lP-gw,5603
23
- jarvis/models/openai.py,sha256=XdBsWRwlJgUwsqasux0IhUHhjo4UGZt0eg7xFQVNZhY,4400
24
- jarvis/models/oyi.py,sha256=ZMyX2WMHC_HG0mGCtTyJwfiARQmlLKtgOfpNP5YX0DI,14463
25
- jarvis/models/registry.py,sha256=SDnrNzf0wQi8mb7qbu4ZNfYIy5vhz1CxmVL3Ru-VATk,8797
26
- jarvis/tools/__init__.py,sha256=7Rqyj5hBAv5cWDVr5T9ZTZASO7ssBHeQNm2_4ZARdkA,72
27
- jarvis/tools/ask_user.py,sha256=naLLVYKKMSVkQSExvnyZbL9FHwFrpTqEQjlBFcJadp8,1865
28
- jarvis/tools/base.py,sha256=EGRGbdfbLXDLwtyoWdvp9rlxNX7bzc20t0Vc2VkwIEY,652
29
- jarvis/tools/chdir.py,sha256=TjfPbX8yvNKgUNJEMXh3ZlVDEIse_Fo8xMoVsiK7_dA,2688
30
- jarvis/tools/codebase_qa.py,sha256=Lk8EXkin45RKUsp5C_UHm6jADBhyCT-xsYubwJ1hSiE,2403
31
- jarvis/tools/coder.py,sha256=ws25Vni7Q_fKxSNyQLapqlcjlpP9jkavgJRIv78ATww,2315
32
- jarvis/tools/file_ops.py,sha256=h8g0eT9UvlJf4kt0DLXvdSsjcPj7x19lxWdDApeDfpg,3842
33
- jarvis/tools/generator.py,sha256=TB1zcw_JmRL2W9w6L4IxtrLF3gjnNw5Jj2Zrowj0eSg,5763
34
- jarvis/tools/methodology.py,sha256=UG6s5VYRcd9wrKX4cg6f7zJhet5AIcthFGMOAdevBiw,5175
35
- jarvis/tools/rag.py,sha256=tJzuhHaTrujVXCBgmyMqSynVF0UFsIJeRTG0Y_Tt964,4483
36
- jarvis/tools/registry.py,sha256=AbADf8pcjHqfNoQNJkWqEuVg6zHRdryhJyDQ5w4O2sc,9177
37
- jarvis/tools/search.py,sha256=c9dXtyICdl8Lm8shNPNyIx9k67uY0rMF8xnIKu2RsnE,8787
38
- jarvis/tools/shell.py,sha256=UPKshPyOaUwTngresUw-ot1jHjQIb4wCY5nkJqa38lU,2520
39
- jarvis/tools/sub_agent.py,sha256=rEtAmSVY2ZjFOZEKr5m5wpACOQIiM9Zr_3dT92FhXYU,2621
40
- jarvis/tools/thinker.py,sha256=yjY-JMf-Vp_UZdBNa7auvFZl8Wohcu1AqqNO2GSel-w,4598
41
- jarvis/tools/webpage.py,sha256=d3w3Jcjcu1ESciezTkz3n3Zf-rp_l91PrVoDEZnckOo,2391
42
- jarvis_ai_assistant-0.1.96.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
43
- jarvis_ai_assistant-0.1.96.dist-info/METADATA,sha256=sPaPjxVKI7CjitabeUbJvsvujfPlkLgbmLFbBC2zkFc,12766
44
- jarvis_ai_assistant-0.1.96.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
45
- jarvis_ai_assistant-0.1.96.dist-info/entry_points.txt,sha256=1D14s9v6rwpNzVD0muwe0tCKffJDEvLRBlEShbSFSbQ,331
46
- jarvis_ai_assistant-0.1.96.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
47
- jarvis_ai_assistant-0.1.96.dist-info/RECORD,,