jarvis-ai-assistant 0.1.83__py3-none-any.whl → 0.1.85__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 +1 -1
- jarvis/agent.py +4 -2
- jarvis/jarvis_codebase/main.py +12 -5
- jarvis/jarvis_rag/main.py +7 -1
- {jarvis_ai_assistant-0.1.83.dist-info → jarvis_ai_assistant-0.1.85.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.1.83.dist-info → jarvis_ai_assistant-0.1.85.dist-info}/RECORD +10 -10
- {jarvis_ai_assistant-0.1.83.dist-info → jarvis_ai_assistant-0.1.85.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.83.dist-info → jarvis_ai_assistant-0.1.85.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.83.dist-info → jarvis_ai_assistant-0.1.85.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.83.dist-info → jarvis_ai_assistant-0.1.85.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/agent.py
CHANGED
|
@@ -266,8 +266,10 @@ class Agent:
|
|
|
266
266
|
|
|
267
267
|
# 检查是否包含工具调用
|
|
268
268
|
try:
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
tool_calls = Agent.extract_tool_calls(response)
|
|
270
|
+
if tool_calls:
|
|
271
|
+
result = self.tool_registry.handle_tool_calls(tool_calls)
|
|
272
|
+
PrettyOutput.print(result, OutputType.RESULT)
|
|
271
273
|
except Exception as e:
|
|
272
274
|
PrettyOutput.print(f"处理方法论生成失败: {str(e)}", OutputType.ERROR)
|
|
273
275
|
|
jarvis/jarvis_codebase/main.py
CHANGED
|
@@ -76,7 +76,7 @@ class CodeBase:
|
|
|
76
76
|
"""获取 git 仓库中的文件列表,排除 .jarvis-codebase 目录"""
|
|
77
77
|
files = os.popen("git ls-files").read().splitlines()
|
|
78
78
|
# 过滤掉 .jarvis-codebase 目录下的文件
|
|
79
|
-
return [f for f in files if not f.startswith(".jarvis-
|
|
79
|
+
return [f for f in files if not f.startswith(".jarvis-")]
|
|
80
80
|
|
|
81
81
|
def is_text_file(self, file_path: str):
|
|
82
82
|
with open(file_path, "r", encoding="utf-8") as f:
|
|
@@ -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
|
-
|
|
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
|
# 保存到缓存,使用实际文件路径作为键
|
jarvis/jarvis_rag/main.py
CHANGED
|
@@ -370,9 +370,15 @@ class RAGTool:
|
|
|
370
370
|
# 获取所有文件
|
|
371
371
|
all_files = []
|
|
372
372
|
for root, _, files in os.walk(dir):
|
|
373
|
-
|
|
373
|
+
# 忽略特定目录
|
|
374
|
+
if any(ignored in root for ignored in ['.git', '__pycache__', 'node_modules']) or \
|
|
375
|
+
any(part.startswith('.jarvis-') for part in root.split(os.sep)):
|
|
374
376
|
continue
|
|
375
377
|
for file in files:
|
|
378
|
+
# 忽略 .jarvis- 开头的文件
|
|
379
|
+
if file.startswith('.jarvis-'):
|
|
380
|
+
continue
|
|
381
|
+
|
|
376
382
|
file_path = os.path.join(root, file)
|
|
377
383
|
# 跳过大文件
|
|
378
384
|
if os.path.getsize(file_path) > 100 * 1024 * 1024: # 100MB
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
2
|
-
jarvis/agent.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=CSCMvkP7vytslNiqC8OQkG-M3_75PziRYYuzcVBVfp0,50
|
|
2
|
+
jarvis/agent.py,sha256=LfWTMp7lyrMebby56up-58VuxK5JSnfq0cyJDWG7HBw,19069
|
|
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=
|
|
6
|
+
jarvis/jarvis_codebase/main.py,sha256=tefwhPXVcUoV7ZIhF4AiIBsZ9sJRCkjI_i5lyusbZOI,24972
|
|
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
|
|
10
|
-
jarvis/jarvis_rag/main.py,sha256=
|
|
10
|
+
jarvis/jarvis_rag/main.py,sha256=pIZXnw7xl6yqdN0Lghu7WDwd-kyh36KTCAgOoSn95uk,22932
|
|
11
11
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
jarvis/jarvis_smart_shell/main.py,sha256=QgR1CZRcTVfC8a5hMso3onH3pFdDoniRjr0YQvY2jXQ,3809
|
|
13
13
|
jarvis/models/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
|
|
@@ -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.
|
|
35
|
-
jarvis_ai_assistant-0.1.
|
|
36
|
-
jarvis_ai_assistant-0.1.
|
|
37
|
-
jarvis_ai_assistant-0.1.
|
|
38
|
-
jarvis_ai_assistant-0.1.
|
|
39
|
-
jarvis_ai_assistant-0.1.
|
|
34
|
+
jarvis_ai_assistant-0.1.85.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
35
|
+
jarvis_ai_assistant-0.1.85.dist-info/METADATA,sha256=RK6Yy0tqkTb0tMnqxLLyizhi6fZmFTEwAP-rI6PRCHM,12736
|
|
36
|
+
jarvis_ai_assistant-0.1.85.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
37
|
+
jarvis_ai_assistant-0.1.85.dist-info/entry_points.txt,sha256=sdmIO86MrIUepJTGyHs0i_Ho9VGf1q9YRP4RgQvGWcI,280
|
|
38
|
+
jarvis_ai_assistant-0.1.85.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
39
|
+
jarvis_ai_assistant-0.1.85.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{jarvis_ai_assistant-0.1.83.dist-info → jarvis_ai_assistant-0.1.85.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|