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

jarvis/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.83"
3
+ __version__ = "0.1.84"
@@ -86,10 +86,9 @@ class CodeBase:
86
86
  except UnicodeDecodeError:
87
87
  return False
88
88
 
89
- def make_description(self, file_path: str) -> str:
89
+ def make_description(self, file_path: str, content: str) -> str:
90
90
  model = PlatformRegistry.get_global_platform_registry().get_codegen_platform()
91
91
  model.set_suppress_output(True)
92
- content = open(file_path, "r", encoding="utf-8").read()
93
92
  prompt = f"""请分析以下代码文件,并生成一个详细的描述。描述应该包含以下要点:
94
93
 
95
94
  1. 主要功能和用途
@@ -237,14 +236,22 @@ class CodeBase:
237
236
  if not self.is_text_file(file_path):
238
237
  return None
239
238
 
240
- md5 = hashlib.md5(open(file_path, "rb").read()).hexdigest()
239
+ # 读取文件内容,限制长度
240
+ with open(file_path, "r", encoding="utf-8") as f:
241
+ content = f.read()
242
+ if len(content) > self.max_context_length:
243
+ PrettyOutput.print(f"文件 {file_path} 内容超出长度限制,将截取前 {self.max_context_length} 个字符",
244
+ output_type=OutputType.WARNING)
245
+ content = content[:self.max_context_length]
246
+
247
+ md5 = hashlib.md5(content.encode('utf-8')).hexdigest()
241
248
 
242
249
  # 检查文件是否已经处理过且内容未变
243
250
  if file_path in self.vector_cache:
244
251
  if self.vector_cache[file_path].get("md5") == md5:
245
252
  return None
246
253
 
247
- description = self.make_description(file_path)
254
+ description = self.make_description(file_path, content) # 传入截取后的内容
248
255
  vector = self.vectorize_file(file_path, description)
249
256
 
250
257
  # 保存到缓存,使用实际文件路径作为键
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.83
3
+ Version: 0.1.84
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
@@ -1,9 +1,9 @@
1
- jarvis/__init__.py,sha256=S9oTgBnIxuAWrIt79cFytfBwF-uR1VoqSb-FgvZCcF0,50
1
+ jarvis/__init__.py,sha256=xSQQknFuIT5r0P9KOiJuRj80TCRJdHqpoW0pmqKLE7c,50
2
2
  jarvis/agent.py,sha256=2g2fl9BFosi4YasIEUgutS1pX6AMTf2wit5V0bZILMU,18944
3
3
  jarvis/main.py,sha256=ksZkJzqc4oow6wB-7QbGJLejGblrbZtRI3fdciS5DS4,5455
4
4
  jarvis/utils.py,sha256=jvo6ylvrTaSmXWcYY0qTTf14TwCkAhPsCUuIl5WHEuw,8640
5
5
  jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- jarvis/jarvis_codebase/main.py,sha256=rlcN44mm67c-ZlCtcsq52jmqWlf4wPxvc-_HbgmoXOk,24510
6
+ jarvis/jarvis_codebase/main.py,sha256=7QzuxDi0dKpOBKKn49Ajw1I2cs2X72GUvxDsWqweAbs,24981
7
7
  jarvis/jarvis_coder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  jarvis/jarvis_coder/main.py,sha256=TxtFCzA5SJSorHtHX5_V3qQeJsoFMgVdrwxLJ9GnPw8,23619
9
9
  jarvis/jarvis_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -31,9 +31,9 @@ jarvis/tools/search.py,sha256=c9dXtyICdl8Lm8shNPNyIx9k67uY0rMF8xnIKu2RsnE,8787
31
31
  jarvis/tools/shell.py,sha256=UPKshPyOaUwTngresUw-ot1jHjQIb4wCY5nkJqa38lU,2520
32
32
  jarvis/tools/sub_agent.py,sha256=rEtAmSVY2ZjFOZEKr5m5wpACOQIiM9Zr_3dT92FhXYU,2621
33
33
  jarvis/tools/webpage.py,sha256=d3w3Jcjcu1ESciezTkz3n3Zf-rp_l91PrVoDEZnckOo,2391
34
- jarvis_ai_assistant-0.1.83.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
35
- jarvis_ai_assistant-0.1.83.dist-info/METADATA,sha256=7r6J3Z_AjmLRXsQjyIVtJ1F4DnmepO_ES8PLFIE_BLY,12736
36
- jarvis_ai_assistant-0.1.83.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
37
- jarvis_ai_assistant-0.1.83.dist-info/entry_points.txt,sha256=sdmIO86MrIUepJTGyHs0i_Ho9VGf1q9YRP4RgQvGWcI,280
38
- jarvis_ai_assistant-0.1.83.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
39
- jarvis_ai_assistant-0.1.83.dist-info/RECORD,,
34
+ jarvis_ai_assistant-0.1.84.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
35
+ jarvis_ai_assistant-0.1.84.dist-info/METADATA,sha256=FRKOUapVcKH66Faydm1OQpClQm7GeAC4D-wz3wyvI2c,12736
36
+ jarvis_ai_assistant-0.1.84.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
37
+ jarvis_ai_assistant-0.1.84.dist-info/entry_points.txt,sha256=sdmIO86MrIUepJTGyHs0i_Ho9VGf1q9YRP4RgQvGWcI,280
38
+ jarvis_ai_assistant-0.1.84.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
39
+ jarvis_ai_assistant-0.1.84.dist-info/RECORD,,