jarvis-ai-assistant 0.1.221__py3-none-any.whl → 0.1.223__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Jarvis AI Assistant"""
3
3
 
4
- __version__ = "0.1.221"
4
+ __version__ = "0.1.223"
@@ -26,6 +26,10 @@ from jarvis.jarvis_platform.registry import PlatformRegistry
26
26
  # jarvis_utils 相关
27
27
  from jarvis.jarvis_utils.config import (
28
28
  get_max_token_count,
29
+ get_normal_model_name,
30
+ get_normal_platform_name,
31
+ get_thinking_model_name,
32
+ get_thinking_platform_name,
29
33
  is_execute_tool_confirm,
30
34
  is_use_analysis,
31
35
  is_use_methodology,
@@ -93,8 +97,7 @@ class Agent:
93
97
  system_prompt: str,
94
98
  name: str = "Jarvis",
95
99
  description: str = "",
96
- platform: Union[Optional[BasePlatform], Optional[str]] = None,
97
- model_name: Optional[str] = None,
100
+ llm_type: str = "normal",
98
101
  summary_prompt: Optional[str] = None,
99
102
  auto_complete: bool = False,
100
103
  output_handler: List[OutputHandlerProtocol] = [],
@@ -114,8 +117,7 @@ class Agent:
114
117
  system_prompt: 系统提示词,定义Agent的行为准则
115
118
  name: Agent名称,默认为"Jarvis"
116
119
  description: Agent描述信息
117
- platform: 平台实例或平台名称字符串
118
- model_name: 使用的模型名称
120
+ llm_type: LLM类型,可以是 'normal' 或 'thinking'
119
121
  summary_prompt: 任务总结提示模板
120
122
  auto_complete: 是否自动完成任务
121
123
  output_handler: 输出处理器列表
@@ -130,22 +132,21 @@ class Agent:
130
132
  self.name = make_agent_name(name)
131
133
  self.description = description
132
134
  # 初始化平台和模型
133
- if platform is not None:
134
- if isinstance(platform, str):
135
- self.model = PlatformRegistry().create_platform(platform)
136
- if self.model is None:
137
- PrettyOutput.print(
138
- f"平台 {platform} 不存在,将使用普通模型", OutputType.WARNING
139
- )
140
- self.model = PlatformRegistry().get_normal_platform()
141
- else:
142
- self.model = platform
143
- else:
144
- self.model = (
145
- PlatformRegistry.get_global_platform_registry().get_normal_platform()
135
+ if llm_type == "thinking":
136
+ platform_name = get_thinking_platform_name()
137
+ model_name = get_thinking_model_name()
138
+ else: # 默认为 normal
139
+ platform_name = get_normal_platform_name()
140
+ model_name = get_normal_model_name()
141
+
142
+ self.model = PlatformRegistry().create_platform(platform_name)
143
+ if self.model is None:
144
+ PrettyOutput.print(
145
+ f"平台 {platform_name} 不存在,将使用普通模型", OutputType.WARNING
146
146
  )
147
+ self.model = PlatformRegistry().get_normal_platform()
147
148
 
148
- if model_name is not None:
149
+ if model_name:
149
150
  self.model.set_model_name(model_name)
150
151
 
151
152
  self.user_data: Dict[str, Any] = {}
@@ -198,7 +199,7 @@ class Agent:
198
199
 
199
200
  PrettyOutput.print(welcome_message, OutputType.SYSTEM)
200
201
 
201
- action_prompt = build_action_prompt(self.output_handler) # type: ignore
202
+ action_prompt = build_action_prompt(self.output_handler) # type: ignore
202
203
 
203
204
  self.model.set_system_prompt(
204
205
  f"""
@@ -245,7 +246,10 @@ class Agent:
245
246
 
246
247
  def restore_session(self) -> bool:
247
248
  """Restores the session state by delegating to the session manager."""
248
- return self.session.restore_session()
249
+ if self.session.restore_session():
250
+ self.first = False
251
+ return True
252
+ return False
249
253
 
250
254
  def get_tool_registry(self) -> Optional[Any]:
251
255
  """获取工具注册表实例"""
@@ -39,12 +39,9 @@ def builtin_input_handler(user_input: str, agent_: Any) -> Tuple[str, bool]:
39
39
  return "", True
40
40
  elif tag == "ToolUsage":
41
41
  from jarvis.jarvis_tools.registry import ToolRegistry
42
-
43
- tool_registry_ = agent.get_tool_registry()
44
- tool_registry: ToolRegistry = (
45
- tool_registry_ if tool_registry_ else ToolRegistry()
46
- )
47
- agent.set_addon_prompt(tool_registry.prompt())
42
+ from jarvis.jarvis_agent.prompt_builder import build_action_prompt
43
+ action_prompt = build_action_prompt(agent.output_handler) # type: ignore
44
+ agent.set_addon_prompt(action_prompt)
48
45
  return "", False
49
46
  elif tag == "ReloadConfig":
50
47
  from jarvis.jarvis_utils.utils import load_config
@@ -109,8 +109,13 @@ def _select_task(tasks: Dict[str, str]) -> str:
109
109
  def main() -> None:
110
110
 
111
111
  parser = argparse.ArgumentParser(description="Jarvis AI assistant")
112
- parser.add_argument("-p", "--platform", type=str, help="Platform to use")
113
- parser.add_argument("-m", "--model", type=str, help="Model to use")
112
+ parser.add_argument(
113
+ "--llm_type",
114
+ type=str,
115
+ default="normal",
116
+ choices=["normal", "thinking"],
117
+ help="LLM type to use",
118
+ )
114
119
  parser.add_argument(
115
120
  "-t",
116
121
  "--task",
@@ -132,8 +137,7 @@ def main() -> None:
132
137
  try:
133
138
  agent = Agent(
134
139
  system_prompt=origin_agent_system_prompt,
135
- platform=args.platform,
136
- model_name=args.model,
140
+ llm_type=args.llm_type,
137
141
  input_handler=[shell_input_handler, builtin_input_handler],
138
142
  output_handler=[ToolRegistry()],
139
143
  need_summary=False,
@@ -151,11 +155,12 @@ def main() -> None:
151
155
  agent.run(args.task)
152
156
  sys.exit(0)
153
157
 
154
- tasks = _load_tasks()
155
- if tasks and (selected_task := _select_task(tasks)):
156
- PrettyOutput.print(f"开始执行任务: \n{selected_task}", OutputType.INFO)
157
- agent.run(selected_task)
158
- sys.exit(0)
158
+ if agent.first:
159
+ tasks = _load_tasks()
160
+ if tasks and (selected_task := _select_task(tasks)):
161
+ PrettyOutput.print(f"开始执行任务: \n{selected_task}", OutputType.INFO)
162
+ agent.run(selected_task)
163
+ sys.exit(0)
159
164
 
160
165
  user_input = get_multiline_input("请输入你的任务(输入空行退出):")
161
166
  if user_input:
@@ -20,9 +20,7 @@ def load_config(config_path: str) -> dict:
20
20
  dict: 配置字典
21
21
  """
22
22
  if not os.path.exists(config_path):
23
- PrettyOutput.print(
24
- f"配置文件 {config_path} 不存在,使用默认配置", OutputType.WARNING
25
- )
23
+ PrettyOutput.print(f"配置文件 {config_path} 不存在,使用默认配置", OutputType.WARNING)
26
24
  return {}
27
25
 
28
26
  with open(config_path, "r", encoding="utf-8", errors="ignore") as f:
@@ -45,16 +43,25 @@ def main():
45
43
  "-c", "--agent_definition", type=str, help="Path to agent definition file"
46
44
  )
47
45
  parser.add_argument("-t", "--task", type=str, help="Initial task to execute")
46
+ parser.add_argument(
47
+ "--llm_type",
48
+ type=str,
49
+ default="normal",
50
+ choices=["normal", "thinking"],
51
+ help="LLM type to use, overriding config",
52
+ )
48
53
  args = parser.parse_args()
49
54
 
50
55
  # Initialize environment
51
- init_env(
52
- "欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config
53
- )
56
+ init_env("欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config)
54
57
 
55
58
  # Load configuration
56
59
  config = load_config(args.agent_definition) if args.agent_definition else {}
57
60
 
61
+ # Override config with command-line arguments if provided
62
+ if args.llm_type:
63
+ config["llm_type"] = args.llm_type
64
+
58
65
  # Create and run agent
59
66
  try:
60
67
  agent = Agent(**config)
@@ -18,7 +18,7 @@ from jarvis.jarvis_code_agent.lint import get_lint_tools
18
18
  from jarvis.jarvis_git_utils.git_commiter import GitCommitTool
19
19
  from jarvis.jarvis_platform.registry import PlatformRegistry
20
20
  from jarvis.jarvis_tools.registry import ToolRegistry
21
- from jarvis.jarvis_utils.config import is_confirm_before_apply_patch
21
+ from jarvis.jarvis_utils.config import is_confirm_before_apply_patch, is_enable_static_analysis
22
22
  from jarvis.jarvis_utils.git_utils import (
23
23
  confirm_add_new_files,
24
24
  find_git_root_and_cd,
@@ -43,8 +43,7 @@ class CodeAgent:
43
43
 
44
44
  def __init__(
45
45
  self,
46
- platform: Optional[str] = None,
47
- model: Optional[str] = None,
46
+ llm_type: str = "normal",
48
47
  need_summary: bool = True,
49
48
  ):
50
49
  self.root_dir = os.getcwd()
@@ -113,21 +112,12 @@ class CodeAgent:
113
112
  10. 我不订阅闲 AI
114
113
  </say_to_llm>
115
114
  """
116
- # 处理platform参数
117
- platform_instance = (
118
- PlatformRegistry().create_platform(platform) # type: ignore
119
- if platform
120
- else PlatformRegistry().get_normal_platform()
121
- ) # type: ignore
122
- if model:
123
- platform_instance.set_model_name(model) # type: ignore
124
-
125
115
  self.agent = Agent(
126
116
  system_prompt=code_system_prompt,
127
117
  name="CodeAgent",
128
118
  auto_complete=False,
129
119
  output_handler=[tool_registry, EditFileHandler()],
130
- platform=platform_instance,
120
+ llm_type=llm_type,
131
121
  input_handler=[shell_input_handler, builtin_input_handler],
132
122
  need_summary=need_summary,
133
123
  use_methodology=False, # 禁用方法论
@@ -374,7 +364,7 @@ class CodeAgent:
374
364
  if lint_tools_info
375
365
  else ""
376
366
  )
377
- if lint_tools_info:
367
+ if lint_tools_info and is_enable_static_analysis():
378
368
  addon_prompt = f"""
379
369
  请对以下修改的文件进行静态扫描:
380
370
  {file_list}
@@ -413,10 +403,11 @@ def main() -> None:
413
403
 
414
404
  parser = argparse.ArgumentParser(description="Jarvis Code Agent")
415
405
  parser.add_argument(
416
- "-p", "--platform", type=str, help="Target platform name", default=None
417
- )
418
- parser.add_argument(
419
- "-m", "--model", type=str, help="Model name to use", default=None
406
+ "--llm_type",
407
+ type=str,
408
+ default="normal",
409
+ choices=["normal", "thinking"],
410
+ help="LLM type to use",
420
411
  )
421
412
  parser.add_argument(
422
413
  "-r", "--requirement", type=str, help="Requirement to process", default=None
@@ -434,7 +425,7 @@ def main() -> None:
434
425
  PrettyOutput.print(f"当前目录: {git_dir}", OutputType.INFO)
435
426
 
436
427
  try:
437
- agent = CodeAgent(platform=args.platform, model=args.model, need_summary=False)
428
+ agent = CodeAgent(llm_type=args.llm_type, need_summary=False)
438
429
 
439
430
  # 尝试恢复会话
440
431
  if args.restore_session:
@@ -638,7 +638,7 @@ class CodeReviewTool:
638
638
  [在此处插入完整MARKDOWN格式的审查报告]
639
639
  {ct("REPORT")}""",
640
640
  output_handler=[tool_registry],
641
- platform=PlatformRegistry().get_thinking_platform(),
641
+ llm_type="thinking",
642
642
  auto_complete=False,
643
643
  )
644
644
 
@@ -181,6 +181,11 @@
181
181
  "description": "是否打印提示",
182
182
  "default": false
183
183
  },
184
+ "JARVIS_ENABLE_STATIC_ANALYSIS": {
185
+ "type": "boolean",
186
+ "description": "是否启用静态代码分析",
187
+ "default": true
188
+ },
184
189
  "JARVIS_RAG": {
185
190
  "type": "object",
186
191
  "description": "RAG框架的配置",
@@ -199,7 +199,7 @@ class GitCommitAnalyzer:
199
199
  [检查代码是否符合行业最佳实践和项目规范]
200
200
  {ct("REPORT")}""",
201
201
  output_handler=[tool_registry],
202
- platform=PlatformRegistry().get_normal_platform(),
202
+ llm_type="normal",
203
203
  auto_complete=True,
204
204
  )
205
205
 
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import re
3
- from typing import Any, Dict, List, Tuple
3
+ from typing import Any, Dict, List, Optional, Tuple
4
4
 
5
5
  import yaml
6
6
 
@@ -14,9 +14,10 @@ from jarvis.jarvis_utils.tag import ct, ot
14
14
  class MultiAgent(OutputHandler):
15
15
  def __init__(self, agents_config: List[Dict], main_agent_name: str):
16
16
  self.agents_config = agents_config
17
- self.agents = {}
18
- self.init_agents()
17
+ self.agents_config_map = {c["name"]: c for c in agents_config}
18
+ self.agents: Dict[str, Agent] = {}
19
19
  self.main_agent_name = main_agent_name
20
+ self.original_question: Optional[str] = None
20
21
 
21
22
  def prompt(self) -> str:
22
23
  return f"""
@@ -101,43 +102,85 @@ content: |2
101
102
  continue
102
103
  return ret
103
104
 
104
- def init_agents(self):
105
- for config in self.agents_config:
106
- output_handler = config.get("output_handler", [])
107
- if len(output_handler) == 0:
108
- output_handler = [
109
- ToolRegistry(),
110
- self,
111
- ]
112
- else:
105
+ def _get_agent(self, name: str) -> Agent | None:
106
+ if name in self.agents:
107
+ return self.agents[name]
108
+
109
+ if name not in self.agents_config_map:
110
+ return None
111
+
112
+ config = self.agents_config_map[name].copy()
113
+
114
+ if name != self.main_agent_name and self.original_question:
115
+ system_prompt = config.get("system_prompt", "")
116
+ config["system_prompt"] = (
117
+ f"{system_prompt}\n\n# 原始问题\n{self.original_question}"
118
+ )
119
+
120
+ output_handler = config.get("output_handler", [])
121
+ if len(output_handler) == 0:
122
+ output_handler = [
123
+ ToolRegistry(),
124
+ self,
125
+ ]
126
+ else:
127
+ if not any(isinstance(h, MultiAgent) for h in output_handler):
113
128
  output_handler.append(self)
114
- config["output_handler"] = output_handler
115
- agent = Agent(**config)
116
- self.agents[config["name"]] = agent
129
+ config["output_handler"] = output_handler
130
+
131
+ agent = Agent(**config)
132
+ self.agents[name] = agent
133
+ return agent
117
134
 
118
135
  def run(self, user_input: str) -> str:
119
- last_agent = self.main_agent_name
120
- msg = self.agents[self.main_agent_name].run(user_input)
136
+ self.original_question = user_input
137
+ last_agent_name = self.main_agent_name
138
+
139
+ agent = self._get_agent(self.main_agent_name)
140
+ if not agent:
141
+ # This should not happen if main_agent_name is correctly configured
142
+ return f"主智能体 {self.main_agent_name} 未找到"
143
+
144
+ msg: Any = agent.run(user_input)
145
+
121
146
  while msg:
122
147
  if isinstance(msg, str):
123
148
  return msg
124
- elif isinstance(msg, Dict):
125
- prompt = f"""
149
+
150
+ if not isinstance(msg, Dict):
151
+ # Should not happen if agent.run() returns str or Dict
152
+ PrettyOutput.print(f"未知消息类型: {type(msg)}", OutputType.WARNING)
153
+ break
154
+
155
+ prompt = f"""
126
156
  Please handle this message:
127
- from: {last_agent}
157
+ from: {last_agent_name}
128
158
  content: {msg['content']}
129
159
  """
130
- if msg["to"] not in self.agents:
131
- PrettyOutput.print(
132
- f"未找到智能体 {msg['to']},正在重试...", OutputType.WARNING
133
- )
134
- msg = self.agents[last_agent].run(
135
- f"未找到智能体 {msg['to']},可用智能体列表: {self.agents.keys()}"
136
- )
137
- continue
160
+ to_agent_name = msg.get("to")
161
+ if not to_agent_name:
162
+ return f"消息中未指定 `to` 字段"
163
+
164
+ if to_agent_name not in self.agents_config_map:
138
165
  PrettyOutput.print(
139
- f"{last_agent} 正在向 {msg['to']} 发送消息...", OutputType.INFO
166
+ f"未找到智能体 {to_agent_name},正在重试...", OutputType.WARNING
140
167
  )
141
- last_agent = self.agents[msg["to"]].name
142
- msg = self.agents[msg["to"]].run(prompt)
168
+ agent = self._get_agent(last_agent_name)
169
+ if not agent:
170
+ return f"智能体 {last_agent_name} 未找到"
171
+ msg = agent.run(
172
+ f"未找到智能体 {to_agent_name},可用智能体列表: {list(self.agents_config_map.keys())}"
173
+ )
174
+ continue
175
+
176
+ PrettyOutput.print(
177
+ f"{last_agent_name} 正在向 {to_agent_name} 发送消息...", OutputType.INFO
178
+ )
179
+
180
+ agent = self._get_agent(to_agent_name)
181
+ if not agent:
182
+ return f"智能体 {to_agent_name} 未找到"
183
+
184
+ last_agent_name = agent.name
185
+ msg = agent.run(prompt)
143
186
  return ""
@@ -24,8 +24,9 @@ class KimiModel(BasePlatform):
24
24
  def get_model_list(self) -> List[Tuple[str, str]]:
25
25
  """Get model list"""
26
26
  return [
27
- ("kimi", "基于网页的 Kimi,免费接口"),
28
- ("k1", "基于网页的 Kimi,深度思考模型"),
27
+ ("k1.5", "基于网页的 Kimi,免费接口"),
28
+ ("k1.5-thinking", "基于网页的 Kimi,深度思考模型"),
29
+ ("k2", "基于网页的 Kimi,深度思考模型 K2"),
29
30
  ]
30
31
 
31
32
  def __init__(self):
@@ -278,8 +279,9 @@ class KimiModel(BasePlatform):
278
279
  "use_search": True if self.web else False,
279
280
  "extend": {"sidebar": True},
280
281
  "kimiplus_id": "kimi",
281
- "use_research": False,
282
- "use_math": False,
282
+ "use_deep_research": False,
283
+ "use_semantic_memory": True,
284
+ "history": [],
283
285
  "refs": refs,
284
286
  "refs_file": refs_file,
285
287
  "model": self.model_name,
@@ -241,6 +241,16 @@ def is_print_prompt() -> bool:
241
241
  return GLOBAL_CONFIG_DATA.get("JARVIS_PRINT_PROMPT", False) == True
242
242
 
243
243
 
244
+ def is_enable_static_analysis() -> bool:
245
+ """
246
+ 获取是否启用静态代码分析。
247
+
248
+ 返回:
249
+ bool: 如果启用静态代码分析则返回True,默认为True
250
+ """
251
+ return GLOBAL_CONFIG_DATA.get("JARVIS_ENABLE_STATIC_ANALYSIS", True) is True
252
+
253
+
244
254
  def get_mcp_config() -> List[Dict[str, Any]]:
245
255
  """
246
256
  获取MCP配置列表。
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.221
3
+ Version: 0.1.223
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
@@ -117,18 +117,19 @@ pip3 install jarvis-ai-assistant
117
117
  ### 基本使用
118
118
  | 命令 | 快捷方式 | 功能描述 |
119
119
  |------|----------|----------|
120
- | `jarvis` | - | 使用通用代理 |
120
+ | `jarvis` | `jvs` | 使用通用代理 |
121
121
  | `jarvis-code-agent` | `jca` | 使用代码代理 |
122
122
  | `jarvis-smart-shell` | `jss` | 使用智能shell功能 |
123
123
  | `jarvis-platform-manager` | `jpm` | 使用平台管理功能 |
124
- | `jarvis-code-review` | - | 使用代码审查功能 |
124
+ | `jarvis-code-review` | `jcr` | 使用代码审查功能 |
125
125
  | `jarvis-git-commit` | `jgc` | 使用自动化git commit功能 |
126
- | `jarvis-git-squash` | - | 使用git squash功能 |
127
- | `jarvis-multi-agent` | - | 使用多代理功能 |
128
- | `jarvis-agent` | - | 使用agent功能 |
129
- | `jarvis-tool` | - | 使用工具功能 |
130
- | `jarvis-git-details` | - | 使用git details功能 |
131
- | `jarvis-methodology` | - | 使用方法论功能 |
126
+ | `jarvis-git-squash` | `jgs` | 使用git squash功能 |
127
+ | `jarvis-multi-agent` | `jma` | 使用多代理功能 |
128
+ | `jarvis-agent` | `ja` | 使用agent功能 |
129
+ | `jarvis-tool` | `jt` | 使用工具功能 |
130
+ | `jarvis-git-details` | `jgd` | 使用git details功能 |
131
+ | `jarvis-methodology` | `jm` | 使用方法论功能 |
132
+ | `jarvis-rag` | `jrg` | 使用RAG功能 |
132
133
 
133
134
  ### Jarvis功能 (jarvis)
134
135
 
@@ -147,15 +148,16 @@ pip3 install jarvis-ai-assistant
147
148
  jarvis
148
149
 
149
150
  # 带参数使用
150
- jarvis -p <平台> -m <模型> -t "初始任务"
151
+ jarvis --llm_type thinking -t "初始任务"
151
152
  ```
152
153
 
153
154
  #### 3. 命令行参数
154
155
  | 参数 | 描述 |
155
156
  |------|------|
156
- | `-p/--platform` | 指定AI平台 (yuanbao/kimi/tongyi/openai) |
157
- | `-m/--model` | 指定模型名称 |
158
- | `-t/--task` | 指定初始任务 |
157
+ | `--llm_type` | 使用的LLM类型 (normal/thinking) |
158
+ | `-t/--task` | 直接从命令行输入任务内容 |
159
+ | `-f/--config` | 自定义配置文件的路径 |
160
+ | `--restore-session` | 从 .jarvis/saved_session.json 恢复会话 |
159
161
 
160
162
  #### 4. 工作流程
161
163
  1. 初始化环境
@@ -177,14 +179,14 @@ jarvis -p <平台> -m <模型> -t "初始任务"
177
179
  # 基本使用
178
180
  jarvis
179
181
 
180
- # 指定平台和模型
181
- jarvis -p yuanbao -m deep_seek_v3
182
+ # 指定LLM类型
183
+ jarvis --llm_type thinking
182
184
 
183
185
  # 直接执行任务
184
186
  jarvis -t "分析项目结构并生成架构图"
185
187
 
186
188
  # 组合使用
187
- jarvis -p kimi -m k1 -t "优化项目性能"
189
+ jarvis --llm_type thinking -t "优化项目性能"
188
190
  ```
189
191
 
190
192
  ### 代码代理功能 (jarvis-code-agent)
@@ -206,15 +208,15 @@ jarvis-code-agent
206
208
  jca
207
209
 
208
210
  # 带参数使用
209
- jarvis-code-agent -p <平台> -m <模型> -r "需求描述"
211
+ jarvis-code-agent --llm_type thinking -r "需求描述"
210
212
  ```
211
213
 
212
214
  #### 3. 命令行参数
213
215
  | 参数 | 描述 |
214
216
  |------|------|
215
- | `-p/--platform` | 指定AI平台 (yuanbao/kimi/tongyi/openai) |
216
- | `-m/--model` | 指定模型名称 |
217
- | `-r/--requirement` | 直接指定需求描述 |
217
+ | `--llm_type` | 使用的LLM类型 (normal/thinking) |
218
+ | `-r/--requirement` | 要处理的需求 |
219
+ | `--restore-session` | .jarvis/saved_session.json 恢复会话 |
218
220
 
219
221
  #### 4. 工作流程
220
222
  1. 初始化环境(查找git根目录,检查未提交修改)
@@ -228,8 +230,8 @@ jarvis-code-agent -p <平台> -m <模型> -r "需求描述"
228
230
  # 使用默认平台分析代码
229
231
  jca
230
232
 
231
- # 指定平台和模型
232
- jca -p yuanbao -m deep_seek_v3
233
+ # 指定LLM类型
234
+ jca --llm_type thinking
233
235
 
234
236
  # 直接处理需求
235
237
  jca -r "修复src/example.py中的内存泄漏问题"
@@ -337,6 +339,7 @@ jarvis-agent -f <配置文件> -c <代理定义文件> -t "初始任务"
337
339
  | `-f/--config` | 指定配置文件路径(可选) |
338
340
  | `-c/--agent_definition` | 指定代理定义文件路径(可选) |
339
341
  | `-t/--task` | 指定初始任务(可选) |
342
+ | `--llm_type` | 使用的LLM类型 (normal/thinking),会覆盖配置文件中的设置 |
340
343
 
341
344
  #### 4. 配置文件格式
342
345
  代理定义文件使用YAML格式:
@@ -412,6 +415,8 @@ jarvis-platform-manager chat -p <平台名称> -m <模型名称>
412
415
  - `/shell <命令>` - 执行shell命令
413
416
  - `/save <文件名>` - 保存最后一条消息
414
417
  - `/saveall <文件名>` - 保存完整对话历史
418
+ - `/save_session <文件名>` - 保存当前会话状态
419
+ - `/load_session <文件名>` - 加载会话状态
415
420
 
416
421
  ##### 2.3 启动API服务
417
422
  ```bash
@@ -429,6 +434,7 @@ jarvis-platform-manager service --host <IP地址> --port <端口号> -p <平台
429
434
  ```bash
430
435
  # 加载角色配置文件并开始对话
431
436
  jarvis-platform-manager role -c <配置文件路径>
437
+ # 配置文件默认为 ~/.jarvis/roles.yaml
432
438
  ```
433
439
 
434
440
  角色配置文件格式(YAML):
@@ -546,6 +552,7 @@ OPENAI_API_BASE: https://api.openai.com/v1
546
552
  | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
547
553
  | `JARVIS_USE_METHODOLOGY` | true | 是否启用方法论功能 |
548
554
  | `JARVIS_USE_ANALYSIS` | true | 是否启用任务分析功能 |
555
+ | `JARVIS_ENABLE_STATIC_ANALYSIS` | true | 是否启用静态代码分析 |
549
556
  | `JARVIS_DATA_PATH` | ~/.jarvis | Jarvis数据存储目录路径 |
550
557
  | `JARVIS_RAG` | `{"embedding_model": "BAAI/bge-base-zh-v1.5"}` | RAG框架的配置 |
551
558
 
@@ -602,14 +609,36 @@ jarvis-rag add README.md ./docs/ 'src/jarvis/jarvis_rag/*.py'
602
609
 
603
610
  **参数与选项:**
604
611
 
612
+ | 参数/选项 | 描述 |
613
+ |---|---|
605
614
  | 参数/选项 | 描述 |
606
615
  |---|---|
607
616
  | `paths` | **[必需]** 一个或多个文件路径、目录路径或用引号包裹的通配符模式。 |
608
- | `--collection` | 指定知识库的集合名称(默认为 `jarvis_rag_collection`)。 |
609
- | `--embedding-model` | 覆盖全局配置,强制使用特定的嵌入模型名称。 |
617
+ | `--collection` / `-c` | 指定知识库的集合名称(默认为 `jarvis_rag_collection`)。 |
618
+ | `--embedding-model` / `-e` | 覆盖全局配置,强制使用特定的嵌入模型名称。 |
610
619
  | `--db-path` | 覆盖全局配置,指定向量数据库的存储路径。 |
620
+ | `--batch-size` / `-b` | 单个批次中要处理的文档数(默认为 500)。 |
621
+
622
+ ##### 2.2 列出知识库中的文档 (`list-docs`)
611
623
 
612
- ##### 2.2 查询知识库 (`query`)
624
+ 此命令用于列出知识库中所有唯一的文档来源。
625
+
626
+ ```bash
627
+ # 基本用法
628
+ jarvis-rag list-docs
629
+
630
+ # 指定集合
631
+ jarvis-rag list-docs --collection my_collection
632
+ ```
633
+
634
+ **参数与选项:**
635
+
636
+ | 参数/选项 | 描述 |
637
+ |---|---|
638
+ | `--collection` / `-c` | 指定要查询的知识库集合名称。 |
639
+ | `--db-path` | 覆盖全局配置,指定向量数据库的存储路径。 |
640
+
641
+ ##### 2.3 查询知识库 (`query`)
613
642
 
614
643
  此命令用于向已建立的知识库提出问题。
615
644
 
@@ -622,18 +651,20 @@ jarvis-rag query "你的问题"
622
651
  jarvis-rag query "请总结一下我添加的文档的核心内容"
623
652
 
624
653
  # 2. 指定使用Kimi模型进行查询
625
- jarvis-rag query "代码中的 'PlatformRegistry' 类是做什么用的?" --platform kimi --model moonshot-v1-8k
654
+ jarvis-rag query "代码中的 'PlatformRegistry' 类是做什么用的?" --platform kimi --model kimi
626
655
  ```
627
656
 
628
657
  **参数与选项:**
629
658
 
659
+ | 参数/选项 | 描述 |
660
+ |---|---|
630
661
  | 参数/选项 | 描述 |
631
662
  |---|---|
632
663
  | `question` | **[必需]** 你要向知识库提出的问题。 |
633
- | `--collection` | 指定要查询的知识库集合名称。 |
634
- | `--platform` | 指定一个平台名称来回答问题,覆盖默认的“思考”模型。 |
635
- | `--model` | 指定一个模型名称来回答问题,需要与 `--platform` 同时使用。 |
636
- | `--embedding-model` | 覆盖全局配置,强制使用特定的嵌入模型名称。 |
664
+ | `--collection` / `-c` | 指定要查询的知识库集合名称。 |
665
+ | `--platform` / `-p` | 指定一个平台名称来回答问题,覆盖默认的“思考”模型。 |
666
+ | `--model` / `-m` | 指定一个模型名称来回答问题,需要与 `--platform` 同时使用。 |
667
+ | `--embedding-model` / `-e` | 覆盖全局配置,强制使用特定的嵌入模型名称。 |
637
668
 
638
669
  ### 3. 命令替换功能
639
670
  支持使用特殊标记`'<tag>'`触发命令替换功能:
@@ -1,9 +1,9 @@
1
- jarvis/__init__.py,sha256=TgbmsIAvNeODBETy0s6gdVjK6p08SbEz7rEqI5VYYmw,75
2
- jarvis/jarvis_agent/__init__.py,sha256=gjN3tUhHMmX3oAaAyAid4pkCW2R3zDnWLwF_qqRnix4,21443
3
- jarvis/jarvis_agent/builtin_input_handler.py,sha256=lcw-VBm8-CVcblxEbGU4dVD6IixgXTLz9uBrv9Y6p20,2710
1
+ jarvis/__init__.py,sha256=YlYf-txS383hefwOHMnCEByeqa-lDVLEbMwcCc7hY3Q,75
2
+ jarvis/jarvis_agent/__init__.py,sha256=l37t2lnXsPeQEwPkqrQWmqQ0ogh37GY-iAOQxkjttzY,21479
3
+ jarvis/jarvis_agent/builtin_input_handler.py,sha256=MtPm7N78hPJJJ9PV_p8pkyDE7epBmtngrE9Xn-wbnH8,2682
4
4
  jarvis/jarvis_agent/edit_file_handler.py,sha256=ml1o-BE2Ca1-ybPlKuhstLQYwdJag39o0_-PXTUvFaE,11646
5
- jarvis/jarvis_agent/jarvis.py,sha256=4LBtAh9_AuQcjvqBFInqY19eyEJVJtGH4py32yu8olc,6287
6
- jarvis/jarvis_agent/main.py,sha256=c6bQe-8LXvW2-NBn9Rn_yPYdrwnkJ8KQaSFY2cPvkxw,2775
5
+ jarvis/jarvis_agent/jarvis.py,sha256=2Ilt-eLs-dCvD6V1-UGyJ3PleY0AozkYhi8Rx6_zUr4,6315
6
+ jarvis/jarvis_agent/main.py,sha256=nXOw2mewhYYmj_8rohcEmETjUFqror1NiRwDusFMUKQ,3055
7
7
  jarvis/jarvis_agent/output_handler.py,sha256=P7oWpXBGFfOsWq7cIhS_z9crkQ19ES7qU5pM92KKjAs,1172
8
8
  jarvis/jarvis_agent/prompt_builder.py,sha256=PH1fPDVa8z_RXkoXHJFNDf8PQjUoLNLYwkh2lC__p40,1705
9
9
  jarvis/jarvis_agent/prompts.py,sha256=e8i-3kaGr96mlzL3UUhQUHFDfbJSoE4xiF9TDksNDm4,7720
@@ -12,9 +12,9 @@ jarvis/jarvis_agent/session_manager.py,sha256=DnvI9rWkVmkyO1XfKZyo9lTn4ajg4ccwzE
12
12
  jarvis/jarvis_agent/shell_input_handler.py,sha256=1IboqdxcJuoIqRpmDU10GugR9fWXUHyCEbVF4nIWbyo,1328
13
13
  jarvis/jarvis_agent/tool_executor.py,sha256=nIq-sPNgrtimtM-IHpN09cWmId8jDzWRdCFoRzXnnoo,1721
14
14
  jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- jarvis/jarvis_code_agent/code_agent.py,sha256=MnIQMuSpBM-0u8gmXthpRhPQGCBOmK7nK9OCpTwoq6c,18763
15
+ jarvis/jarvis_code_agent/code_agent.py,sha256=h6wynQYZ1pPW5efU9ufY_I1di-YzRaQBOPn9IgAuxmo,18376
16
16
  jarvis/jarvis_code_agent/lint.py,sha256=LZPsfyZPMo7Wm7LN4osZocuNJwZx1ojacO3MlF870x8,4009
17
- jarvis/jarvis_code_analysis/code_review.py,sha256=uCCbGd4Y1RjDzhZoVE8JdN2avlwOfqimSDIrcM-KMew,30456
17
+ jarvis/jarvis_code_analysis/code_review.py,sha256=Huia4w1SkhxfzAk2GNC75uo3a_BcVTCDbj0rx8_t0r4,30424
18
18
  jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=LIXAYa1sW3l7foP6kohLWnE98I_EQ0T7z5bYKHq6rJA,78
19
19
  jarvis/jarvis_code_analysis/checklists/c_cpp.py,sha256=9t62bMqs6qTkFSio4SKkj88qyb5ZubWrw3MxJBQ4X1A,1317
20
20
  jarvis/jarvis_code_analysis/checklists/csharp.py,sha256=ShPXrl2_UPAnGaCHAG2wLl90COG3HK2XCSr1UK2dxN4,2420
@@ -35,10 +35,10 @@ jarvis/jarvis_code_analysis/checklists/shell.py,sha256=aRFYhQQvTgbYd-uY5pc8UHIUA
35
35
  jarvis/jarvis_code_analysis/checklists/sql.py,sha256=vR0T6qC7b4dURjJVAd7kSVxyvZEQXPG1Jqc2sNTGp5c,2355
36
36
  jarvis/jarvis_code_analysis/checklists/swift.py,sha256=TPx4I6Gupvs6tSerRKmTSKEPQpOLEbH2Y7LXg1uBgxc,2566
37
37
  jarvis/jarvis_code_analysis/checklists/web.py,sha256=25gGD7pDadZQybNFvALYxWvK0VRjGQb1NVJQElwjyk0,3943
38
- jarvis/jarvis_data/config_schema.json,sha256=RvK4XCVRGRVokguob_3-43BHRAyVFfb8tleU3QxLO1M,6520
38
+ jarvis/jarvis_data/config_schema.json,sha256=t51JvUc2IEe-QWP5bbocB7sqQAkmtUrPEHSHPfqzDjU,6668
39
39
  jarvis/jarvis_data/tiktoken/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
40
40
  jarvis/jarvis_git_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- jarvis/jarvis_git_details/main.py,sha256=MjpUHB4ErR_SKPBx1TLLK_XLkH427RTtsyVn6EUd88Y,8907
41
+ jarvis/jarvis_git_details/main.py,sha256=DE1DcX-1lvUsb_K-FExpHs3NBRmo5KZb53PGa8QFBOc,8875
42
42
  jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  jarvis/jarvis_git_squash/main.py,sha256=2nwX-Ghphn97Ua0SXPJIxix-rgm_Z9KRkrovjpSklUk,2311
44
44
  jarvis/jarvis_git_utils/git_commiter.py,sha256=erZ3wNJuaEgHlKTaYv0UKargG_Yl9OnssTIcErEAdtw,12472
@@ -47,13 +47,13 @@ jarvis/jarvis_mcp/sse_mcp_client.py,sha256=-3Qy1LyqgHswoc6YbadVRG3ias2op7lUp7Ne2
47
47
  jarvis/jarvis_mcp/stdio_mcp_client.py,sha256=armvgyHAv-AxF5lqiK-TbVLzg3XgSCwmTdWmxBSTLRk,11248
48
48
  jarvis/jarvis_mcp/streamable_mcp_client.py,sha256=1OZpsG82U2MLbGuojllJAblFUAMmp1N0i5fsKM4n5Ts,14453
49
49
  jarvis/jarvis_methodology/main.py,sha256=-PqsWvtpUJkkhiGgV-1JegEnEZBmv8SHnNMNNm_-QQc,11720
50
- jarvis/jarvis_multi_agent/__init__.py,sha256=sDd3sK88dS7_qAz2ywIAaEWdQ4iRVCiuBu2rQQmrKbU,4512
50
+ jarvis/jarvis_multi_agent/__init__.py,sha256=efB04nWPRl4EOD64RThqQ6w78GZc2t0GGisX2wwTP8I,5949
51
51
  jarvis/jarvis_multi_agent/main.py,sha256=h7VUSwoPrES0XTK8z5kt3XLX1mmcm8UEuFEHQOUWPH4,1696
52
52
  jarvis/jarvis_platform/__init__.py,sha256=WLQHSiE87PPket2M50_hHzjdMIgPIBx2VF8JfB_NNRk,105
53
53
  jarvis/jarvis_platform/ai8.py,sha256=yi7xG8ld4Yrf7drz-uu_JT_XCGYRB0obhygt-jKik8o,10871
54
54
  jarvis/jarvis_platform/base.py,sha256=-XegiAS8G_nzwsWPOVEAQ2iTxE33fxu5-TWV4c3Pz-g,8981
55
55
  jarvis/jarvis_platform/human.py,sha256=cSN8Lqf0ts2_pPfS2_v7PaWxQKqcW_3bSmhRTHey7Qo,4674
56
- jarvis/jarvis_platform/kimi.py,sha256=OEiRNlC4Ao3PrO_yiogEwgMtTobehoEm_X4CMGT-Aas,15315
56
+ jarvis/jarvis_platform/kimi.py,sha256=dn_P4EEZvWWCPS67MDbWStsP7n3MN4-Rrc6R7GhJyEg,15436
57
57
  jarvis/jarvis_platform/openai.py,sha256=ccGqsU2cFfd5324P7SH1tSmFABpvto8fytmxQGkr3BA,6412
58
58
  jarvis/jarvis_platform/oyi.py,sha256=GvVooV8ScRqDb9QxJdINtdZwsx6PUIdo1-bt9k0hmqY,12604
59
59
  jarvis/jarvis_platform/registry.py,sha256=1bMy0YZUa8NLzuZlKfC4CBtpa0iniypTxUZk0Hv6g9Y,8415
@@ -91,7 +91,7 @@ jarvis/jarvis_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
91
91
  jarvis/jarvis_tools/cli/main.py,sha256=Mg6TQDxMdzB1Ua1UrZ2EE-uQWsbaeojWaEGHJp2HimA,6375
92
92
  jarvis/jarvis_utils/__init__.py,sha256=67h0ldisGlh3oK4DAeNEL2Bl_VsI3tSmfclasyVlueM,850
93
93
  jarvis/jarvis_utils/builtin_replace_map.py,sha256=EI8JnHqr-ZpAhpwocTu48DhHUMHNd8tNUpDNYI47OLE,1717
94
- jarvis/jarvis_utils/config.py,sha256=h7H2CRix-A6-25al3EpudmipdSq1CiIoqM2Wp8rdgqU,7778
94
+ jarvis/jarvis_utils/config.py,sha256=E8GhbpbdGyrAxTC89wN7KGE2rJ9zwhmL-HMIgTl9q18,8051
95
95
  jarvis/jarvis_utils/embedding.py,sha256=oEOEM2qf16DMYwPsQe6srET9BknyjOdY2ef0jsp3Or8,2714
96
96
  jarvis/jarvis_utils/file_processors.py,sha256=XiM248SHS7lLgQDCbORVFWqinbVDUawYxWDOsLXDxP8,3043
97
97
  jarvis/jarvis_utils/git_utils.py,sha256=4mNbEgV0icMnB1UL1RWhE9Nxik3mwam2qcGMpd1ODJM,21707
@@ -102,9 +102,9 @@ jarvis/jarvis_utils/methodology.py,sha256=-cvM6pwgJK7BXCYg2uVjIId_j3v5RUh2z2PBcK
102
102
  jarvis/jarvis_utils/output.py,sha256=PRCgudPOB8gMEP3u-g0FGD2c6tBgJhLXUMqNPglfjV8,10813
103
103
  jarvis/jarvis_utils/tag.py,sha256=f211opbbbTcSyzCDwuIK_oCnKhXPNK-RknYyGzY1yD0,431
104
104
  jarvis/jarvis_utils/utils.py,sha256=ojupkZQfFIE6ysTyCy0jUdePucpwpvZlZJSXkGsdyQE,15263
105
- jarvis_ai_assistant-0.1.221.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
106
- jarvis_ai_assistant-0.1.221.dist-info/METADATA,sha256=az-ngvUTXWE8ZtSHG9mxhe69Dn7PIrmpcCi6QdloSGg,22955
107
- jarvis_ai_assistant-0.1.221.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
- jarvis_ai_assistant-0.1.221.dist-info/entry_points.txt,sha256=L-9EE1kKoCdzxY9iMT7dGgBad-ytc3rso4if8C19SQU,915
109
- jarvis_ai_assistant-0.1.221.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
110
- jarvis_ai_assistant-0.1.221.dist-info/RECORD,,
105
+ jarvis_ai_assistant-0.1.223.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
106
+ jarvis_ai_assistant-0.1.223.dist-info/METADATA,sha256=Fn58Cq6CpCpo9MjyYGrSWjI9Y2M90LA6VW9IjOu2tOE,24061
107
+ jarvis_ai_assistant-0.1.223.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
+ jarvis_ai_assistant-0.1.223.dist-info/entry_points.txt,sha256=JXK_n-d9HZ_RLz959CvpK5-UPOCwssn5oAH8dAHuebA,1277
109
+ jarvis_ai_assistant-0.1.223.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
110
+ jarvis_ai_assistant-0.1.223.dist-info/RECORD,,
@@ -1,4 +1,5 @@
1
1
  [console_scripts]
2
+ ja = jarvis.jarvis_agent.main:main
2
3
  jarvis = jarvis.jarvis_agent.jarvis:main
3
4
  jarvis-agent = jarvis.jarvis_agent.main:main
4
5
  jarvis-code-agent = jarvis.jarvis_code_agent.code_agent:main
@@ -13,6 +14,14 @@ jarvis-rag = jarvis.jarvis_rag.cli:main
13
14
  jarvis-smart-shell = jarvis.jarvis_smart_shell.main:main
14
15
  jarvis-tool = jarvis.jarvis_tools.cli.main:main
15
16
  jca = jarvis.jarvis_code_agent.code_agent:main
17
+ jcr = jarvis.jarvis_code_analysis.code_review:main
16
18
  jgc = jarvis.jarvis_git_utils.git_commiter:main
19
+ jgd = jarvis.jarvis_git_details.main:main
20
+ jgs = jarvis.jarvis_git_squash.main:main
21
+ jm = jarvis.jarvis_methodology.main:main
22
+ jma = jarvis.jarvis_multi_agent.main:main
17
23
  jpm = jarvis.jarvis_platform_manager.main:main
24
+ jrg = jarvis.jarvis_rag.cli:main
18
25
  jss = jarvis.jarvis_smart_shell.main:main
26
+ jt = jarvis.jarvis_tools.cli.main:main
27
+ jvs = jarvis.jarvis_agent.jarvis:main