jarvis-ai-assistant 0.1.191__py3-none-any.whl → 0.1.193__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 +45 -5
- jarvis/jarvis_code_agent/code_agent.py +4 -12
- jarvis/jarvis_methodology/main.py +8 -8
- jarvis/jarvis_platform/openai.py +9 -0
- jarvis/jarvis_platform/yuanbao.py +10 -5
- jarvis/jarvis_tools/read_code.py +9 -0
- jarvis/jarvis_tools/registry.py +2 -2
- jarvis/jarvis_utils/builtin_replace_map.py +88 -0
- jarvis/jarvis_utils/globals.py +40 -19
- jarvis/jarvis_utils/utils.py +3 -3
- {jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/METADATA +50 -1
- {jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/RECORD +17 -17
- {jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/jarvis_agent/__init__.py
CHANGED
@@ -395,6 +395,8 @@ class Agent:
|
|
395
395
|
if self.addon_prompt:
|
396
396
|
message += f"\n\n{self.addon_prompt}"
|
397
397
|
self.addon_prompt = ""
|
398
|
+
else:
|
399
|
+
message += f"\n\n{self.make_default_addon_prompt(need_complete)}"
|
398
400
|
|
399
401
|
# 累加对话长度
|
400
402
|
self.conversation_length += get_context_token_count(message)
|
@@ -724,6 +726,43 @@ arguments:
|
|
724
726
|
spinner.text = "分析失败"
|
725
727
|
spinner.fail("❌")
|
726
728
|
|
729
|
+
|
730
|
+
def make_default_addon_prompt(self, need_complete: bool) -> str:
|
731
|
+
"""生成附加提示。
|
732
|
+
|
733
|
+
参数:
|
734
|
+
need_complete: 是否需要完成任务
|
735
|
+
|
736
|
+
"""
|
737
|
+
return ""
|
738
|
+
# 结构化系统指令
|
739
|
+
action_handlers = ", ".join([handler.name() for handler in self.output_handler])
|
740
|
+
|
741
|
+
# 任务完成提示
|
742
|
+
complete_prompt = (
|
743
|
+
f"- 输出{ot('!!!COMPLETE!!!')}"
|
744
|
+
if need_complete and self.auto_complete
|
745
|
+
else ""
|
746
|
+
)
|
747
|
+
|
748
|
+
addon_prompt = f"""
|
749
|
+
<system_prompt>
|
750
|
+
请判断是否已经完成任务,如果已经完成:
|
751
|
+
- 直接输出完成原因,不需要再有新的操作,不要输出{ot("TOOL_CALL")}标签
|
752
|
+
{complete_prompt}
|
753
|
+
如果没有完成,请进行下一步操作:
|
754
|
+
- 仅包含一个操作
|
755
|
+
- 如果信息不明确,请请求用户补充
|
756
|
+
- 如果执行过程中连续失败5次,请使用ask_user询问用户操作
|
757
|
+
- 操作列表:{action_handlers}
|
758
|
+
</system_prompt>
|
759
|
+
|
760
|
+
请继续。
|
761
|
+
"""
|
762
|
+
|
763
|
+
return addon_prompt
|
764
|
+
|
765
|
+
|
727
766
|
def run(self, user_input: str) -> Any:
|
728
767
|
"""处理用户输入并执行任务
|
729
768
|
|
@@ -772,17 +811,18 @@ arguments:
|
|
772
811
|
|
773
812
|
if need_return:
|
774
813
|
return self.prompt
|
775
|
-
|
776
|
-
if self.after_tool_call_cb:
|
777
|
-
self.after_tool_call_cb(self)
|
778
|
-
|
814
|
+
|
779
815
|
if get_interrupt():
|
780
816
|
set_interrupt(False)
|
781
817
|
user_input = self.multiline_inputer(
|
782
818
|
f"模型交互期间被中断,请输入用户干预信息:"
|
783
819
|
)
|
784
820
|
if user_input:
|
785
|
-
self.prompt += f"\n\n
|
821
|
+
self.prompt += f"\n\n{user_input}"
|
822
|
+
continue
|
823
|
+
|
824
|
+
if self.after_tool_call_cb:
|
825
|
+
self.after_tool_call_cb(self)
|
786
826
|
|
787
827
|
if self.prompt or self.addon_prompt:
|
788
828
|
continue
|
@@ -109,7 +109,6 @@ class CodeAgent:
|
|
109
109
|
output_handler=[tool_registry],
|
110
110
|
platform=platform_instance,
|
111
111
|
input_handler=[
|
112
|
-
file_input_handler,
|
113
112
|
shell_input_handler,
|
114
113
|
builtin_input_handler
|
115
114
|
],
|
@@ -289,8 +288,6 @@ class CodeAgent:
|
|
289
288
|
final_ret = ""
|
290
289
|
diff = get_diff()
|
291
290
|
if diff:
|
292
|
-
# 获取修改的文件列表
|
293
|
-
modified_files = get_diff_file_list()
|
294
291
|
start_hash = get_latest_commit_hash()
|
295
292
|
PrettyOutput.print(diff, OutputType.CODE, lang="diff")
|
296
293
|
commited = handle_commit_workflow()
|
@@ -301,13 +298,8 @@ class CodeAgent:
|
|
301
298
|
|
302
299
|
# 添加提交信息到final_ret
|
303
300
|
if commits:
|
304
|
-
final_ret += "
|
305
|
-
|
306
|
-
for commit_hash, commit_message in commits:
|
307
|
-
final_ret += f"- {commit_hash[:7]}: {commit_message}\n"
|
308
|
-
|
309
|
-
final_ret += f"# 应用补丁:\n```diff\n{diff}\n```"
|
310
|
-
|
301
|
+
final_ret += f"\n\n代码已修改完成\n补丁内容:\n```diff\n{diff}\n```\n"
|
302
|
+
modified_files = get_diff_file_list()
|
311
303
|
# 修改后的提示逻辑
|
312
304
|
lint_tools_info = "\n".join(
|
313
305
|
f" - {file}: 使用 {'、'.join(get_lint_tools(file))}"
|
@@ -325,9 +317,9 @@ class CodeAgent:
|
|
325
317
|
"""
|
326
318
|
agent.set_addon_prompt(addon_prompt)
|
327
319
|
else:
|
328
|
-
final_ret += "
|
320
|
+
final_ret += "\n\n修改没有生效\n"
|
329
321
|
else:
|
330
|
-
final_ret += "
|
322
|
+
final_ret += "\n修改被拒绝\n"
|
331
323
|
final_ret += f"# 补丁预览:\n```diff\n{diff}\n```"
|
332
324
|
else:
|
333
325
|
return
|
@@ -47,9 +47,9 @@ def import_methodology(input_file):
|
|
47
47
|
"content": content
|
48
48
|
}, f, ensure_ascii=False, indent=2)
|
49
49
|
|
50
|
-
print(f"成功导入 {len(import_data)} 个方法论(总计 {len(merged_data)} 个)")
|
50
|
+
PrettyOutput.print(f"成功导入 {len(import_data)} 个方法论(总计 {len(merged_data)} 个)", OutputType.SUCCESS)
|
51
51
|
except (json.JSONDecodeError, OSError) as e:
|
52
|
-
print(f"导入失败: {str(e)}")
|
52
|
+
PrettyOutput.print(f"导入失败: {str(e)}", OutputType.ERROR)
|
53
53
|
|
54
54
|
def export_methodology(output_file):
|
55
55
|
"""导出当前方法论到单个文件"""
|
@@ -59,9 +59,9 @@ def export_methodology(output_file):
|
|
59
59
|
with open(output_file, "w", encoding="utf-8") as f:
|
60
60
|
json.dump(methodologies, f, ensure_ascii=False, indent=2)
|
61
61
|
|
62
|
-
print(f"成功导出 {len(methodologies)} 个方法论到 {output_file}")
|
62
|
+
PrettyOutput.print(f"成功导出 {len(methodologies)} 个方法论到 {output_file}", OutputType.SUCCESS)
|
63
63
|
except (OSError, TypeError) as e:
|
64
|
-
print(f"导出失败: {str(e)}")
|
64
|
+
PrettyOutput.print(f"导出失败: {str(e)}", OutputType.ERROR)
|
65
65
|
|
66
66
|
def list_methodologies():
|
67
67
|
"""列出所有方法论"""
|
@@ -69,14 +69,14 @@ def list_methodologies():
|
|
69
69
|
methodologies = _load_all_methodologies()
|
70
70
|
|
71
71
|
if not methodologies:
|
72
|
-
print("没有找到方法论")
|
72
|
+
PrettyOutput.print("没有找到方法论", OutputType.INFO)
|
73
73
|
return
|
74
74
|
|
75
|
-
print("可用方法论:")
|
75
|
+
PrettyOutput.print("可用方法论:", OutputType.INFO)
|
76
76
|
for i, (problem_type, _) in enumerate(methodologies.items(), 1):
|
77
|
-
print(f"{i}. {problem_type}")
|
77
|
+
PrettyOutput.print(f"{i}. {problem_type}", OutputType.INFO)
|
78
78
|
except (OSError, json.JSONDecodeError) as e:
|
79
|
-
print(f"列出方法论失败: {str(e)}")
|
79
|
+
PrettyOutput.print(f"列出方法论失败: {str(e)}", OutputType.ERROR)
|
80
80
|
|
81
81
|
def extract_methodology(input_file):
|
82
82
|
"""从文本文件中提取方法论"""
|
jarvis/jarvis_platform/openai.py
CHANGED
@@ -160,4 +160,13 @@ class OpenAIModel(BasePlatform):
|
|
160
160
|
返回:
|
161
161
|
bool: 当前是否支持网页访问 (OpenAI平台始终返回False)
|
162
162
|
"""
|
163
|
+
return False
|
164
|
+
|
165
|
+
def support_upload_files(self) -> bool:
|
166
|
+
"""
|
167
|
+
检查是否支持上传文件功能
|
168
|
+
|
169
|
+
返回:
|
170
|
+
bool: 当前是否支持上传文件 (OpenAI平台始终返回False)
|
171
|
+
"""
|
163
172
|
return False
|
@@ -386,6 +386,12 @@ class YuanbaoPlatform(BasePlatform):
|
|
386
386
|
|
387
387
|
headers = self._get_base_headers()
|
388
388
|
|
389
|
+
chat_model_ext_info = {
|
390
|
+
"modelId": self.model_name,
|
391
|
+
"subModelId": "",
|
392
|
+
"supportFunctions": ["openInternetSearch"] if self.web else ["autoInternetSearch"],
|
393
|
+
}
|
394
|
+
|
389
395
|
# 准备消息内容
|
390
396
|
payload = {
|
391
397
|
"model": "gpt_175B_0404",
|
@@ -404,16 +410,15 @@ class YuanbaoPlatform(BasePlatform):
|
|
404
410
|
"agentId": self.agent_id,
|
405
411
|
"supportHint": 1,
|
406
412
|
"version": "v2",
|
407
|
-
"supportFunctions": [],
|
413
|
+
"supportFunctions": chat_model_ext_info["supportFunctions"],
|
408
414
|
"chatModelId": self.model_name,
|
409
415
|
}
|
410
416
|
|
417
|
+
if self.first_chat:
|
418
|
+
payload["chatModelExtInfo"] = json.dumps(chat_model_ext_info),
|
419
|
+
|
411
420
|
self.multimedia = []
|
412
421
|
|
413
|
-
if self.web:
|
414
|
-
payload["supportFunctions"] = ["openInternetSearch"]
|
415
|
-
else:
|
416
|
-
payload["supportFunctions"] = ["autoInternetSearch"]
|
417
422
|
|
418
423
|
# 添加系统消息(如果是第一次对话)
|
419
424
|
if self.first_chat and self.system_message:
|
jarvis/jarvis_tools/read_code.py
CHANGED
@@ -66,6 +66,15 @@ class ReadCodeTool:
|
|
66
66
|
lines = f.readlines()
|
67
67
|
|
68
68
|
total_lines = len(lines)
|
69
|
+
|
70
|
+
# 处理空文件情况
|
71
|
+
if total_lines == 0:
|
72
|
+
spinner.ok("✅")
|
73
|
+
return {
|
74
|
+
"success": True,
|
75
|
+
"stdout": f"\n🔍 文件: {abs_path}\n📄 文件为空 (0行)\n",
|
76
|
+
"stderr": ""
|
77
|
+
}
|
69
78
|
|
70
79
|
# 处理特殊值-1表示文件末尾
|
71
80
|
if end_line == -1:
|
jarvis/jarvis_tools/registry.py
CHANGED
@@ -622,9 +622,9 @@ class ToolRegistry(OutputHandlerProtocol):
|
|
622
622
|
"""
|
623
623
|
output_parts = []
|
624
624
|
if stdout:
|
625
|
-
output_parts.append(f"<
|
625
|
+
output_parts.append(f"<stdout>\n{stdout}\n</stdout>")
|
626
626
|
if stderr:
|
627
|
-
output_parts.append(f"<
|
627
|
+
output_parts.append(f"<stderr>\n{stderr}\n</stderr>")
|
628
628
|
output = "\n\n".join(output_parts)
|
629
629
|
return "<无输出和错误>" if not output else output
|
630
630
|
|
@@ -95,5 +95,93 @@ code_plan工具将:
|
|
95
95
|
4. 确保使用项目对应的静态检查工具
|
96
96
|
""",
|
97
97
|
"description": "执行静态代码检查"
|
98
|
+
},
|
99
|
+
"ToolHelp": {
|
100
|
+
"append": False,
|
101
|
+
"template": """
|
102
|
+
<tool_system_guide>
|
103
|
+
<introduction>
|
104
|
+
# 🛠️ 工具使用系统
|
105
|
+
您正在使用一个需要精确格式和严格规则的工具执行系统。
|
106
|
+
</introduction>
|
107
|
+
|
108
|
+
<format>
|
109
|
+
# 📋 工具调用格式
|
110
|
+
{ot("TOOL_CALL")}
|
111
|
+
want: 想要从执行结果中获取到的信息,如果工具输出内容过长,会根据此字段尝试提取有效信息
|
112
|
+
name: 工具名称
|
113
|
+
arguments:
|
114
|
+
param1: 值1
|
115
|
+
param2: 值2
|
116
|
+
{ct("TOOL_CALL")}
|
117
|
+
</format>
|
118
|
+
|
119
|
+
<rules>
|
120
|
+
# ❗ 关键规则
|
121
|
+
<rule>
|
122
|
+
### 1. 每次只使用一个工具
|
123
|
+
- 一次只执行一个工具
|
124
|
+
- 等待结果后再进行下一步
|
125
|
+
</rule>
|
126
|
+
|
127
|
+
<rule>
|
128
|
+
### 2. 严格遵守格式
|
129
|
+
- 完全按照上述格式
|
130
|
+
- 使用正确的YAML格式,2个空格作为缩进
|
131
|
+
- 包含所有必需参数
|
132
|
+
</rule>
|
133
|
+
|
134
|
+
<rule>
|
135
|
+
### 3. 结果处理
|
136
|
+
- 等待执行结果
|
137
|
+
- 不要假设结果
|
138
|
+
- 不要创建虚假响应
|
139
|
+
- 不要想象对话
|
140
|
+
</rule>
|
141
|
+
|
142
|
+
<rule>
|
143
|
+
### 4. 信息管理
|
144
|
+
- 如果信息不足,询问用户
|
145
|
+
- 跳过不必要的步骤
|
146
|
+
- 如果卡住,请求指导
|
147
|
+
- 不要在没有完整信息的情况下继续
|
148
|
+
</rule>
|
149
|
+
</rules>
|
150
|
+
|
151
|
+
<string_format>
|
152
|
+
# 📝 字符串参数格式
|
153
|
+
始终使用 |2 语法表示字符串参数,防止多行字符串行首空格引起歧义:
|
154
|
+
|
155
|
+
{ot("TOOL_CALL")}
|
156
|
+
want: 当前的git状态,期望获取xxx的提交记录
|
157
|
+
name: execute_script
|
158
|
+
arguments:
|
159
|
+
interpreter: bash
|
160
|
+
script_cotent: |2
|
161
|
+
git status --porcelain
|
162
|
+
{ct("TOOL_CALL")}
|
163
|
+
</string_format>
|
164
|
+
|
165
|
+
<best_practices>
|
166
|
+
# 💡 最佳实践
|
167
|
+
- 准备好后立即开始执行
|
168
|
+
- 无需请求许可即可开始
|
169
|
+
- 使用正确的字符串格式
|
170
|
+
- 监控进度并调整
|
171
|
+
- 遇到困难时请求帮助
|
172
|
+
</best_practices>
|
173
|
+
|
174
|
+
<common_errors>
|
175
|
+
# ⚠️ 常见错误
|
176
|
+
- 同时调用多个工具
|
177
|
+
- 字符串参数缺少 |2
|
178
|
+
- 假设工具结果
|
179
|
+
- 创建虚构对话
|
180
|
+
- 在没有所需信息的情况下继续
|
181
|
+
- yaml 格式错误
|
182
|
+
</common_errors>
|
183
|
+
</tool_system_guide>
|
184
|
+
""",
|
185
|
+
"description": "工具使用系统"
|
98
186
|
}
|
99
187
|
}
|
jarvis/jarvis_utils/globals.py
CHANGED
@@ -24,23 +24,27 @@ current_agent_name: str = ""
|
|
24
24
|
# 表示与大模型交互的深度(>0表示正在交互)
|
25
25
|
g_in_chat: int = 0
|
26
26
|
# 表示是否接收到中断信号
|
27
|
-
g_interrupt:
|
27
|
+
g_interrupt: int = 0
|
28
28
|
# 使用自定义主题配置rich控制台
|
29
|
-
custom_theme = Theme(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
29
|
+
custom_theme = Theme(
|
30
|
+
{
|
31
|
+
"INFO": "yellow",
|
32
|
+
"WARNING": "yellow",
|
33
|
+
"ERROR": "red",
|
34
|
+
"SUCCESS": "green",
|
35
|
+
"SYSTEM": "cyan",
|
36
|
+
"CODE": "green",
|
37
|
+
"RESULT": "blue",
|
38
|
+
"PLANNING": "magenta",
|
39
|
+
"PROGRESS": "white",
|
40
|
+
"DEBUG": "blue",
|
41
|
+
"USER": "green",
|
42
|
+
"TOOL": "yellow",
|
43
|
+
}
|
44
|
+
)
|
43
45
|
console = Console(theme=custom_theme)
|
46
|
+
|
47
|
+
|
44
48
|
def make_agent_name(agent_name: str) -> str:
|
45
49
|
"""
|
46
50
|
通过附加后缀生成唯一的代理名称(如果必要)。
|
@@ -57,6 +61,8 @@ def make_agent_name(agent_name: str) -> str:
|
|
57
61
|
i += 1
|
58
62
|
return f"{agent_name}_{i}"
|
59
63
|
return agent_name
|
64
|
+
|
65
|
+
|
60
66
|
def set_agent(agent_name: str, agent: Any) -> None:
|
61
67
|
"""
|
62
68
|
设置当前代理并将其添加到全局代理集合中。
|
@@ -68,6 +74,8 @@ def set_agent(agent_name: str, agent: Any) -> None:
|
|
68
74
|
global_agents.add(agent_name)
|
69
75
|
global current_agent_name
|
70
76
|
current_agent_name = agent_name
|
77
|
+
|
78
|
+
|
71
79
|
def get_agent_list() -> str:
|
72
80
|
"""
|
73
81
|
获取表示当前代理状态的格式化字符串。
|
@@ -75,7 +83,13 @@ def get_agent_list() -> str:
|
|
75
83
|
返回:
|
76
84
|
str: 包含代理数量和当前代理名称的格式化字符串
|
77
85
|
"""
|
78
|
-
return
|
86
|
+
return (
|
87
|
+
"[" + str(len(global_agents)) + "]" + current_agent_name
|
88
|
+
if global_agents
|
89
|
+
else ""
|
90
|
+
)
|
91
|
+
|
92
|
+
|
79
93
|
def delete_agent(agent_name: str) -> None:
|
80
94
|
"""
|
81
95
|
从全局代理集合中删除一个代理。
|
@@ -88,6 +102,7 @@ def delete_agent(agent_name: str) -> None:
|
|
88
102
|
global current_agent_name
|
89
103
|
current_agent_name = ""
|
90
104
|
|
105
|
+
|
91
106
|
def set_in_chat(status: bool) -> None:
|
92
107
|
"""
|
93
108
|
设置与大模型交互的状态。
|
@@ -101,6 +116,7 @@ def set_in_chat(status: bool) -> None:
|
|
101
116
|
else:
|
102
117
|
g_in_chat = max(0, g_in_chat - 1)
|
103
118
|
|
119
|
+
|
104
120
|
def get_in_chat() -> bool:
|
105
121
|
"""
|
106
122
|
获取当前是否正在与大模型交互的状态。
|
@@ -110,6 +126,7 @@ def get_in_chat() -> bool:
|
|
110
126
|
"""
|
111
127
|
return g_in_chat > 0
|
112
128
|
|
129
|
+
|
113
130
|
def set_interrupt(status: bool) -> None:
|
114
131
|
"""
|
115
132
|
设置中断信号状态。
|
@@ -118,13 +135,17 @@ def set_interrupt(status: bool) -> None:
|
|
118
135
|
status: 中断状态
|
119
136
|
"""
|
120
137
|
global g_interrupt
|
121
|
-
|
138
|
+
if status:
|
139
|
+
g_interrupt += 1
|
140
|
+
else:
|
141
|
+
g_interrupt = 0
|
142
|
+
|
122
143
|
|
123
|
-
def get_interrupt() ->
|
144
|
+
def get_interrupt() -> int:
|
124
145
|
"""
|
125
146
|
获取当前中断信号状态。
|
126
147
|
|
127
148
|
返回:
|
128
|
-
|
149
|
+
int: 当前中断计数
|
129
150
|
"""
|
130
151
|
return g_interrupt
|
jarvis/jarvis_utils/utils.py
CHANGED
@@ -15,7 +15,7 @@ from jarvis.jarvis_utils.config import get_data_dir, get_max_big_content_size, s
|
|
15
15
|
from jarvis.jarvis_utils.embedding import get_context_token_count
|
16
16
|
from jarvis.jarvis_utils.input import get_single_line_input
|
17
17
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
18
|
-
from jarvis.jarvis_utils.globals import get_in_chat, set_interrupt
|
18
|
+
from jarvis.jarvis_utils.globals import get_in_chat, get_interrupt, set_interrupt
|
19
19
|
|
20
20
|
|
21
21
|
|
@@ -38,10 +38,10 @@ def init_env(welcome_str: str, config_file: Optional[str] = None) -> None:
|
|
38
38
|
|
39
39
|
def sigint_handler(signum, frame):
|
40
40
|
if get_in_chat():
|
41
|
-
PrettyOutput.print("接收到SIGINT信号,正在设置中断标志...", OutputType.INFO)
|
42
41
|
set_interrupt(True)
|
42
|
+
if get_interrupt() > 5 and original_sigint and callable(original_sigint):
|
43
|
+
original_sigint(signum, frame)
|
43
44
|
else:
|
44
|
-
PrettyOutput.print("接收到SIGINT信号,正在优雅退出...", OutputType.INFO)
|
45
45
|
if original_sigint and callable(original_sigint):
|
46
46
|
original_sigint(signum, frame)
|
47
47
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: jarvis-ai-assistant
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.193
|
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
|
@@ -222,6 +222,7 @@ OPENAI_API_BASE: https://api.openai.com/v1 # 可选,默认为官方API地址
|
|
222
222
|
| `jarvis-platform-manager` | - | 使用平台管理功能 |
|
223
223
|
| `jarvis-code-review` | - | 使用代码审查功能 |
|
224
224
|
| `jarvis-git-commit` | `jgc` | 使用自动化git commit功能 |
|
225
|
+
| `jarvis-code-agent` | `jca` | 使用代码代理功能 |
|
225
226
|
| `jarvis-dev` | - | 使用dev功能(开发中) |
|
226
227
|
| `jarvis-git-squash` | - | 使用git squash功能 |
|
227
228
|
| `jarvis-multi-agent` | - | 使用多代理功能 |
|
@@ -230,6 +231,54 @@ OPENAI_API_BASE: https://api.openai.com/v1 # 可选,默认为官方API地址
|
|
230
231
|
| `jarvis-git-details` | - | 使用git details功能 |
|
231
232
|
| `jarvis-methodology` | - | 使用方法论功能 |
|
232
233
|
|
234
|
+
## 💻 代码代理功能 (jarvis-code-agent)
|
235
|
+
|
236
|
+
`jarvis-code-agent` 是Jarvis的代码分析与修改工具,主要功能包括:
|
237
|
+
|
238
|
+
### 1. 核心功能
|
239
|
+
- 代码分析与修改
|
240
|
+
- 代码审查与优化
|
241
|
+
- 自动化git操作
|
242
|
+
- 代码问题诊断与修复
|
243
|
+
|
244
|
+
### 2. 使用方式
|
245
|
+
```bash
|
246
|
+
# 基本用法
|
247
|
+
jarvis-code-agent
|
248
|
+
|
249
|
+
# 或使用快捷命令
|
250
|
+
jca
|
251
|
+
|
252
|
+
# 带参数使用
|
253
|
+
jarvis-code-agent -p <平台> -m <模型> -r "需求描述"
|
254
|
+
```
|
255
|
+
|
256
|
+
### 3. 命令行参数
|
257
|
+
| 参数 | 描述 |
|
258
|
+
|------|------|
|
259
|
+
| `-p/--platform` | 指定AI平台 (yuanbao/kimi/tongyi/openai) |
|
260
|
+
| `-m/--model` | 指定模型名称 |
|
261
|
+
| `-r/--requirement` | 直接指定需求描述 |
|
262
|
+
|
263
|
+
### 4. 工作流程
|
264
|
+
1. 初始化环境 (查找git根目录,检查未提交修改)
|
265
|
+
2. 分析用户需求
|
266
|
+
3. 执行代码修改
|
267
|
+
4. 自动处理git提交
|
268
|
+
5. 显示修改结果
|
269
|
+
|
270
|
+
### 5. 示例
|
271
|
+
```bash
|
272
|
+
# 使用默认平台分析代码
|
273
|
+
jca
|
274
|
+
|
275
|
+
# 指定平台和模型
|
276
|
+
jca -p yuanbao -m deep_seek_v3
|
277
|
+
|
278
|
+
# 直接处理需求
|
279
|
+
jca -r "修复src/example.py中的内存泄漏问题"
|
280
|
+
```
|
281
|
+
|
233
282
|
## 🏗️ 平台管理功能
|
234
283
|
|
235
284
|
`jarvis-platform-manager` 提供以下子命令来管理AI平台和模型:
|
@@ -1,5 +1,5 @@
|
|
1
|
-
jarvis/__init__.py,sha256=
|
2
|
-
jarvis/jarvis_agent/__init__.py,sha256=
|
1
|
+
jarvis/__init__.py,sha256=oHw83eIzlzJqE2Znlnyp9V52XTDkbZbDoc4YaousSQE,74
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=CGHvKB5M12j442PFJn490TXk_Y5i6s58Q7LKH5v8V5U,30964
|
3
3
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=f4DaEHPakXcAbgykFP-tiOQP6fh_yGFlZx_h91_j2tQ,1529
|
4
4
|
jarvis/jarvis_agent/file_input_handler.py,sha256=OfoYI5on6w5BDUUg4OadFcfWzMsUF70GNrlt9QyauvA,4181
|
5
5
|
jarvis/jarvis_agent/jarvis.py,sha256=zfYlwXaZJYfwvNeU5IUSlURyY0pn7QxsHmXBqSptUo8,6105
|
@@ -7,7 +7,7 @@ jarvis/jarvis_agent/main.py,sha256=miR8wnWBzmbhOfnscyiKo1oI4wZBRU6FEE-k1lkqtiI,2
|
|
7
7
|
jarvis/jarvis_agent/output_handler.py,sha256=7qori-RGrQmdiFepoEe3oPPKJIvRt90l_JDmvCoa4zA,1219
|
8
8
|
jarvis/jarvis_agent/shell_input_handler.py,sha256=pi3AtPKrkKc6K9e99S1djKXQ_XrxtP6FrSWebQmRT6E,1261
|
9
9
|
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
jarvis/jarvis_code_agent/code_agent.py,sha256=
|
10
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=r9X1eJ0nexqmSjyTrsvT0DKokeYDws0iu83HFjz8XPU,15501
|
11
11
|
jarvis/jarvis_code_agent/lint.py,sha256=TZlhNbeaoLzO9DzExjN5GAjrt66owd8lyQV56LTfkrs,4370
|
12
12
|
jarvis/jarvis_code_analysis/code_review.py,sha256=45MPcXullg55w6E0Xhm2dDj6TGmkUxNNI2LJWexnTKQ,30123
|
13
13
|
jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=cKQ_FOGy5TQgM-YkRCqORo-mUOZaPAJ9VDmZoFX58us,78
|
@@ -43,17 +43,17 @@ jarvis/jarvis_mcp/__init__.py,sha256=NF_vqRxaNyz8ColcpRh0bOkinV90YLAKHEN--jkP-B8
|
|
43
43
|
jarvis/jarvis_mcp/sse_mcp_client.py,sha256=QNA7HqFvLbvhNaFp3ZsXzs2Rm6_gHUMcpd4t4qAzymY,23485
|
44
44
|
jarvis/jarvis_mcp/stdio_mcp_client.py,sha256=IEkas4ojP5J0TdVaUglvlEp61RyezBtuejv4lN3n1I4,11831
|
45
45
|
jarvis/jarvis_mcp/streamable_mcp_client.py,sha256=t2uKiIbKlmMsaiN9xHCZC3WTdl7mmoBuIZ_ph-QshzE,15084
|
46
|
-
jarvis/jarvis_methodology/main.py,sha256
|
46
|
+
jarvis/jarvis_methodology/main.py,sha256=-Xq1eMSIRPKdtt5hmGo9zbzNOYWGI-zZo8uYM_XbFX8,12129
|
47
47
|
jarvis/jarvis_multi_agent/__init__.py,sha256=Xab5sFltJmX_9MoXqanmZs6FqKfUb2v_pG29Vk8ZXaw,4311
|
48
48
|
jarvis/jarvis_multi_agent/main.py,sha256=KeGv8sdpSgTjW6VE4-tQ8BWDC_a0aE_4R3OqzPBd5N4,1646
|
49
49
|
jarvis/jarvis_platform/__init__.py,sha256=0YnsUoM4JkIBOtImFdjfuDbrqQZT3dEaAwSJ62DrpCc,104
|
50
50
|
jarvis/jarvis_platform/base.py,sha256=MAY2Xe8WECOfisd-7_F8LXqzsIswkVwlVzXEj-D5Vlg,7186
|
51
51
|
jarvis/jarvis_platform/human.py,sha256=MkKdwZ8oY5eacjHOEjUCUwDCJJnXtlzU8o8_jJAMdaA,2566
|
52
52
|
jarvis/jarvis_platform/kimi.py,sha256=m45UlTkE3XhZZ3XfQk4degpKWsy5yrdzBHi9pDvmoZk,12100
|
53
|
-
jarvis/jarvis_platform/openai.py,sha256=
|
53
|
+
jarvis/jarvis_platform/openai.py,sha256=iXsJ52e7zGaKNho1Lzg4_rjXUwLn0wpVmWCLZ0k4xU8,4985
|
54
54
|
jarvis/jarvis_platform/registry.py,sha256=qq19f9HoISxpVf09t1oEuOgzLXP8QT1mDzWAI5ifIHc,7819
|
55
55
|
jarvis/jarvis_platform/tongyi.py,sha256=Q0MCqKofuoQpp6XiYBdgO6LA4vJPEiTvVvKGgwJcpII,21062
|
56
|
-
jarvis/jarvis_platform/yuanbao.py,sha256=
|
56
|
+
jarvis/jarvis_platform/yuanbao.py,sha256=sJ6wr92oGbTSzngttXRGQ-IeFWMEtSVNiHiQs0Buv7k,20935
|
57
57
|
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
58
58
|
jarvis/jarvis_platform_manager/main.py,sha256=klN8c0IItE1wg1V2tPkh2RoEJxXXCgO--Hf7mpmY39I,29558
|
59
59
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -71,29 +71,29 @@ jarvis/jarvis_tools/file_analyzer.py,sha256=jl9phaN6BqMcgrikMeaxY-9VYXbXQOO1Zu61
|
|
71
71
|
jarvis/jarvis_tools/file_operation.py,sha256=WloC1-oPJLwgICu4WBc9f7XA8N_Ggl73QQ5CxM2XTlE,9464
|
72
72
|
jarvis/jarvis_tools/generate_new_tool.py,sha256=KZX4wpSpBZ4S5817zAN5j7AAirtgBCrNUmjrpfL9dNI,7706
|
73
73
|
jarvis/jarvis_tools/methodology.py,sha256=m7cQmVhhQpUUl_uYTVvcW0JBovQLx5pWTXh_8K77HsU,5237
|
74
|
-
jarvis/jarvis_tools/read_code.py,sha256=
|
74
|
+
jarvis/jarvis_tools/read_code.py,sha256=QkwrZc0slAZSa8p3sfTkN4FoIGqvC6CTz3vGRAdDBdI,6627
|
75
75
|
jarvis/jarvis_tools/read_webpage.py,sha256=PFAYuKjay9j6phWzyuZ99ZfNaHJljmRWAgS0bsvbcvE,2219
|
76
|
-
jarvis/jarvis_tools/registry.py,sha256=
|
76
|
+
jarvis/jarvis_tools/registry.py,sha256=mb_IcPRUNB85b41DMgoi72iWamaRbhWNZ5_UXgFJBe8,25188
|
77
77
|
jarvis/jarvis_tools/rewrite_file.py,sha256=3V2l7kG5DG9iRimBce-1qCRuJPL0QM32SBTzOl2zCqM,7004
|
78
78
|
jarvis/jarvis_tools/search_web.py,sha256=rzxrCOTEo-MmLQrKI4k-AbfidUfJUeCPK4f5ZJy48G8,952
|
79
79
|
jarvis/jarvis_tools/virtual_tty.py,sha256=8E_n-eC-RRPTqYx6BI5Q2RnorY8dbhKFBfAjIiRQROA,16397
|
80
80
|
jarvis/jarvis_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
81
|
jarvis/jarvis_tools/cli/main.py,sha256=3UuU9tk5cQAS0rfNPXgdtnAd5uDB7v0Exo0_I9sJHRE,6355
|
82
82
|
jarvis/jarvis_utils/__init__.py,sha256=x5lbQRH1uOulmWr1IEqNMLXNmDHbqQQot7d1uhKFg4M,851
|
83
|
-
jarvis/jarvis_utils/builtin_replace_map.py,sha256=
|
83
|
+
jarvis/jarvis_utils/builtin_replace_map.py,sha256=qvxnhDMnuflKvQiJgeMUi96sZgrNkZJl_MswAzOD4AA,4883
|
84
84
|
jarvis/jarvis_utils/config.py,sha256=Z7pZsSYXJkc2RzUhJ-_VvQA3xOLo6LEo4nEE1ftyQY8,7104
|
85
85
|
jarvis/jarvis_utils/embedding.py,sha256=J8YAqIEj16TJIPEG24uvUlPHeN-5zq0JW_hbNLizQug,3832
|
86
86
|
jarvis/jarvis_utils/file_processors.py,sha256=G5kQI7vCGIDnjgAB5J1dYIR102u6WUv3IhcWFfDh_gs,2977
|
87
87
|
jarvis/jarvis_utils/git_utils.py,sha256=k0rrMAbKwnD7hztmtegxtFFiCzyID4p2oHKTycE2Q-4,15070
|
88
|
-
jarvis/jarvis_utils/globals.py,sha256=
|
88
|
+
jarvis/jarvis_utils/globals.py,sha256=908DizIMrInuOlirTp5lsOfqbD6K2v18P_J7A8nrdus,3375
|
89
89
|
jarvis/jarvis_utils/input.py,sha256=FkLW7MXL8awQUghFLQnW1r5F1wV8K3EZeVPwHFRHJTo,7458
|
90
90
|
jarvis/jarvis_utils/methodology.py,sha256=6vf__ahwJZ2I62mWGAvh2C-G6pq930Dh_EkrY1VpduQ,8485
|
91
91
|
jarvis/jarvis_utils/output.py,sha256=QboL42GtG_dnvd1O64sl8o72mEBhXNRADPXQMXgDE7Q,9661
|
92
92
|
jarvis/jarvis_utils/tag.py,sha256=YJHmuedLb7_AiqvKQetHr4R1FxyzIh7HN0RRkWMmYbU,429
|
93
|
-
jarvis/jarvis_utils/utils.py,sha256=
|
94
|
-
jarvis_ai_assistant-0.1.
|
95
|
-
jarvis_ai_assistant-0.1.
|
96
|
-
jarvis_ai_assistant-0.1.
|
97
|
-
jarvis_ai_assistant-0.1.
|
98
|
-
jarvis_ai_assistant-0.1.
|
99
|
-
jarvis_ai_assistant-0.1.
|
93
|
+
jarvis/jarvis_utils/utils.py,sha256=r9Xnf84jR2E1CfHBtYVF_sPZ74-S4W63aPleBQZtdYo,11597
|
94
|
+
jarvis_ai_assistant-0.1.193.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
95
|
+
jarvis_ai_assistant-0.1.193.dist-info/METADATA,sha256=RJAXtk8b0Exd0ZgfEW7jzt9NE7M8iFFFN-uXrf7VYu4,18901
|
96
|
+
jarvis_ai_assistant-0.1.193.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
97
|
+
jarvis_ai_assistant-0.1.193.dist-info/entry_points.txt,sha256=Gy3DOP1PYLMK0GCj4rrP_9lkOyBQ39EK_lKGUSwn41E,869
|
98
|
+
jarvis_ai_assistant-0.1.193.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
99
|
+
jarvis_ai_assistant-0.1.193.dist-info/RECORD,,
|
File without changes
|
{jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/entry_points.txt
RENAMED
File without changes
|
{jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{jarvis_ai_assistant-0.1.191.dist-info → jarvis_ai_assistant-0.1.193.dist-info}/top_level.txt
RENAMED
File without changes
|