jarvis-ai-assistant 0.1.138__tar.gz → 0.1.141__tar.gz
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_ai_assistant-0.1.138/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.141}/PKG-INFO +4 -4
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/README.md +1 -1
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/pyproject.toml +7 -7
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/setup.py +7 -20
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/__init__.py +1 -1
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/__init__.py +62 -14
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/builtin_input_handler.py +4 -14
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/main.py +1 -1
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/patch.py +37 -40
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/shell_input_handler.py +2 -3
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_code_agent/code_agent.py +23 -30
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/__init__.py +3 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/c_cpp.py +50 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/csharp.py +75 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/data_format.py +82 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/devops.py +107 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/docs.py +87 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/go.py +52 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/infrastructure.py +98 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/java.py +66 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/javascript.py +73 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/kotlin.py +107 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/loader.py +76 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/php.py +77 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/python.py +56 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/ruby.py +107 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/rust.py +58 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/shell.py +75 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/sql.py +72 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/swift.py +77 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/checklists/web.py +97 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_code_analysis/code_review.py +660 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_dev/main.py +61 -88
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_git_squash/main.py +3 -3
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_git_utils/git_commiter.py +242 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_init/main.py +62 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_platform/base.py +4 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_platform/kimi.py +173 -5
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_platform/openai.py +3 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_platform/registry.py +1 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_platform/yuanbao.py +530 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/ask_codebase.py +6 -9
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/ask_user.py +17 -5
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/base.py +3 -1
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/chdir.py +1 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/create_code_agent.py +4 -3
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/create_sub_agent.py +1 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_tools/execute_script.py +170 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_tools/file_analyzer.py +133 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_tools/file_operation.py +245 -0
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/find_methodolopy.py → jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_tools/find_methodology.py +2 -1
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/lsp_get_diagnostics.py +2 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/methodology.py +11 -11
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/read_code.py +2 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_tools/read_webpage.py +63 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/registry.py +68 -131
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/search_web.py +14 -6
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_tools/virtual_tty.py +399 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_utils/config.py +29 -3
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_utils/embedding.py +184 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_utils/file_processors.py +343 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_utils/input.py +0 -1
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_utils/methodology.py +178 -0
- jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_utils/utils.py +352 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141/src/jarvis_ai_assistant.egg-info}/PKG-INFO +4 -4
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +28 -19
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis_ai_assistant.egg-info/entry_points.txt +4 -4
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis_ai_assistant.egg-info/requires.txt +2 -2
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_code_agent/file_select.py +0 -202
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_platform/ai8.py +0 -268
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_platform/ollama.py +0 -137
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_platform/oyi.py +0 -307
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_platform/yuanbao.py +0 -260
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_rag/file_processors.py +0 -138
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_rag/main.py +0 -1734
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/code_review.py +0 -333
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/execute_python_script.py +0 -58
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/execute_shell.py +0 -97
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/execute_shell_script.py +0 -58
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/file_analyzer.py +0 -282
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/file_operation.py +0 -177
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/find_caller.py +0 -278
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/find_symbol.py +0 -295
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/function_analyzer.py +0 -331
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/git_commiter.py +0 -167
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/project_analyzer.py +0 -304
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/rag.py +0 -143
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/read_webpage.py +0 -226
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_tools/tool_generator.py +0 -221
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_utils/embedding.py +0 -501
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_utils/methodology.py +0 -519
- jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_utils/utils.py +0 -154
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/MANIFEST.in +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/setup.cfg +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/file_input_handler.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/jarvis.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/output_handler.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_git_details/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_git_details/main.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_git_squash/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_platform_manager → jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_init}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_lsp/base.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_lsp/cpp.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_lsp/go.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_lsp/python.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_lsp/registry.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_lsp/rust.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_methodology/main.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_multi_agent/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_multi_agent/main.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_platform/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138/src/jarvis/jarvis_rag → jarvis_ai_assistant-0.1.141/src/jarvis/jarvis_platform_manager}/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_platform_manager/main.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_platform_manager/openai_test.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_smart_shell/main.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_tools/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_utils/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_utils/git_utils.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_utils/globals.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_utils/output.py +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
- {jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jarvis-ai-assistant
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.141
|
|
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
|
|
@@ -45,7 +45,6 @@ Requires-Dist: pyyaml>=5.1
|
|
|
45
45
|
Requires-Dist: colorama>=0.4.6
|
|
46
46
|
Requires-Dist: prompt_toolkit>=3.0.0
|
|
47
47
|
Requires-Dist: openai>=1.20.0
|
|
48
|
-
Requires-Dist: playwright>=1.41.1
|
|
49
48
|
Requires-Dist: numpy>=1.19.5
|
|
50
49
|
Requires-Dist: faiss-cpu>=1.8.0
|
|
51
50
|
Requires-Dist: sentence-transformers>=2.2.2
|
|
@@ -55,7 +54,7 @@ Requires-Dist: python-docx>=0.8.11
|
|
|
55
54
|
Requires-Dist: tiktoken>=0.3.0
|
|
56
55
|
Requires-Dist: tqdm>=4.65.0
|
|
57
56
|
Requires-Dist: docx>=0.2.4
|
|
58
|
-
Requires-Dist: yaspin>=2.
|
|
57
|
+
Requires-Dist: yaspin>=2.4.0
|
|
59
58
|
Requires-Dist: rich>=13.3.1
|
|
60
59
|
Requires-Dist: pygments>=2.15.0
|
|
61
60
|
Requires-Dist: fuzzywuzzy>=0.18.0
|
|
@@ -66,6 +65,7 @@ Requires-Dist: fastapi>=0.115.4
|
|
|
66
65
|
Requires-Dist: uvicorn>=0.33.0
|
|
67
66
|
Requires-Dist: python-pptx>=1.0.0
|
|
68
67
|
Requires-Dist: pandas>=2.0.0
|
|
68
|
+
Requires-Dist: html2text>=2024.2.26
|
|
69
69
|
Provides-Extra: dev
|
|
70
70
|
Requires-Dist: pytest; extra == "dev"
|
|
71
71
|
Requires-Dist: black; extra == "dev"
|
|
@@ -165,7 +165,7 @@ jarvis-ask-codebase --help
|
|
|
165
165
|
|----------|------|
|
|
166
166
|
| read_code | 支持行号和范围的代码文件读取 |
|
|
167
167
|
| execute_shell | 执行系统命令并捕获输出 |
|
|
168
|
-
|
|
|
168
|
+
| execute_script | 执行脚本并返回结果,支持Shell命令、Shell脚本和Python脚本 |
|
|
169
169
|
| ask_codebase | 智能代码库查询和分析,用于定位功能所在文件和理解单点实现,适合查询特定功能位置和实现原理 |
|
|
170
170
|
| ask_user | 交互式用户输入收集 |
|
|
171
171
|
| file_operation | 基础文件操作(读取/写入/存在性检查) |
|
|
@@ -91,7 +91,7 @@ jarvis-ask-codebase --help
|
|
|
91
91
|
|----------|------|
|
|
92
92
|
| read_code | 支持行号和范围的代码文件读取 |
|
|
93
93
|
| execute_shell | 执行系统命令并捕获输出 |
|
|
94
|
-
|
|
|
94
|
+
| execute_script | 执行脚本并返回结果,支持Shell命令、Shell脚本和Python脚本 |
|
|
95
95
|
| ask_codebase | 智能代码库查询和分析,用于定位功能所在文件和理解单点实现,适合查询特定功能位置和实现原理 |
|
|
96
96
|
| ask_user | 交互式用户输入收集 |
|
|
97
97
|
| file_operation | 基础文件操作(读取/写入/存在性检查) |
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "jarvis-ai-assistant"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.141"
|
|
8
8
|
description = "Jarvis: An AI assistant that uses tools to interact with the system"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "skyfire", email = "skyfireitdiy@hotmail.com" }]
|
|
@@ -27,7 +27,6 @@ dependencies = [
|
|
|
27
27
|
"colorama>=0.4.6",
|
|
28
28
|
"prompt_toolkit>=3.0.0",
|
|
29
29
|
"openai>=1.20.0",
|
|
30
|
-
"playwright>=1.41.1",
|
|
31
30
|
"numpy>=1.19.5",
|
|
32
31
|
"faiss-cpu>=1.8.0",
|
|
33
32
|
"sentence-transformers>=2.2.2",
|
|
@@ -37,7 +36,7 @@ dependencies = [
|
|
|
37
36
|
"tiktoken>=0.3.0",
|
|
38
37
|
"tqdm>=4.65.0",
|
|
39
38
|
"docx>=0.2.4",
|
|
40
|
-
"yaspin>=2.
|
|
39
|
+
"yaspin>=2.4.0",
|
|
41
40
|
"rich>=13.3.1",
|
|
42
41
|
"pygments>=2.15.0",
|
|
43
42
|
"fuzzywuzzy>=0.18.0",
|
|
@@ -48,6 +47,7 @@ dependencies = [
|
|
|
48
47
|
"uvicorn>=0.33.0",
|
|
49
48
|
"python-pptx>=1.0.0",
|
|
50
49
|
"pandas>=2.0.0",
|
|
50
|
+
"html2text>=2024.2.26",
|
|
51
51
|
]
|
|
52
52
|
requires-python = ">=3.8"
|
|
53
53
|
|
|
@@ -61,13 +61,12 @@ Homepage = "https://github.com/skyfireitdiy/Jarvis"
|
|
|
61
61
|
jarvis = "jarvis.jarvis_agent.jarvis:main"
|
|
62
62
|
jarvis-code-agent = "jarvis.jarvis_code_agent.code_agent:main"
|
|
63
63
|
jca = "jarvis.jarvis_code_agent.code_agent:main"
|
|
64
|
-
jarvis-rag = "jarvis.jarvis_rag.main:main"
|
|
65
64
|
jarvis-smart-shell = "jarvis.jarvis_smart_shell.main:main"
|
|
66
65
|
jss = "jarvis.jarvis_smart_shell.main:main"
|
|
67
66
|
jarvis-platform-manager = "jarvis.jarvis_platform_manager.main:main"
|
|
68
|
-
jarvis-git-commit = "jarvis.
|
|
69
|
-
jarvis-code-review = "jarvis.
|
|
70
|
-
jgc = "jarvis.
|
|
67
|
+
jarvis-git-commit = "jarvis.jarvis_git_utils.git_commiter:main"
|
|
68
|
+
jarvis-code-review = "jarvis.jarvis_code_analysis.code_review:main"
|
|
69
|
+
jgc = "jarvis.jarvis_git_utils.git_commiter:main"
|
|
71
70
|
jarvis-dev = "jarvis.jarvis_dev.main:main"
|
|
72
71
|
jarvis-git-squash = "jarvis.jarvis_git_squash.main:main"
|
|
73
72
|
jarvis-multi-agent = "jarvis.jarvis_multi_agent.main:main"
|
|
@@ -76,3 +75,4 @@ jarvis-tool = "jarvis.jarvis_tools.registry:main"
|
|
|
76
75
|
jarvis-ask-codebase = "jarvis.jarvis_tools.ask_codebase:main"
|
|
77
76
|
jarvis-git-details = "jarvis.jarvis_git_details.main:main"
|
|
78
77
|
jarvis-methodology = "jarvis.jarvis_methodology.main:main"
|
|
78
|
+
jarvis-init = "jarvis.jarvis_init.main:main"
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
from setuptools import setup, find_packages
|
|
2
|
-
from setuptools.command.install import install
|
|
3
|
-
import subprocess
|
|
4
|
-
|
|
5
|
-
# 自定义安装命令
|
|
6
|
-
class CustomInstallCommand(install):
|
|
7
|
-
def run(self):
|
|
8
|
-
# 先运行默认的安装逻辑
|
|
9
|
-
install.run(self)
|
|
10
|
-
# 安装完成后执行 playwright install
|
|
11
|
-
subprocess.check_call(["playwright", "install"])
|
|
12
2
|
|
|
13
3
|
setup(
|
|
14
4
|
name="jarvis-ai-assistant",
|
|
15
|
-
version="0.1.
|
|
5
|
+
version="0.1.141",
|
|
16
6
|
author="skyfire",
|
|
17
7
|
author_email="skyfireitdiy@hotmail.com",
|
|
18
8
|
description="An AI assistant that uses various tools to interact with the system",
|
|
@@ -28,7 +18,6 @@ setup(
|
|
|
28
18
|
"colorama>=0.4.6",
|
|
29
19
|
"prompt_toolkit>=3.0.0",
|
|
30
20
|
"openai>=1.20.0",
|
|
31
|
-
"playwright>=1.41.1",
|
|
32
21
|
"numpy>=1.19.5",
|
|
33
22
|
"faiss-cpu>=1.8.0",
|
|
34
23
|
"sentence-transformers>=2.2.2",
|
|
@@ -38,7 +27,7 @@ setup(
|
|
|
38
27
|
"tiktoken>=0.3.0",
|
|
39
28
|
"tqdm>=4.65.0",
|
|
40
29
|
"docx>=0.2.4",
|
|
41
|
-
"yaspin>=2.
|
|
30
|
+
"yaspin>=2.4.0",
|
|
42
31
|
"rich>=13.3.1",
|
|
43
32
|
"pygments>=2.15.0",
|
|
44
33
|
"fuzzywuzzy>=0.18.0",
|
|
@@ -49,19 +38,19 @@ setup(
|
|
|
49
38
|
"uvicorn>=0.33.0",
|
|
50
39
|
"python-pptx>=1.0.0",
|
|
51
40
|
"pandas>=2.0.0",
|
|
41
|
+
"html2text>=2024.2.26",
|
|
52
42
|
],
|
|
53
43
|
entry_points={
|
|
54
44
|
"console_scripts": [
|
|
55
45
|
"jarvis=jarvis.jarvis_agent.jarvis:main",
|
|
56
46
|
"jarvis-code-agent=jarvis.jarvis_code_agent.code_agent:main",
|
|
57
47
|
"jca=jarvis.jarvis_code_agent.code_agent:main",
|
|
58
|
-
"jarvis-rag=jarvis.jarvis_rag.main:main",
|
|
59
48
|
"jarvis-smart-shell=jarvis.jarvis_smart_shell.main:main",
|
|
60
49
|
"jss=jarvis.jarvis_smart_shell.main:main",
|
|
61
50
|
"jarvis-platform-manager=jarvis.jarvis_platform_manager.main:main",
|
|
62
|
-
"jarvis-
|
|
63
|
-
"jarvis-
|
|
64
|
-
"jgc=jarvis.
|
|
51
|
+
"jarvis-code-review=jarvis.jarvis_code_analysis.code_review:main",
|
|
52
|
+
"jarvis-git-commit=jarvis.jarvis_git_utils.git_commiter:main",
|
|
53
|
+
"jgc=jarvis.jarvis_git_utils.git_commiter:main",
|
|
65
54
|
"jarvis-dev=jarvis.jarvis_dev.main:main",
|
|
66
55
|
"jarvis-git-squash=jarvis.jarvis_git_squash.main:main",
|
|
67
56
|
"jarvis-multi-agent=jarvis.jarvis_multi_agent.main:main",
|
|
@@ -70,6 +59,7 @@ setup(
|
|
|
70
59
|
"jarvis-ask-codebase=jarvis.jarvis_tools.ask_codebase:main",
|
|
71
60
|
"jarvis-git-details=jarvis.jarvis_git_details.main:main",
|
|
72
61
|
"jarvis-methodology=jarvis.jarvis_methodology.main:main",
|
|
62
|
+
"jarvis-init=jarvis.jarvis_init.main:main",
|
|
73
63
|
],
|
|
74
64
|
},
|
|
75
65
|
python_requires=">=3.8",
|
|
@@ -84,7 +74,4 @@ setup(
|
|
|
84
74
|
"Programming Language :: Python :: 3.10",
|
|
85
75
|
"Programming Language :: Python :: 3.11",
|
|
86
76
|
],
|
|
87
|
-
cmdclass={
|
|
88
|
-
'install': CustomInstallCommand, # 注册自定义安装命令
|
|
89
|
-
},
|
|
90
77
|
)
|
{jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/__init__.py
RENAMED
|
@@ -9,7 +9,7 @@ from jarvis.jarvis_platform.base import BasePlatform
|
|
|
9
9
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
10
10
|
from jarvis.jarvis_utils.output import PrettyOutput, OutputType
|
|
11
11
|
from jarvis.jarvis_utils.embedding import get_context_token_count
|
|
12
|
-
from jarvis.jarvis_utils.config import is_auto_complete, is_execute_tool_confirm
|
|
12
|
+
from jarvis.jarvis_utils.config import get_max_tool_call_count, is_auto_complete, is_execute_tool_confirm
|
|
13
13
|
from jarvis.jarvis_utils.methodology import load_methodology
|
|
14
14
|
from jarvis.jarvis_utils.globals import make_agent_name, set_agent, delete_agent
|
|
15
15
|
from jarvis.jarvis_utils.input import get_multiline_input
|
|
@@ -153,7 +153,6 @@ class Agent:
|
|
|
153
153
|
auto_complete: Optional[bool] = None,
|
|
154
154
|
output_handler: List[OutputHandler] = [],
|
|
155
155
|
input_handler: Optional[List[Callable[[str, Any], Tuple[str, bool]]]] = None,
|
|
156
|
-
max_context_length: Optional[int] = None,
|
|
157
156
|
execute_tool_confirm: Optional[bool] = None,
|
|
158
157
|
need_summary: bool = True,
|
|
159
158
|
multiline_inputer: Optional[Callable[[str], str]] = None):
|
|
@@ -205,6 +204,9 @@ class Agent:
|
|
|
205
204
|
# Load configuration from environment variables
|
|
206
205
|
self.addon_prompt = ""
|
|
207
206
|
|
|
207
|
+
self.tool_call_count = 0
|
|
208
|
+
self.max_tool_call_count = get_max_tool_call_count()
|
|
209
|
+
|
|
208
210
|
|
|
209
211
|
self.execute_tool_confirm = execute_tool_confirm if execute_tool_confirm is not None else is_execute_tool_confirm()
|
|
210
212
|
|
|
@@ -219,7 +221,7 @@ class Agent:
|
|
|
219
221
|
请使用简洁的要点描述,突出重要信息。
|
|
220
222
|
"""
|
|
221
223
|
|
|
222
|
-
self.max_token_count =
|
|
224
|
+
self.max_token_count = get_max_token_count()
|
|
223
225
|
self.auto_complete = auto_complete if auto_complete is not None else is_auto_complete()
|
|
224
226
|
welcome_message = f"{name} 初始化完成 - 使用 {self.model.name()} 模型"
|
|
225
227
|
|
|
@@ -299,6 +301,8 @@ class Agent:
|
|
|
299
301
|
- 必须包含参数和说明
|
|
300
302
|
- 操作结束需等待结果
|
|
301
303
|
- 如果判断任务已经完成,不必输出操作
|
|
304
|
+
- 如果信息不明确,请请求用户补充
|
|
305
|
+
- 如果执行过程中连续失败5次,请使用ask_user询问用户操作
|
|
302
306
|
|
|
303
307
|
**可用操作列表:**
|
|
304
308
|
{action_handlers}
|
|
@@ -368,16 +372,48 @@ class Agent:
|
|
|
368
372
|
|
|
369
373
|
with yaspin(text="正在总结对话历史...", color="cyan") as spinner:
|
|
370
374
|
|
|
371
|
-
prompt = """
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
375
|
+
prompt = """请详细总结之前对话中的关键信息,生成一个全面而精确的对话摘要,包括以下方面:
|
|
376
|
+
|
|
377
|
+
1. 任务目标与需求:
|
|
378
|
+
- 用户最初提出的核心问题或任务
|
|
379
|
+
- 任务的预期结果和成功标准
|
|
380
|
+
- 用户明确强调的任何特殊要求或限制条件
|
|
381
|
+
|
|
382
|
+
2. 背景与上下文信息:
|
|
383
|
+
- 问题的业务或技术背景
|
|
384
|
+
- 相关系统、平台或环境的信息
|
|
385
|
+
- 已知的约束条件或依赖关系
|
|
386
|
+
|
|
387
|
+
3. 已获取的关键信息:
|
|
388
|
+
- 用户确认的重要事实
|
|
389
|
+
- 收集到的相关数据或状态
|
|
390
|
+
- 已验证的系统参数或配置
|
|
391
|
+
|
|
392
|
+
4. 问题分析与诊断:
|
|
393
|
+
- 已识别的根本原因(针对问题诊断任务)
|
|
394
|
+
- 关键的技术细节或错误信息
|
|
395
|
+
- 排除的可能性和已验证的假设
|
|
396
|
+
|
|
397
|
+
5. 解决方案进展:
|
|
398
|
+
- 已尝试的方法及其结果
|
|
399
|
+
- 成功实施的步骤
|
|
400
|
+
- 失败的尝试及原因
|
|
401
|
+
- 用户对解决方案的反馈
|
|
378
402
|
|
|
379
|
-
|
|
380
|
-
|
|
403
|
+
6. 当前状态:
|
|
404
|
+
- 任务完成的程度
|
|
405
|
+
- 当前遇到的障碍或挑战
|
|
406
|
+
- 下一步需要解决的问题
|
|
407
|
+
|
|
408
|
+
7. 决策记录:
|
|
409
|
+
- 做出的关键决策及其理由
|
|
410
|
+
- 用户表达的偏好
|
|
411
|
+
- 关键的选择点及选择依据
|
|
412
|
+
|
|
413
|
+
请以结构化方式组织信息,使用明确的段落和要点,确保新的对话能无缝继续。摘要应该足够详细,以便于在没有完整历史记录的情况下理解任务全貌和当前进展。
|
|
414
|
+
|
|
415
|
+
注意:保留专业术语和技术细节,但不要包含无关的对话内容或冗长的代码片段。
|
|
416
|
+
"""
|
|
381
417
|
|
|
382
418
|
try:
|
|
383
419
|
with spinner.hidden():
|
|
@@ -395,7 +431,7 @@ class Agent:
|
|
|
395
431
|
|
|
396
432
|
{summary}
|
|
397
433
|
|
|
398
|
-
|
|
434
|
+
请基于以上信息继续完成任务。请注意,这是之前对话的摘要,上下文长度已超过限制而被重置。请直接继续任务,无需重复已完成的步骤。如有需要,可以询问用户以获取更多信息。
|
|
399
435
|
"""
|
|
400
436
|
except Exception as e:
|
|
401
437
|
spinner.text = "总结对话历史失败"
|
|
@@ -427,14 +463,23 @@ class Agent:
|
|
|
427
463
|
return False, f"操作失败:检测到多个操作。一次只能执行一个操作。尝试执行的操作:{', '.join([handler.name() for handler in tool_list])}"
|
|
428
464
|
if len(tool_list) == 0:
|
|
429
465
|
return False, ""
|
|
466
|
+
if self.tool_call_count >= self.max_tool_call_count:
|
|
467
|
+
if user_confirm(f"工具调用次数超过限制,是否继续执行?", True):
|
|
468
|
+
self.reset_tool_call_count()
|
|
469
|
+
else:
|
|
470
|
+
return False, ""
|
|
430
471
|
if not self.execute_tool_confirm or user_confirm(f"需要执行{tool_list[0].name()}确认执行?", True):
|
|
431
472
|
with yaspin(text=f"正在执行{tool_list[0].name()}...", color="cyan") as spinner:
|
|
432
473
|
with spinner.hidden():
|
|
433
474
|
result = tool_list[0].handle(response, self)
|
|
434
475
|
spinner.text = f"{tool_list[0].name()}执行完成"
|
|
435
476
|
spinner.ok("✅")
|
|
477
|
+
self.tool_call_count += 1
|
|
436
478
|
return result
|
|
437
479
|
return False, ""
|
|
480
|
+
|
|
481
|
+
def reset_tool_call_count(self):
|
|
482
|
+
self.tool_call_count = 0
|
|
438
483
|
|
|
439
484
|
|
|
440
485
|
def _complete_task(self) -> str:
|
|
@@ -489,6 +534,7 @@ class Agent:
|
|
|
489
534
|
|
|
490
535
|
方法论格式:
|
|
491
536
|
{ot("TOOL_CALL")}
|
|
537
|
+
want: 添加/更新xxxx的方法论
|
|
492
538
|
name: methodology
|
|
493
539
|
arguments:
|
|
494
540
|
operation: add/update
|
|
@@ -541,7 +587,7 @@ arguments:
|
|
|
541
587
|
self.prompt = f"{user_input}"
|
|
542
588
|
|
|
543
589
|
if self.first:
|
|
544
|
-
self.prompt = f"{user_input}\n\n{load_methodology(user_input)}"
|
|
590
|
+
self.prompt = f"{user_input}\n\n以下是历史类似问题的执行经验,可参考:\n{load_methodology(user_input)}"
|
|
545
591
|
self.first = False
|
|
546
592
|
|
|
547
593
|
while True:
|
|
@@ -562,6 +608,8 @@ arguments:
|
|
|
562
608
|
|
|
563
609
|
if self.auto_complete and ot("!!!COMPLETE!!!") in current_response:
|
|
564
610
|
return self._complete_task()
|
|
611
|
+
|
|
612
|
+
self.reset_tool_call_count()
|
|
565
613
|
|
|
566
614
|
# 获取用户输入
|
|
567
615
|
user_input = self.multiline_inputer(f"{self.name}: 请输入,或输入空行来结束当前任务:")
|
|
@@ -40,24 +40,14 @@ def builtin_input_handler(user_input: str, agent: Any) -> Tuple[str, bool]:
|
|
|
40
40
|
"""
|
|
41
41
|
elif tag == "Web":
|
|
42
42
|
user_input = user_input.replace(f"'<{tag}>'", "")
|
|
43
|
-
|
|
43
|
+
agent.set_addon_prompt("""
|
|
44
44
|
请使用search_web工具进行网页搜索,可以使用的提问格式包括:
|
|
45
45
|
1. xxx技术的最新发展是什么?
|
|
46
46
|
2. xxx框架的官方文档在哪里?
|
|
47
47
|
3. xxx库的GitHub仓库地址是什么?
|
|
48
48
|
4. xxx问题的解决方案有哪些?
|
|
49
49
|
5. xxx概念的详细解释是什么?
|
|
50
|
-
"""
|
|
51
|
-
elif tag == "RAG":
|
|
52
|
-
user_input = user_input.replace(f"'<{tag}>'", "")
|
|
53
|
-
user_input += """
|
|
54
|
-
请使用rag工具进行知识库检索,可以使用的提问格式包括:
|
|
55
|
-
1. 关于xxx的知识点有哪些?
|
|
56
|
-
2. xxx的最佳实践是什么?
|
|
57
|
-
3. xxx的实现方案有哪些?
|
|
58
|
-
4. xxx的相关案例有哪些?
|
|
59
|
-
5. xxx的技术细节是什么?
|
|
60
|
-
"""
|
|
50
|
+
""")
|
|
61
51
|
elif tag == "Summary":
|
|
62
52
|
user_input = user_input.replace(f"'<{tag}>'", "")
|
|
63
53
|
agent._summarize_and_clear_history()
|
|
@@ -70,14 +60,14 @@ def builtin_input_handler(user_input: str, agent: Any) -> Tuple[str, bool]:
|
|
|
70
60
|
return "", True
|
|
71
61
|
elif tag == "Methodology":
|
|
72
62
|
user_input = user_input.replace(f"'<{tag}>'", "")
|
|
73
|
-
|
|
63
|
+
agent.set_addon_prompt("""
|
|
74
64
|
请使用find_methodology工具查找相关方法论,可以使用的提问格式包括:
|
|
75
65
|
1. 关于xxx的方法论有哪些?
|
|
76
66
|
2. 如何解决xxx问题?
|
|
77
67
|
3. xxx的最佳实践是什么?
|
|
78
68
|
4. 处理xxx的标准流程是什么?
|
|
79
69
|
5. 实现xxx的参考方案有哪些?
|
|
80
|
-
"""
|
|
70
|
+
""")
|
|
81
71
|
# 移除对未知标记的警告输出
|
|
82
72
|
|
|
83
73
|
return user_input, False
|
|
@@ -61,7 +61,7 @@ def main():
|
|
|
61
61
|
user_input = get_multiline_input("请输入你的任务(输入空行退出):")
|
|
62
62
|
if not user_input:
|
|
63
63
|
break
|
|
64
|
-
agent.set_addon_prompt("
|
|
64
|
+
agent.set_addon_prompt("如果有必要,请先指定出行动计划,然后根据计划一步步执行,如果任务过于复杂,可以拆分子Agent进行执行,拆的子Agent需要掌握所有必要的任务信息,否则无法执行")
|
|
65
65
|
agent.run(user_input)
|
|
66
66
|
except Exception as e:
|
|
67
67
|
PrettyOutput.print(f"错误: {str(e)}", OutputType.ERROR)
|
{jarvis_ai_assistant-0.1.138 → jarvis_ai_assistant-0.1.141}/src/jarvis/jarvis_agent/patch.py
RENAMED
|
@@ -7,7 +7,7 @@ from yaspin import yaspin
|
|
|
7
7
|
from jarvis.jarvis_agent.output_handler import OutputHandler
|
|
8
8
|
from jarvis.jarvis_platform.base import BasePlatform
|
|
9
9
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
10
|
-
from jarvis.
|
|
10
|
+
from jarvis.jarvis_git_utils.git_commiter import GitCommitTool
|
|
11
11
|
from jarvis.jarvis_tools.file_operation import FileOperationTool
|
|
12
12
|
from jarvis.jarvis_utils.config import is_confirm_before_apply_patch
|
|
13
13
|
from jarvis.jarvis_utils.git_utils import get_commits_between, get_latest_commit_hash
|
|
@@ -25,7 +25,7 @@ class PatchOutputHandler(OutputHandler):
|
|
|
25
25
|
return False, apply_patch(response, agent)
|
|
26
26
|
|
|
27
27
|
def can_handle(self, response: str) -> bool:
|
|
28
|
-
if
|
|
28
|
+
if _has_patch_block(response):
|
|
29
29
|
return True
|
|
30
30
|
return False
|
|
31
31
|
|
|
@@ -42,7 +42,7 @@ class PatchOutputHandler(OutputHandler):
|
|
|
42
42
|
{ot("PATCH")}
|
|
43
43
|
File: [文件路径]
|
|
44
44
|
Reason: [修改原因]
|
|
45
|
-
[
|
|
45
|
+
[代码修改说明,不用输出完整的代码,仅输出修改的片段即可]
|
|
46
46
|
{ct("PATCH")}
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -96,9 +96,14 @@ def add(a, b):
|
|
|
96
96
|
- 每个文件的修改是独立的,不能出现“参照xxx文件的修改”这样的描述
|
|
97
97
|
- 不要出现未实现的代码,如:TODO
|
|
98
98
|
"""
|
|
99
|
+
|
|
100
|
+
def _has_patch_block(patch_str: str) -> bool:
|
|
101
|
+
"""判断是否存在补丁块"""
|
|
102
|
+
return re.search(ot("PATCH")+r'\n?(.*?)\n?' +
|
|
103
|
+
ct("PATCH"), patch_str, re.DOTALL) is not None
|
|
99
104
|
|
|
100
105
|
|
|
101
|
-
def _parse_patch(patch_str: str) -> Dict[str, str]:
|
|
106
|
+
def _parse_patch(patch_str: str) -> Tuple[Dict[str, str], str]:
|
|
102
107
|
"""解析新的上下文补丁格式"""
|
|
103
108
|
result = {}
|
|
104
109
|
patches = re.findall(ot("PATCH")+r'\n?(.*?)\n?' +
|
|
@@ -108,24 +113,33 @@ def _parse_patch(patch_str: str) -> Dict[str, str]:
|
|
|
108
113
|
first_line = patch.splitlines()[0]
|
|
109
114
|
sm = re.match(r'^File:\s*(.+)$', first_line)
|
|
110
115
|
if not sm:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
return ({}, f"""无效的补丁格式,正确格式应该为:
|
|
117
|
+
{ot("PATCH")}
|
|
118
|
+
File: [文件路径]
|
|
119
|
+
Reason: [修改原因]
|
|
120
|
+
[代码修改说明,不用输出完整的代码,仅输出修改的片段即可]
|
|
121
|
+
{ct("PATCH")}""")
|
|
122
|
+
filepath = os.path.abspath(sm.group(1).strip())
|
|
114
123
|
if filepath not in result:
|
|
115
124
|
result[filepath] = patch
|
|
116
125
|
else:
|
|
117
126
|
result[filepath] += "\n\n" + patch
|
|
118
|
-
return result
|
|
127
|
+
return result, ""
|
|
119
128
|
|
|
120
129
|
|
|
121
130
|
def apply_patch(output_str: str, agent: Any) -> str:
|
|
122
131
|
"""Apply patches to files"""
|
|
123
132
|
with yaspin(text="正在应用补丁...", color="cyan") as spinner:
|
|
124
133
|
try:
|
|
125
|
-
patches = _parse_patch(output_str)
|
|
134
|
+
patches, error_msg = _parse_patch(output_str)
|
|
135
|
+
if error_msg:
|
|
136
|
+
spinner.text = "补丁格式错误"
|
|
137
|
+
spinner.fail("❌")
|
|
138
|
+
return error_msg
|
|
126
139
|
except Exception as e:
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
spinner.text = "解析补丁失败"
|
|
141
|
+
spinner.fail("❌")
|
|
142
|
+
return f"解析补丁失败: {str(e)}"
|
|
129
143
|
|
|
130
144
|
# 获取当前提交hash作为起始点
|
|
131
145
|
spinner.text = "开始获取当前提交hash..."
|
|
@@ -134,7 +148,8 @@ def apply_patch(output_str: str, agent: Any) -> str:
|
|
|
134
148
|
|
|
135
149
|
not_read_file = [f for f in patches.keys() if not has_read_file(f)]
|
|
136
150
|
if not_read_file:
|
|
137
|
-
|
|
151
|
+
spinner.text=f"以下文件未读取: {not_read_file},应用补丁存在风险,将先读取文件后再生成补丁"
|
|
152
|
+
spinner.fail("❌")
|
|
138
153
|
return f"以下文件未读取: {not_read_file},应用补丁存在风险,请先读取文件后再生成补丁"
|
|
139
154
|
|
|
140
155
|
# 按文件逐个处理
|
|
@@ -182,9 +197,9 @@ def apply_patch(output_str: str, agent: Any) -> str:
|
|
|
182
197
|
|
|
183
198
|
# 增加代码变更分析和错误提示
|
|
184
199
|
|
|
185
|
-
addon_prompt =
|
|
186
|
-
addon_prompt += "2.
|
|
187
|
-
addon_prompt += "3.
|
|
200
|
+
addon_prompt = "1. 请调用静态检查工具(如有)检查以上变更是否引入了潜在错误\n"
|
|
201
|
+
addon_prompt += "2. 如果发现致命的代码错误,请立即开始修复\n"
|
|
202
|
+
addon_prompt += "3. 如果发现性能、风格等问题,要询问用户是否需要立即修复\n"
|
|
188
203
|
addon_prompt += "\n\n"
|
|
189
204
|
addon_prompt += "如果没有问题,请继续进行下一步修改\n"
|
|
190
205
|
addon_prompt += f"如果用户的需求已经完成,请终止,不要输出新的 {ot('PATCH')},不要实现任何超出用户需求外的内容\n"
|
|
@@ -292,12 +307,11 @@ def handle_small_code_operation(filepath: str, patch_content: str) -> bool:
|
|
|
292
307
|
"""处理基于上下文的代码片段"""
|
|
293
308
|
with yaspin(text=f"正在修改文件 {filepath}...", color="cyan") as spinner:
|
|
294
309
|
try:
|
|
310
|
+
model = PlatformRegistry().get_normal_platform()
|
|
295
311
|
with spinner.hidden():
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
spinner.write("❌ 文件读取失败")
|
|
300
|
-
return False
|
|
312
|
+
model.upload_files([filepath])
|
|
313
|
+
|
|
314
|
+
model.set_suppress_output(False)
|
|
301
315
|
|
|
302
316
|
prompt = f"""
|
|
303
317
|
# 代码合并专家指南
|
|
@@ -305,12 +319,6 @@ def handle_small_code_operation(filepath: str, patch_content: str) -> bool:
|
|
|
305
319
|
## 任务描述
|
|
306
320
|
你是一位精确的代码审查与合并专家,需要将补丁内容与原始代码智能合并。
|
|
307
321
|
|
|
308
|
-
## 输入资料
|
|
309
|
-
### 原始代码
|
|
310
|
-
```
|
|
311
|
-
{old_file_content["stdout"]}
|
|
312
|
-
```
|
|
313
|
-
|
|
314
322
|
### 补丁内容
|
|
315
323
|
```
|
|
316
324
|
{patch_content}
|
|
@@ -334,8 +342,7 @@ def handle_small_code_operation(filepath: str, patch_content: str) -> bool:
|
|
|
334
342
|
[合并后的完整代码,包括所有空行和缩进]
|
|
335
343
|
{ct("MERGED_CODE")}
|
|
336
344
|
"""
|
|
337
|
-
|
|
338
|
-
model.set_suppress_output(False)
|
|
345
|
+
|
|
339
346
|
count = 30
|
|
340
347
|
start_line = -1
|
|
341
348
|
end_line = -1
|
|
@@ -397,12 +404,8 @@ def handle_large_code_operation(filepath: str, patch_content: str, model: BasePl
|
|
|
397
404
|
with yaspin(text=f"正在处理文件 {filepath}...", color="cyan") as spinner:
|
|
398
405
|
try:
|
|
399
406
|
# 读取原始文件内容
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
if not old_file_content["success"]:
|
|
403
|
-
spinner.text = "文件读取失败"
|
|
404
|
-
spinner.fail("❌")
|
|
405
|
-
return False
|
|
407
|
+
with spinner.hidden():
|
|
408
|
+
model.upload_files([filepath])
|
|
406
409
|
|
|
407
410
|
model.set_suppress_output(False)
|
|
408
411
|
|
|
@@ -412,12 +415,6 @@ def handle_large_code_operation(filepath: str, patch_content: str, model: BasePl
|
|
|
412
415
|
## 任务描述
|
|
413
416
|
你是一位精确的代码补丁生成专家,需要根据补丁描述生成精确的代码差异。
|
|
414
417
|
|
|
415
|
-
## 输入资料
|
|
416
|
-
### 原始代码
|
|
417
|
-
```
|
|
418
|
-
{old_file_content["stdout"]}
|
|
419
|
-
```
|
|
420
|
-
|
|
421
418
|
### 补丁内容
|
|
422
419
|
```
|
|
423
420
|
{patch_content}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
from typing import Any, Tuple
|
|
4
2
|
|
|
5
3
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
@@ -17,8 +15,9 @@ def shell_input_handler(user_input: str, agent: Any) -> Tuple[str, bool]:
|
|
|
17
15
|
if user_confirm(f"是否要执行以上shell脚本?", default=True):
|
|
18
16
|
from jarvis.jarvis_tools.registry import ToolRegistry
|
|
19
17
|
output = ToolRegistry().handle_tool_calls({
|
|
20
|
-
"name": "
|
|
18
|
+
"name": "execute_script",
|
|
21
19
|
"arguments": {
|
|
20
|
+
"interpreter": "bash",
|
|
22
21
|
"script_content": script
|
|
23
22
|
}
|
|
24
23
|
}, agent)
|