jarvis-ai-assistant 0.1.207__py3-none-any.whl → 0.1.209__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.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +63 -103
- jarvis/jarvis_agent/edit_file_handler.py +43 -47
- jarvis/jarvis_agent/jarvis.py +33 -39
- jarvis/jarvis_code_agent/code_agent.py +74 -30
- jarvis/jarvis_code_agent/lint.py +6 -6
- jarvis/jarvis_code_analysis/code_review.py +164 -175
- jarvis/jarvis_data/config_schema.json +0 -25
- jarvis/jarvis_git_utils/git_commiter.py +148 -153
- jarvis/jarvis_methodology/main.py +70 -81
- jarvis/jarvis_platform/base.py +21 -17
- jarvis/jarvis_platform/kimi.py +59 -64
- jarvis/jarvis_platform/tongyi.py +118 -131
- jarvis/jarvis_platform/yuanbao.py +117 -122
- jarvis/jarvis_platform_manager/main.py +102 -502
- jarvis/jarvis_platform_manager/service.py +432 -0
- jarvis/jarvis_smart_shell/main.py +99 -33
- jarvis/jarvis_tools/ask_user.py +0 -1
- jarvis/jarvis_tools/edit_file.py +64 -55
- jarvis/jarvis_tools/file_analyzer.py +17 -28
- jarvis/jarvis_tools/read_code.py +80 -81
- jarvis/jarvis_utils/builtin_replace_map.py +1 -36
- jarvis/jarvis_utils/config.py +13 -48
- jarvis/jarvis_utils/embedding.py +6 -51
- jarvis/jarvis_utils/git_utils.py +93 -43
- jarvis/jarvis_utils/http.py +104 -0
- jarvis/jarvis_utils/methodology.py +12 -17
- jarvis/jarvis_utils/utils.py +186 -63
- {jarvis_ai_assistant-0.1.207.dist-info → jarvis_ai_assistant-0.1.209.dist-info}/METADATA +4 -19
- {jarvis_ai_assistant-0.1.207.dist-info → jarvis_ai_assistant-0.1.209.dist-info}/RECORD +34 -40
- {jarvis_ai_assistant-0.1.207.dist-info → jarvis_ai_assistant-0.1.209.dist-info}/entry_points.txt +1 -1
- jarvis/jarvis_data/huggingface.tar.gz +0 -0
- jarvis/jarvis_dev/main.py +0 -1247
- jarvis/jarvis_tools/chdir.py +0 -72
- jarvis/jarvis_tools/code_plan.py +0 -218
- jarvis/jarvis_tools/create_code_agent.py +0 -95
- jarvis/jarvis_tools/create_sub_agent.py +0 -82
- jarvis/jarvis_tools/file_operation.py +0 -238
- jarvis/jarvis_utils/jarvis_history.py +0 -98
- {jarvis_ai_assistant-0.1.207.dist-info → jarvis_ai_assistant-0.1.209.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.207.dist-info → jarvis_ai_assistant-0.1.209.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.207.dist-info → jarvis_ai_assistant-0.1.209.dist-info}/top_level.txt +0 -0
@@ -10,24 +10,26 @@ import subprocess
|
|
10
10
|
import sys
|
11
11
|
from typing import List, Optional, Tuple
|
12
12
|
|
13
|
-
from yaspin import yaspin # type: ignore
|
14
|
-
|
15
13
|
from jarvis.jarvis_agent import Agent
|
16
14
|
from jarvis.jarvis_agent.builtin_input_handler import builtin_input_handler
|
17
15
|
from jarvis.jarvis_agent.edit_file_handler import EditFileHandler
|
18
16
|
from jarvis.jarvis_agent.shell_input_handler import shell_input_handler
|
19
|
-
# 忽略yaspin的类型检查
|
20
17
|
from jarvis.jarvis_code_agent.lint import get_lint_tools
|
21
18
|
from jarvis.jarvis_git_utils.git_commiter import GitCommitTool
|
22
19
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
23
20
|
from jarvis.jarvis_tools.registry import ToolRegistry
|
24
21
|
from jarvis.jarvis_utils.config import is_confirm_before_apply_patch
|
25
|
-
from jarvis.jarvis_utils.git_utils import (
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
from jarvis.jarvis_utils.git_utils import (
|
23
|
+
confirm_add_new_files,
|
24
|
+
find_git_root_and_cd,
|
25
|
+
get_commits_between,
|
26
|
+
get_diff,
|
27
|
+
get_diff_file_list,
|
28
|
+
get_latest_commit_hash,
|
29
|
+
get_recent_commits_with_files,
|
30
|
+
handle_commit_workflow,
|
31
|
+
has_uncommitted_changes,
|
32
|
+
)
|
31
33
|
from jarvis.jarvis_utils.input import get_multiline_input
|
32
34
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
33
35
|
from jarvis.jarvis_utils.utils import get_loc_stats, init_env, user_confirm
|
@@ -54,8 +56,6 @@ class CodeAgent:
|
|
54
56
|
"ask_user",
|
55
57
|
"read_code",
|
56
58
|
"methodology",
|
57
|
-
"chdir",
|
58
|
-
# "edit_file",
|
59
59
|
"rewrite_file",
|
60
60
|
]
|
61
61
|
)
|
@@ -134,21 +134,64 @@ class CodeAgent:
|
|
134
134
|
|
135
135
|
self.agent.set_after_tool_call_cb(self.after_tool_call_cb)
|
136
136
|
|
137
|
+
def _find_git_root(self) -> str:
|
138
|
+
"""查找并切换到git根目录
|
139
|
+
|
140
|
+
返回:
|
141
|
+
str: git根目录路径
|
142
|
+
"""
|
143
|
+
print("🔍 正在查找git根目录...")
|
144
|
+
curr_dir = os.getcwd()
|
145
|
+
git_dir = find_git_root_and_cd(curr_dir)
|
146
|
+
self.root_dir = git_dir
|
147
|
+
print(f"✅ 已找到git根目录: {git_dir}")
|
148
|
+
return git_dir
|
149
|
+
|
150
|
+
def _update_gitignore(self, git_dir: str) -> None:
|
151
|
+
"""检查并更新.gitignore文件,确保忽略.jarvis目录
|
152
|
+
|
153
|
+
参数:
|
154
|
+
git_dir: git根目录路径
|
155
|
+
"""
|
156
|
+
print("📝 正在检查.gitignore文件...")
|
157
|
+
gitignore_path = os.path.join(git_dir, ".gitignore")
|
158
|
+
jarvis_ignore = ".jarvis"
|
159
|
+
|
160
|
+
if not os.path.exists(gitignore_path):
|
161
|
+
with open(gitignore_path, "w") as f:
|
162
|
+
f.write(f"{jarvis_ignore}\n")
|
163
|
+
print(f"✅ 已创建.gitignore文件并添加'{jarvis_ignore}'")
|
164
|
+
else:
|
165
|
+
with open(gitignore_path, "r+") as f:
|
166
|
+
content = f.read()
|
167
|
+
if jarvis_ignore not in content.splitlines():
|
168
|
+
f.write(f"\n{jarvis_ignore}\n")
|
169
|
+
print(f"✅ 已更新.gitignore文件,添加'{jarvis_ignore}'")
|
170
|
+
else:
|
171
|
+
print("ℹ️ .jarvis已在.gitignore中")
|
172
|
+
|
173
|
+
def _handle_git_changes(self) -> None:
|
174
|
+
"""处理git仓库中的未提交修改"""
|
175
|
+
print("🔄 正在检查未提交的修改...")
|
176
|
+
if has_uncommitted_changes():
|
177
|
+
print("⏳ 发现未提交修改,正在处理...")
|
178
|
+
git_commiter = GitCommitTool()
|
179
|
+
git_commiter.execute({})
|
180
|
+
print("✅ 未提交修改已处理完成")
|
181
|
+
else:
|
182
|
+
print("✅ 没有未提交的修改")
|
183
|
+
|
137
184
|
def _init_env(self) -> None:
|
138
|
-
"""
|
185
|
+
"""初始化环境,组合以下功能:
|
139
186
|
1. 查找git根目录
|
140
|
-
2.
|
187
|
+
2. 检查并更新.gitignore文件
|
188
|
+
3. 处理未提交的修改
|
141
189
|
"""
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
with spinner.hidden():
|
148
|
-
git_commiter = GitCommitTool()
|
149
|
-
git_commiter.execute({})
|
150
|
-
spinner.text = "环境初始化完成"
|
151
|
-
spinner.ok("✅")
|
190
|
+
print("🚀 正在初始化环境...")
|
191
|
+
git_dir = self._find_git_root()
|
192
|
+
self._update_gitignore(git_dir)
|
193
|
+
self._handle_git_changes()
|
194
|
+
print("✅ 环境初始化完成")
|
152
195
|
|
153
196
|
def _handle_uncommitted_changes(self) -> None:
|
154
197
|
"""处理未提交的修改,包括:
|
@@ -378,18 +421,19 @@ def main() -> None:
|
|
378
421
|
args = parser.parse_args()
|
379
422
|
|
380
423
|
curr_dir = os.getcwd()
|
381
|
-
git_dir =
|
424
|
+
git_dir = find_git_root_and_cd(curr_dir)
|
382
425
|
PrettyOutput.print(f"当前目录: {git_dir}", OutputType.INFO)
|
383
426
|
|
384
427
|
try:
|
428
|
+
agent = CodeAgent(platform=args.platform, model=args.model, need_summary=False)
|
385
429
|
if args.requirement:
|
386
|
-
|
430
|
+
agent.run(args.requirement)
|
387
431
|
else:
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
432
|
+
while True:
|
433
|
+
user_input = get_multiline_input("请输入你的需求(输入空行退出):")
|
434
|
+
if not user_input:
|
435
|
+
return
|
436
|
+
agent.run(user_input)
|
393
437
|
|
394
438
|
except RuntimeError as e:
|
395
439
|
PrettyOutput.print(f"错误: {str(e)}", OutputType.ERROR)
|
jarvis/jarvis_code_agent/lint.py
CHANGED
@@ -8,7 +8,7 @@ Lint工具配置模块
|
|
8
8
|
import os
|
9
9
|
from typing import Dict, List
|
10
10
|
|
11
|
-
import yaml
|
11
|
+
import yaml # type: ignore
|
12
12
|
|
13
13
|
from jarvis.jarvis_utils.config import get_data_dir
|
14
14
|
|
@@ -27,11 +27,11 @@ LINT_TOOLS = {
|
|
27
27
|
# Go
|
28
28
|
".go": ["go vet"],
|
29
29
|
# Python
|
30
|
-
".py": ["black", "pylint", "mypy"
|
31
|
-
".pyw": ["black", "pylint", "mypy"
|
32
|
-
".pyi": ["black", "pylint", "mypy"
|
33
|
-
".pyx": ["black", "pylint", "mypy"
|
34
|
-
".pxd": ["black", "pylint", "mypy"
|
30
|
+
".py": ["black", "pylint", "mypy"],
|
31
|
+
".pyw": ["black", "pylint", "mypy"],
|
32
|
+
".pyi": ["black", "pylint", "mypy"],
|
33
|
+
".pyx": ["black", "pylint", "mypy"],
|
34
|
+
".pxd": ["black", "pylint", "mypy"],
|
35
35
|
# Rust
|
36
36
|
".rs": ["cargo clippy", "rustfmt"],
|
37
37
|
".rlib": ["cargo clippy", "rustfmt"],
|
@@ -5,11 +5,8 @@ import subprocess
|
|
5
5
|
import tempfile
|
6
6
|
from typing import Any, Dict, List
|
7
7
|
|
8
|
-
from yaspin import yaspin
|
9
|
-
|
10
8
|
from jarvis.jarvis_agent import Agent
|
11
|
-
from jarvis.jarvis_code_analysis.checklists.loader import
|
12
|
-
get_language_checklist
|
9
|
+
from jarvis.jarvis_code_analysis.checklists.loader import get_language_checklist
|
13
10
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
14
11
|
from jarvis.jarvis_tools.read_code import ReadCodeTool
|
15
12
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
@@ -281,167 +278,165 @@ class CodeReviewTool:
|
|
281
278
|
diff_output = ""
|
282
279
|
|
283
280
|
# Build git diff command based on review type
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
281
|
+
print("📊 正在获取代码变更...")
|
282
|
+
|
283
|
+
if review_type == "commit":
|
284
|
+
if "commit_sha" not in args:
|
285
|
+
return {
|
286
|
+
"success": False,
|
287
|
+
"stdout": {},
|
288
|
+
"stderr": "commit_sha is required for commit review type",
|
289
|
+
}
|
290
|
+
commit_sha = args["commit_sha"].strip()
|
291
|
+
diff_cmd = f"git show {commit_sha} | cat -"
|
292
|
+
|
293
|
+
# Execute git command and get diff output
|
294
|
+
diff_output = subprocess.check_output(
|
295
|
+
diff_cmd, shell=True, text=True
|
296
|
+
)
|
297
|
+
if not diff_output:
|
298
|
+
return {
|
299
|
+
"success": False,
|
300
|
+
"stdout": {},
|
301
|
+
"stderr": "No changes to review",
|
302
|
+
}
|
303
|
+
|
304
|
+
# Extract changed files using git command
|
305
|
+
files_cmd = f"git show --name-only --pretty=format: {commit_sha} | grep -v '^$'"
|
306
|
+
try:
|
307
|
+
files_output = subprocess.check_output(
|
308
|
+
files_cmd, shell=True, text=True
|
298
309
|
)
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
310
|
+
file_paths = [
|
311
|
+
f.strip() for f in files_output.split("\n") if f.strip()
|
312
|
+
]
|
313
|
+
except subprocess.CalledProcessError:
|
314
|
+
# Fallback to regex extraction if git command fails
|
315
|
+
file_pattern = r"diff --git a/.*?\s+b/(.*?)(\n|$)"
|
316
|
+
files = re.findall(file_pattern, diff_output)
|
317
|
+
file_paths = [match[0] for match in files]
|
318
|
+
|
319
|
+
elif review_type == "range":
|
320
|
+
if "start_commit" not in args or "end_commit" not in args:
|
321
|
+
return {
|
322
|
+
"success": False,
|
323
|
+
"stdout": {},
|
324
|
+
"stderr": "start_commit and end_commit are required for range review type",
|
325
|
+
}
|
326
|
+
start_commit = args["start_commit"].strip()
|
327
|
+
end_commit = args["end_commit"].strip()
|
328
|
+
diff_cmd = f"git diff {start_commit}..{end_commit} | cat -"
|
329
|
+
|
330
|
+
# Execute git command and get diff output
|
331
|
+
diff_output = subprocess.check_output(
|
332
|
+
diff_cmd, shell=True, text=True
|
333
|
+
)
|
334
|
+
if not diff_output:
|
335
|
+
return {
|
336
|
+
"success": False,
|
337
|
+
"stdout": {},
|
338
|
+
"stderr": "No changes to review",
|
339
|
+
}
|
340
|
+
|
341
|
+
# Extract changed files using git command
|
342
|
+
files_cmd = f"git diff --name-only {start_commit}..{end_commit}"
|
343
|
+
try:
|
344
|
+
files_output = subprocess.check_output(
|
345
|
+
files_cmd, shell=True, text=True
|
335
346
|
)
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
347
|
+
file_paths = [
|
348
|
+
f.strip() for f in files_output.split("\n") if f.strip()
|
349
|
+
]
|
350
|
+
except subprocess.CalledProcessError:
|
351
|
+
# Fallback to regex extraction if git command fails
|
352
|
+
file_pattern = r"diff --git a/.*?\s+b/(.*?)(\n|$)"
|
353
|
+
files = re.findall(file_pattern, diff_output)
|
354
|
+
file_paths = [match[0] for match in files]
|
355
|
+
|
356
|
+
elif review_type == "file":
|
357
|
+
if "file_path" not in args:
|
358
|
+
return {
|
359
|
+
"success": False,
|
360
|
+
"stdout": {},
|
361
|
+
"stderr": "file_path is required for file review type",
|
362
|
+
}
|
363
|
+
file_path = args["file_path"].strip()
|
364
|
+
file_paths = [file_path]
|
365
|
+
diff_output = ReadCodeTool().execute(
|
366
|
+
{"files": [{"path": file_path}]}
|
367
|
+
)["stdout"]
|
368
|
+
|
369
|
+
else: # current changes
|
370
|
+
diff_cmd = "git diff HEAD | cat -"
|
371
|
+
|
372
|
+
# Execute git command and get diff output
|
373
|
+
diff_output = subprocess.check_output(
|
374
|
+
diff_cmd, shell=True, text=True
|
375
|
+
)
|
376
|
+
if not diff_output:
|
377
|
+
return {
|
378
|
+
"success": False,
|
379
|
+
"stdout": {},
|
380
|
+
"stderr": "No changes to review",
|
381
|
+
}
|
382
|
+
|
383
|
+
# Extract changed files using git command
|
384
|
+
files_cmd = "git diff --name-only HEAD"
|
385
|
+
try:
|
386
|
+
files_output = subprocess.check_output(
|
387
|
+
files_cmd, shell=True, text=True
|
377
388
|
)
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
f.strip() for f in files_output.split("\n") if f.strip()
|
393
|
-
]
|
394
|
-
except subprocess.CalledProcessError:
|
395
|
-
# Fallback to regex extraction if git command fails
|
396
|
-
file_pattern = r"diff --git a/.*?\s+b/(.*?)(\n|$)"
|
397
|
-
files = re.findall(file_pattern, diff_output)
|
398
|
-
file_paths = [match[0] for match in files]
|
399
|
-
|
400
|
-
# Detect languages from the file paths
|
401
|
-
detected_languages = self._detect_languages_from_files(file_paths)
|
402
|
-
|
403
|
-
# Add review type and related information to the diff output
|
404
|
-
review_info = f"""
|
389
|
+
file_paths = [
|
390
|
+
f.strip() for f in files_output.split("\n") if f.strip()
|
391
|
+
]
|
392
|
+
except subprocess.CalledProcessError:
|
393
|
+
# Fallback to regex extraction if git command fails
|
394
|
+
file_pattern = r"diff --git a/.*?\s+b/(.*?)(\n|$)"
|
395
|
+
files = re.findall(file_pattern, diff_output)
|
396
|
+
file_paths = [match[0] for match in files]
|
397
|
+
|
398
|
+
# Detect languages from the file paths
|
399
|
+
detected_languages = self._detect_languages_from_files(file_paths)
|
400
|
+
|
401
|
+
# Add review type and related information to the diff output
|
402
|
+
review_info = f"""
|
405
403
|
----- 代码审查信息 -----
|
406
404
|
审查类型: {review_type}"""
|
407
405
|
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
PrettyOutput.print(diff_output, OutputType.CODE, lang="diff")
|
443
|
-
spinner.text = "代码变更获取完成"
|
444
|
-
spinner.ok("✅")
|
406
|
+
# Add specific information based on review type
|
407
|
+
if review_type == "commit":
|
408
|
+
review_info += f"\n提交SHA: {args['commit_sha']}"
|
409
|
+
elif review_type == "range":
|
410
|
+
review_info += f"\n起始提交: {args['start_commit']}\n结束提交: {args['end_commit']}"
|
411
|
+
elif review_type == "file":
|
412
|
+
review_info += f"\n文件路径: {args['file_path']}"
|
413
|
+
else: # current changes
|
414
|
+
review_info += "\n当前未提交修改"
|
415
|
+
|
416
|
+
# Add file list
|
417
|
+
if file_paths:
|
418
|
+
review_info += "\n\n----- 变更文件列表 -----"
|
419
|
+
for i, path in enumerate(file_paths, 1):
|
420
|
+
review_info += f"\n{i}. {path}"
|
421
|
+
|
422
|
+
# Add language-specific checklists
|
423
|
+
if detected_languages:
|
424
|
+
review_info += "\n\n----- 检测到的编程语言 -----"
|
425
|
+
review_info += f"\n检测到的语言: {', '.join(detected_languages)}"
|
426
|
+
|
427
|
+
review_info += "\n\n----- 语言特定审查清单 -----"
|
428
|
+
for lang in detected_languages:
|
429
|
+
checklist = self._get_language_checklist(lang)
|
430
|
+
if checklist:
|
431
|
+
review_info += f"\n{checklist}"
|
432
|
+
|
433
|
+
review_info += "\n------------------------\n\n"
|
434
|
+
|
435
|
+
# Combine review info with diff output
|
436
|
+
diff_output = review_info + diff_output
|
437
|
+
|
438
|
+
PrettyOutput.print(diff_output, OutputType.CODE, lang="diff")
|
439
|
+
print("✅ 代码变更获取完成")
|
445
440
|
|
446
441
|
system_prompt = """<code_review_guide>
|
447
442
|
<role>
|
@@ -690,22 +685,16 @@ class CodeReviewTool:
|
|
690
685
|
"stdout": "",
|
691
686
|
"stderr": "代码差异太大,无法处理",
|
692
687
|
}
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
else:
|
704
|
-
return {
|
705
|
-
"success": False,
|
706
|
-
"stdout": "",
|
707
|
-
"stderr": "上传代码差异文件失败",
|
708
|
-
}
|
688
|
+
print("📤 正在上传代码差异文件...")
|
689
|
+
upload_success = agent.model.upload_files([temp_file_path])
|
690
|
+
if upload_success:
|
691
|
+
print("✅ 已成功上传代码差异文件")
|
692
|
+
else:
|
693
|
+
return {
|
694
|
+
"success": False,
|
695
|
+
"stdout": "",
|
696
|
+
"stderr": "上传代码差异文件失败",
|
697
|
+
}
|
709
698
|
|
710
699
|
# Prepare the prompt based on upload status
|
711
700
|
if is_large_content:
|
@@ -121,16 +121,6 @@
|
|
121
121
|
"description": "模型能处理的最大输入token数量",
|
122
122
|
"default": 32000
|
123
123
|
},
|
124
|
-
"JARVIS_AUTO_COMPLETE": {
|
125
|
-
"type": "boolean",
|
126
|
-
"description": "是否启用自动补全功能",
|
127
|
-
"default": false
|
128
|
-
},
|
129
|
-
"SHELL": {
|
130
|
-
"type": "string",
|
131
|
-
"description": "系统shell名称(如: bash, zsh)",
|
132
|
-
"default": "/bin/bash"
|
133
|
-
},
|
134
124
|
"JARVIS_PLATFORM": {
|
135
125
|
"type": "string",
|
136
126
|
"description": "常规操作平台名称",
|
@@ -161,21 +151,11 @@
|
|
161
151
|
"description": "应用补丁前是否需要确认",
|
162
152
|
"default": false
|
163
153
|
},
|
164
|
-
"JARVIS_MAX_TOOL_CALL_COUNT": {
|
165
|
-
"type": "number",
|
166
|
-
"description": "最大连续工具调用次数",
|
167
|
-
"default": 20
|
168
|
-
},
|
169
154
|
"JARVIS_DATA_PATH": {
|
170
155
|
"type": "string",
|
171
156
|
"description": "Jarvis数据存储目录路径",
|
172
157
|
"default": "~/.jarvis"
|
173
158
|
},
|
174
|
-
"JARVIS_AUTO_UPDATE": {
|
175
|
-
"type": "boolean",
|
176
|
-
"description": "是否自动更新git仓库",
|
177
|
-
"default": true
|
178
|
-
},
|
179
159
|
"JARVIS_MAX_BIG_CONTENT_SIZE": {
|
180
160
|
"type": "number",
|
181
161
|
"description": "最大大内容尺寸",
|
@@ -201,11 +181,6 @@
|
|
201
181
|
"description": "是否打印提示",
|
202
182
|
"default": false
|
203
183
|
},
|
204
|
-
"JARVIS_USE_HISTORY_COUNT": {
|
205
|
-
"type": "number",
|
206
|
-
"description": "使用的历史记录数量",
|
207
|
-
"default": 0
|
208
|
-
},
|
209
184
|
"JARVIS_REPLACE_MAP": {
|
210
185
|
"type": "object",
|
211
186
|
"description": "自定义替换映射表配置",
|