jarvis-ai-assistant 0.1.80__py3-none-any.whl → 0.1.82__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 +3 -3
- jarvis/jarvis_codebase/main.py +3 -2
- jarvis/jarvis_coder/main.py +3 -1
- jarvis/tools/registry.py +2 -2
- {jarvis_ai_assistant-0.1.80.dist-info → jarvis_ai_assistant-0.1.82.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.1.80.dist-info → jarvis_ai_assistant-0.1.82.dist-info}/RECORD +11 -11
- {jarvis_ai_assistant-0.1.80.dist-info → jarvis_ai_assistant-0.1.82.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.80.dist-info → jarvis_ai_assistant-0.1.82.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.80.dist-info → jarvis_ai_assistant-0.1.82.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.80.dist-info → jarvis_ai_assistant-0.1.82.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/agent.py
CHANGED
|
@@ -33,7 +33,7 @@ class Agent:
|
|
|
33
33
|
|
|
34
34
|
# 从环境变量加载配置
|
|
35
35
|
self.embedding_dimension = 1536 # Default for many embedding models
|
|
36
|
-
self.max_context_length = int(os.getenv('JARVIS_MAX_CONTEXT_LENGTH', '
|
|
36
|
+
self.max_context_length = int(os.getenv('JARVIS_MAX_CONTEXT_LENGTH', '65536')) # 默认30k
|
|
37
37
|
|
|
38
38
|
# 初始化嵌入模型
|
|
39
39
|
try:
|
|
@@ -320,12 +320,12 @@ class Agent:
|
|
|
320
320
|
tools_prompt = ""
|
|
321
321
|
|
|
322
322
|
# 选择工具
|
|
323
|
-
PrettyOutput.section("
|
|
323
|
+
PrettyOutput.section("可用工具", OutputType.PLANNING)
|
|
324
324
|
tools = self.tool_registry.get_all_tools()
|
|
325
325
|
if tools:
|
|
326
326
|
tools_prompt += "可用工具:\n"
|
|
327
327
|
for tool in tools:
|
|
328
|
-
PrettyOutput.print(f"
|
|
328
|
+
PrettyOutput.print(f"{tool['name']}: {tool['description']}", OutputType.INFO)
|
|
329
329
|
tools_prompt += f"- 名称: {tool['name']}\n"
|
|
330
330
|
tools_prompt += f" 描述: {tool['description']}\n"
|
|
331
331
|
tools_prompt += f" 参数: {tool['parameters']}\n"
|
jarvis/jarvis_codebase/main.py
CHANGED
|
@@ -19,6 +19,7 @@ class CodeBase:
|
|
|
19
19
|
self.root_dir = root_dir
|
|
20
20
|
os.chdir(self.root_dir)
|
|
21
21
|
self.thread_count = int(os.environ.get("JARVIS_THREAD_COUNT") or 10)
|
|
22
|
+
self.max_context_length = int(os.getenv("JARVIS_MAX_CONTEXT_LENGTH", 65536))
|
|
22
23
|
|
|
23
24
|
# 初始化数据目录
|
|
24
25
|
self.data_dir = os.path.join(self.root_dir, ".jarvis-codebase")
|
|
@@ -450,7 +451,7 @@ class CodeBase:
|
|
|
450
451
|
|
|
451
452
|
return initial_results
|
|
452
453
|
|
|
453
|
-
def search_similar(self, query: str, top_k: int =
|
|
454
|
+
def search_similar(self, query: str, top_k: int = 30) -> List[Tuple[str, float, str]]:
|
|
454
455
|
"""搜索相似文件"""
|
|
455
456
|
model = PlatformRegistry.get_global_platform_registry().get_normal_platform()
|
|
456
457
|
model.set_suppress_output(True)
|
|
@@ -515,7 +516,7 @@ class CodeBase:
|
|
|
515
516
|
"""
|
|
516
517
|
for path, _, _ in results:
|
|
517
518
|
try:
|
|
518
|
-
if len(prompt) >
|
|
519
|
+
if len(prompt) > self.max_context_length:
|
|
519
520
|
PrettyOutput.print(f"避免上下文超限,丢弃低相关度文件:{path}", OutputType.WARNING)
|
|
520
521
|
continue
|
|
521
522
|
content = open(path, "r", encoding="utf-8").read()
|
jarvis/jarvis_coder/main.py
CHANGED
|
@@ -22,6 +22,8 @@ class JarvisCoder:
|
|
|
22
22
|
def __init__(self, root_dir: str, language: str):
|
|
23
23
|
"""初始化代码修改工具"""
|
|
24
24
|
|
|
25
|
+
self.max_context_length = int(os.getenv("JARVIS_MAX_CONTEXT_LENGTH", 65536))
|
|
26
|
+
|
|
25
27
|
|
|
26
28
|
self.root_dir = find_git_root(root_dir)
|
|
27
29
|
if not self.root_dir:
|
|
@@ -154,7 +156,7 @@ class JarvisCoder:
|
|
|
154
156
|
文件列表如下:
|
|
155
157
|
"""
|
|
156
158
|
for i, file in enumerate(related_files):
|
|
157
|
-
if len(prompt) >
|
|
159
|
+
if len(prompt) > self.max_context_length:
|
|
158
160
|
PrettyOutput.print(f'避免上下文超限,丢弃低相关度文件:{file["file_path"]}', OutputType.WARNING)
|
|
159
161
|
continue
|
|
160
162
|
prompt += f"""{i}. {file["file_path"]}\n"""
|
jarvis/tools/registry.py
CHANGED
|
@@ -19,7 +19,7 @@ class ToolRegistry:
|
|
|
19
19
|
# 加载内置工具和外部工具
|
|
20
20
|
self._load_builtin_tools()
|
|
21
21
|
self._load_external_tools()
|
|
22
|
-
self.max_context_length = int(os.getenv('JARVIS_MAX_CONTEXT_LENGTH', '
|
|
22
|
+
self.max_context_length = int(os.getenv('JARVIS_MAX_CONTEXT_LENGTH', '65536')) # 默认30k
|
|
23
23
|
|
|
24
24
|
@staticmethod
|
|
25
25
|
def get_global_tool_registry():
|
|
@@ -184,7 +184,7 @@ class ToolRegistry:
|
|
|
184
184
|
# 如果输出超过30k,只取最后30k字符
|
|
185
185
|
if len(output) > self.max_context_length:
|
|
186
186
|
output_to_summarize = output[-self.max_context_length:]
|
|
187
|
-
truncation_notice = "\n(注意: 由于输出过长,仅总结最后
|
|
187
|
+
truncation_notice = "\n(注意: 由于输出过长,仅总结最后65536字符)"
|
|
188
188
|
else:
|
|
189
189
|
output_to_summarize = output
|
|
190
190
|
truncation_notice = ""
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
2
|
-
jarvis/agent.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=k-UkaWVzxFbaPdj5vipYJrmuGDsEE8ESDzTjJnRduyA,50
|
|
2
|
+
jarvis/agent.py,sha256=QkfW8fYdIFo54IgScP2sgS0NsDH-lWghtAjaYOhYQxs,19382
|
|
3
3
|
jarvis/main.py,sha256=OJc7e5i988eQLByT7SzX7eoa0HKm4LMg814gZv9hBX8,5487
|
|
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=z6HRTkUjAhRQclfHqj4yt3wq_wxiRlp0OCJsL_99NfI,24884
|
|
7
7
|
jarvis/jarvis_coder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
jarvis/jarvis_coder/main.py,sha256=
|
|
8
|
+
jarvis/jarvis_coder/main.py,sha256=WZCjtlPDEvg2y6F6e4djc4xYWXM3eB_0pHrPpvlZEC4,23890
|
|
9
9
|
jarvis/jarvis_rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
jarvis/jarvis_rag/main.py,sha256=drCH9KmwQozxtPICIfTFXmkIhwN8WDreMOCTxtj9SPc,20842
|
|
11
11
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -26,14 +26,14 @@ jarvis/tools/coder.py,sha256=kmotT2Klsug44S51QoSW9DzkxLzcF-XonyYAEoWZV6c,2295
|
|
|
26
26
|
jarvis/tools/file_ops.py,sha256=h8g0eT9UvlJf4kt0DLXvdSsjcPj7x19lxWdDApeDfpg,3842
|
|
27
27
|
jarvis/tools/generator.py,sha256=S1DhHBfhNvF6SrORnlk8Mz210yDiJPuxbfswbX_UACs,5791
|
|
28
28
|
jarvis/tools/methodology.py,sha256=UG6s5VYRcd9wrKX4cg6f7zJhet5AIcthFGMOAdevBiw,5175
|
|
29
|
-
jarvis/tools/registry.py,sha256=
|
|
29
|
+
jarvis/tools/registry.py,sha256=sgj5EVbRgfHSzXW5v-kbIZS_8cwAxTjHvSPAicxBRf4,9074
|
|
30
30
|
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.82.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
35
|
+
jarvis_ai_assistant-0.1.82.dist-info/METADATA,sha256=7q-f_Dj2WkdsTrResm6GqTFCIe7McMaZDYO3Rpr_2Ls,12736
|
|
36
|
+
jarvis_ai_assistant-0.1.82.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
37
|
+
jarvis_ai_assistant-0.1.82.dist-info/entry_points.txt,sha256=sdmIO86MrIUepJTGyHs0i_Ho9VGf1q9YRP4RgQvGWcI,280
|
|
38
|
+
jarvis_ai_assistant-0.1.82.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
39
|
+
jarvis_ai_assistant-0.1.82.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{jarvis_ai_assistant-0.1.80.dist-info → jarvis_ai_assistant-0.1.82.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|