jarvis-ai-assistant 0.1.177__py3-none-any.whl → 0.1.179__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jarvis-ai-assistant might be problematic. Click here for more details.

Files changed (73) hide show
  1. jarvis/__init__.py +1 -1
  2. jarvis/jarvis_agent/__init__.py +145 -125
  3. jarvis/jarvis_agent/builtin_input_handler.py +1 -1
  4. jarvis/jarvis_agent/jarvis.py +9 -13
  5. jarvis/jarvis_agent/main.py +4 -2
  6. jarvis/jarvis_code_agent/code_agent.py +34 -23
  7. jarvis/jarvis_code_agent/lint.py +164 -0
  8. jarvis/jarvis_code_analysis/checklists/loader.py +6 -20
  9. jarvis/jarvis_code_analysis/code_review.py +8 -6
  10. jarvis/jarvis_dev/main.py +1 -8
  11. jarvis/jarvis_event/__init__.py +0 -0
  12. jarvis/jarvis_git_details/main.py +1 -1
  13. jarvis/jarvis_git_squash/main.py +5 -3
  14. jarvis/jarvis_git_utils/git_commiter.py +24 -23
  15. jarvis/jarvis_mcp/sse_mcp_client.py +6 -4
  16. jarvis/jarvis_mcp/stdio_mcp_client.py +5 -4
  17. jarvis/jarvis_mcp/streamable_mcp_client.py +404 -0
  18. jarvis/jarvis_methodology/main.py +10 -9
  19. jarvis/jarvis_multi_agent/main.py +3 -1
  20. jarvis/jarvis_platform/base.py +14 -8
  21. jarvis/jarvis_platform/human.py +3 -1
  22. jarvis/jarvis_platform/kimi.py +10 -7
  23. jarvis/jarvis_platform/openai.py +70 -11
  24. jarvis/jarvis_platform/registry.py +6 -2
  25. jarvis/jarvis_platform/yuanbao.py +13 -10
  26. jarvis/jarvis_platform_manager/main.py +11 -9
  27. jarvis/jarvis_smart_shell/main.py +1 -0
  28. jarvis/jarvis_tools/ask_codebase.py +6 -4
  29. jarvis/jarvis_tools/ask_user.py +2 -1
  30. jarvis/jarvis_tools/base.py +3 -1
  31. jarvis/jarvis_tools/chdir.py +2 -1
  32. jarvis/jarvis_tools/cli/main.py +1 -0
  33. jarvis/jarvis_tools/code_plan.py +5 -3
  34. jarvis/jarvis_tools/create_code_agent.py +5 -2
  35. jarvis/jarvis_tools/create_sub_agent.py +1 -3
  36. jarvis/jarvis_tools/edit_file.py +37 -29
  37. jarvis/jarvis_tools/execute_script.py +1 -1
  38. jarvis/jarvis_tools/file_analyzer.py +5 -3
  39. jarvis/jarvis_tools/file_operation.py +4 -7
  40. jarvis/jarvis_tools/find_methodology.py +4 -2
  41. jarvis/jarvis_tools/generate_new_tool.py +2 -1
  42. jarvis/jarvis_tools/methodology.py +3 -4
  43. jarvis/jarvis_tools/read_code.py +2 -1
  44. jarvis/jarvis_tools/read_webpage.py +3 -1
  45. jarvis/jarvis_tools/registry.py +23 -14
  46. jarvis/jarvis_tools/rewrite_file.py +2 -1
  47. jarvis/jarvis_tools/search_web.py +1 -0
  48. jarvis/jarvis_tools/virtual_tty.py +5 -4
  49. jarvis/jarvis_utils/__init__.py +2 -0
  50. jarvis/jarvis_utils/builtin_replace_map.py +1 -1
  51. jarvis/jarvis_utils/config.py +40 -1
  52. jarvis/jarvis_utils/embedding.py +4 -3
  53. jarvis/jarvis_utils/file_processors.py +1 -0
  54. jarvis/jarvis_utils/git_utils.py +55 -25
  55. jarvis/jarvis_utils/globals.py +4 -2
  56. jarvis/jarvis_utils/input.py +14 -7
  57. jarvis/jarvis_utils/methodology.py +6 -4
  58. jarvis/jarvis_utils/output.py +10 -6
  59. jarvis/jarvis_utils/utils.py +89 -13
  60. {jarvis_ai_assistant-0.1.177.dist-info → jarvis_ai_assistant-0.1.179.dist-info}/METADATA +45 -33
  61. jarvis_ai_assistant-0.1.179.dist-info/RECORD +98 -0
  62. jarvis/jarvis_lsp/base.py +0 -66
  63. jarvis/jarvis_lsp/cpp.py +0 -99
  64. jarvis/jarvis_lsp/go.py +0 -104
  65. jarvis/jarvis_lsp/python.py +0 -58
  66. jarvis/jarvis_lsp/registry.py +0 -169
  67. jarvis/jarvis_lsp/rust.py +0 -107
  68. jarvis/jarvis_tools/lsp_get_diagnostics.py +0 -147
  69. jarvis_ai_assistant-0.1.177.dist-info/RECORD +0 -102
  70. {jarvis_ai_assistant-0.1.177.dist-info → jarvis_ai_assistant-0.1.179.dist-info}/WHEEL +0 -0
  71. {jarvis_ai_assistant-0.1.177.dist-info → jarvis_ai_assistant-0.1.179.dist-info}/entry_points.txt +0 -0
  72. {jarvis_ai_assistant-0.1.177.dist-info → jarvis_ai_assistant-0.1.179.dist-info}/licenses/LICENSE +0 -0
  73. {jarvis_ai_assistant-0.1.177.dist-info → jarvis_ai_assistant-0.1.179.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,26 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import os
3
3
  from functools import lru_cache
4
+
4
5
  import yaml
6
+
5
7
  from jarvis.jarvis_utils.builtin_replace_map import BUILTIN_REPLACE_MAP
8
+
6
9
  """配置管理模块。
7
10
 
8
11
  该模块提供了获取Jarvis系统各种配置设置的函数。
9
12
  所有配置都从环境变量中读取,带有回退默认值。
10
13
  """
11
14
 
15
+ def get_git_commit_prompt() -> str:
16
+ """
17
+ 获取Git提交提示模板
18
+
19
+ 返回:
20
+ str: Git提交信息生成提示模板,如果未配置则返回空字符串
21
+ """
22
+ return os.getenv("JARVIS_GIT_COMMIT_PROMPT", "")
23
+
12
24
  # 输出窗口预留大小
13
25
  INPUT_WINDOW_REVERSE_SIZE = 2048
14
26
 
@@ -169,4 +181,31 @@ def get_pretty_output() -> bool:
169
181
  返回:
170
182
  bool: 如果启用PrettyOutput则返回True,默认为True
171
183
  """
172
- return os.getenv('JARVIS_PRETTY_OUTPUT', 'false') == 'true'
184
+ return os.getenv('JARVIS_PRETTY_OUTPUT', 'false') == 'true'
185
+
186
+ def is_use_methodology() -> bool:
187
+ """
188
+ 获取是否启用方法论。
189
+
190
+ 返回:
191
+ bool: 如果启用方法论则返回True,默认为True
192
+ """
193
+ return os.getenv('JARVIS_USE_METHODOLOGY', 'false') == 'true'
194
+
195
+ def is_use_analysis() -> bool:
196
+ """
197
+ 获取是否启用任务分析。
198
+
199
+ 返回:
200
+ bool: 如果启用任务分析则返回True,默认为True
201
+ """
202
+ return os.getenv('JARVIS_USE_ANALYSIS', 'false') == 'true'
203
+
204
+ def is_print_prompt() -> bool:
205
+ """
206
+ 获取是否打印提示。
207
+
208
+ 返回:
209
+ bool: 如果打印提示则返回True,默认为True
210
+ """
211
+ return os.getenv('JARVIS_PRINT_PROMPT', 'false') == 'true'
@@ -1,11 +1,12 @@
1
1
  # -*- coding: utf-8 -*-
2
+ import functools
2
3
  import os
3
- from transformers import AutoTokenizer
4
4
  from typing import List
5
- import functools
6
5
 
7
- from jarvis.jarvis_utils.output import PrettyOutput, OutputType
6
+ from transformers import AutoTokenizer
7
+
8
8
  from jarvis.jarvis_utils.config import get_data_dir
9
+ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
9
10
 
10
11
  # 全局缓存,避免重复加载模型
11
12
  _global_tokenizers = {}
@@ -1,6 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import unicodedata
3
3
 
4
+
4
5
  class FileProcessor:
5
6
  """Base class for file processor"""
6
7
  @staticmethod
@@ -12,10 +12,14 @@ Git工具模块
12
12
  import os
13
13
  import re
14
14
  import subprocess
15
- from typing import List, Tuple, Dict
16
- from jarvis.jarvis_utils.config import get_auto_update, is_confirm_before_apply_patch
17
- from jarvis.jarvis_utils.output import PrettyOutput, OutputType
15
+ from typing import Dict, List, Tuple
16
+
17
+ from jarvis.jarvis_utils.config import (get_auto_update,
18
+ is_confirm_before_apply_patch)
19
+ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
18
20
  from jarvis.jarvis_utils.utils import user_confirm
21
+
22
+
19
23
  def find_git_root(start_dir: str = ".") -> str:
20
24
  """
21
25
  切换到给定路径的Git根目录,如果不是Git仓库则初始化。
@@ -101,42 +105,34 @@ def get_commits_between(start_hash: str, end_hash: str) -> List[Tuple[str, str]]
101
105
 
102
106
 
103
107
  def get_diff() -> str:
104
- """使用git获取暂存区差异"""
105
- import subprocess
106
-
107
- # 初始化状态
108
- need_reset = False
108
+ """使用git获取工作区差异,包括修改和新增的文件内容
109
109
 
110
+ 返回:
111
+ str: 差异内容或错误信息
112
+ """
110
113
  try:
111
- # 暂存所有修改
112
- subprocess.run(['git', 'add', '.'], check=True)
113
- need_reset = True
114
+ # 暂存新增文件
115
+ subprocess.run(['git', 'add', '-N', '.'], check=True)
114
116
 
115
- # 获取差异
117
+ # 获取所有差异(包括新增文件)
116
118
  result = subprocess.run(
117
- ['git', 'diff', '--cached'],
119
+ ['git', 'diff', 'HEAD'],
118
120
  capture_output=True,
119
121
  text=False,
120
122
  check=True
121
123
  )
122
124
 
123
- # 解码输出
124
- try:
125
- ret = result.stdout.decode('utf-8')
126
- except UnicodeDecodeError:
127
- ret = result.stdout.decode('utf-8', errors='replace')
128
-
129
125
  # 重置暂存区
130
- subprocess.run(['git', "reset", "--mixed"], check=False)
131
- return ret
126
+ subprocess.run(['git', 'reset'], check=True)
132
127
 
128
+ try:
129
+ return result.stdout.decode('utf-8')
130
+ except UnicodeDecodeError:
131
+ return result.stdout.decode('utf-8', errors='replace')
132
+
133
133
  except subprocess.CalledProcessError as e:
134
- if need_reset:
135
- subprocess.run(['git', "reset", "--mixed"], check=False)
136
134
  return f"获取差异失败: {str(e)}"
137
135
  except Exception as e:
138
- if need_reset:
139
- subprocess.run(['git', "reset", "--mixed"], check=False)
140
136
  return f"发生意外错误: {str(e)}"
141
137
 
142
138
 
@@ -333,3 +329,37 @@ def check_and_update_git_repo(repo_path: str) -> bool:
333
329
  return False
334
330
  finally:
335
331
  os.chdir(curr_dir)
332
+
333
+
334
+ def get_diff_file_list() -> List[str]:
335
+ """获取HEAD到当前变更的文件列表,包括修改和新增的文件
336
+
337
+ 返回:
338
+ List[str]: 修改和新增的文件路径列表
339
+ """
340
+ try:
341
+ # 暂存新增文件
342
+ subprocess.run(['git', 'add', '-N', '.'], check=True)
343
+
344
+ # 获取所有差异文件(包括新增文件)
345
+ result = subprocess.run(
346
+ ['git', 'diff', '--name-only', 'HEAD'],
347
+ capture_output=True,
348
+ text=True
349
+ )
350
+
351
+ # 重置暂存区
352
+ subprocess.run(['git', 'reset'], check=True)
353
+
354
+ if result.returncode != 0:
355
+ PrettyOutput.print(f"获取差异文件列表失败: {result.stderr}", OutputType.ERROR)
356
+ return []
357
+
358
+ return [f for f in result.stdout.splitlines() if f]
359
+
360
+ except subprocess.CalledProcessError as e:
361
+ PrettyOutput.print(f"获取差异文件列表失败: {str(e)}", OutputType.ERROR)
362
+ return []
363
+ except Exception as e:
364
+ PrettyOutput.print(f"获取差异文件列表异常: {str(e)}", OutputType.ERROR)
365
+ return []
@@ -7,11 +7,13 @@
7
7
  - 带有自定义主题的控制台配置
8
8
  - 环境初始化
9
9
  """
10
- from typing import Any, Set, Dict
11
- import colorama
12
10
  import os
11
+ from typing import Any, Dict, Set
12
+
13
+ import colorama
13
14
  from rich.console import Console
14
15
  from rich.theme import Theme
16
+
15
17
  # 初始化colorama以支持跨平台的彩色文本
16
18
  colorama.init()
17
19
  # 禁用tokenizers并行以避免多进程问题
@@ -8,17 +8,21 @@
8
8
  - 带有模糊匹配的文件路径补全
9
9
  - 用于输入控制的自定义键绑定
10
10
  """
11
+ from colorama import Fore
12
+ from colorama import Style as ColoramaStyle
13
+ from fuzzywuzzy import process
11
14
  from prompt_toolkit import PromptSession
12
- from prompt_toolkit.styles import Style as PromptStyle
13
- from prompt_toolkit.formatted_text import FormattedText
14
15
  from prompt_toolkit.completion import Completer, Completion, PathCompleter
15
16
  from prompt_toolkit.document import Document
17
+ from prompt_toolkit.formatted_text import FormattedText
16
18
  from prompt_toolkit.key_binding import KeyBindings
17
- from fuzzywuzzy import process
18
- from colorama import Fore, Style as ColoramaStyle
19
- from jarvis.jarvis_utils.output import PrettyOutput, OutputType
20
- from jarvis.jarvis_utils.tag import ot
19
+ from prompt_toolkit.styles import Style as PromptStyle
20
+
21
21
  from jarvis.jarvis_utils.config import get_replace_map
22
+ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
23
+ from jarvis.jarvis_utils.tag import ot
24
+
25
+
22
26
  def get_single_line_input(tip: str) -> str:
23
27
  """
24
28
  获取支持历史记录的单行输入。
@@ -176,9 +180,12 @@ def get_multiline_input(tip: str) -> str:
176
180
  'prompt': 'ansicyan',
177
181
  })
178
182
  try:
183
+ import os
184
+
179
185
  from prompt_toolkit.history import FileHistory
186
+
180
187
  from jarvis.jarvis_utils.config import get_data_dir
181
- import os
188
+
182
189
  # 获取数据目录路径
183
190
  history_dir = get_data_dir()
184
191
  # 初始化带历史记录的会话
@@ -7,17 +7,18 @@
7
7
  - 生成方法论临时文件
8
8
  - 上传方法论文件到大模型
9
9
  """
10
- import os
11
10
  import json
11
+ import os
12
12
  import tempfile
13
13
  from typing import Any, Dict, Optional
14
14
 
15
15
  from jarvis.jarvis_platform.base import BasePlatform
16
- from jarvis.jarvis_utils.config import get_data_dir
17
- from jarvis.jarvis_utils.output import PrettyOutput, OutputType
18
16
  from jarvis.jarvis_platform.registry import PlatformRegistry
17
+ from jarvis.jarvis_utils.config import get_data_dir
18
+ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
19
19
  from jarvis.jarvis_utils.utils import is_context_overflow
20
20
 
21
+
21
22
  def _get_methodology_directory() -> str:
22
23
  """
23
24
  获取方法论目录路径,如果不存在则创建
@@ -139,7 +140,8 @@ def load_methodology(user_input: str, tool_registery: Optional[Any] = None) -> s
139
140
  返回:
140
141
  str: 相关的方法论提示,如果未找到方法论则返回空字符串
141
142
  """
142
- from yaspin import yaspin # type: ignore
143
+ from yaspin import yaspin # type: ignore
144
+
143
145
  from jarvis.jarvis_tools.registry import ToolRegistry
144
146
 
145
147
  prompt = tool_registery.prompt() if tool_registery else ""
@@ -8,18 +8,22 @@
8
8
  - 多种编程语言的语法高亮支持
9
9
  - 结构化输出的面板显示
10
10
  """
11
- from enum import Enum
12
11
  from datetime import datetime
12
+ from enum import Enum
13
13
  from typing import Optional, Tuple
14
- from rich.panel import Panel
15
- from rich.text import Text
16
- from rich.syntax import Syntax
17
- from rich.style import Style as RichStyle
14
+
18
15
  from pygments.lexers import guess_lexer
19
16
  from pygments.util import ClassNotFound
17
+ from rich.box import SIMPLE
18
+ from rich.panel import Panel
19
+ from rich.style import Style as RichStyle
20
+ from rich.syntax import Syntax
21
+ from rich.text import Text
22
+
20
23
  from jarvis.jarvis_utils.config import get_pretty_output
21
24
  from jarvis.jarvis_utils.globals import console, get_agent_list
22
- from rich.box import SIMPLE
25
+
26
+
23
27
  class OutputType(Enum):
24
28
  """
25
29
  输出类型枚举,用于分类和样式化不同类型的消息。
@@ -1,25 +1,31 @@
1
1
  # -*- coding: utf-8 -*-
2
- import os
3
- import time
4
2
  import hashlib
3
+ import os
5
4
  import tarfile
5
+ import time
6
+ from datetime import datetime
6
7
  from pathlib import Path
7
- from typing import Any, Callable
8
+ from typing import Any, Callable, Dict
9
+
10
+ import yaml
8
11
 
9
12
  from jarvis import __version__
10
- from jarvis.jarvis_utils.config import get_max_big_content_size, get_data_dir
13
+ from jarvis.jarvis_utils.config import get_data_dir, get_max_big_content_size
11
14
  from jarvis.jarvis_utils.embedding import get_context_token_count
12
15
  from jarvis.jarvis_utils.input import get_single_line_input
13
- from jarvis.jarvis_utils.output import PrettyOutput, OutputType
16
+ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
17
+
18
+
14
19
  def init_env(welcome_str: str) -> None:
15
20
  """初始化环境变量从jarvis_data/env文件
16
-
17
21
  功能:
18
22
  1. 创建不存在的jarvis_data目录
19
23
  2. 加载环境变量到os.environ
20
24
  3. 处理文件读取异常
21
25
  4. 检查git仓库状态并在落后时更新
26
+ 5. 统计当前命令使用次数
22
27
  """
28
+ count_cmd_usage()
23
29
 
24
30
  jarvis_ascii_art = f"""
25
31
  ██╗ █████╗ ██████╗ ██╗ ██╗██╗███████╗
@@ -59,15 +65,52 @@ def init_env(welcome_str: str) -> None:
59
65
 
60
66
  if env_file.exists():
61
67
  try:
68
+ # 首先尝试作为YAML文件读取
69
+ try:
70
+ with open(env_file, "r", encoding="utf-8") as f:
71
+ env_data = yaml.safe_load(f) or {}
72
+ if isinstance(env_data, dict):
73
+ os.environ.update({str(k): str(v) for k, v in env_data.items() if v is not None})
74
+ return
75
+ except yaml.YAMLError:
76
+ pass
77
+
78
+ # 如果不是YAML格式,按旧格式处理
79
+ current_key = None
80
+ current_value = []
81
+ env_data = {}
62
82
  with open(env_file, "r", encoding="utf-8", errors="ignore") as f:
63
83
  for line in f:
64
- line = line.strip()
65
- if line and not line.startswith(("#", ";")):
66
- try:
67
- key, value = line.split("=", 1)
68
- os.environ[key.strip()] = value.strip().strip("'").strip('"')
69
- except ValueError:
70
- continue
84
+ line = line.rstrip()
85
+ if not line or line.startswith(("#", ";")):
86
+ continue
87
+ if "=" in line and not line.startswith((" ", "\t")):
88
+ # 处理之前收集的多行值
89
+ if current_key is not None:
90
+ env_data[current_key] = "\n".join(current_value).strip().strip("'").strip('"')
91
+ current_value = []
92
+ # 解析新的键值对
93
+ key, value = line.split("=", 1)
94
+ current_key = key.strip()
95
+ current_value.append(value.strip())
96
+ elif current_key is not None:
97
+ # 多行值的后续行
98
+ current_value.append(line.strip())
99
+ # 处理最后一个键值对
100
+ if current_key is not None:
101
+ env_data[current_key] = "\n".join(current_value).strip().strip("'").strip('"')
102
+
103
+ # 更新环境变量
104
+ os.environ.update(env_data)
105
+
106
+ # 如果是旧格式,转换为YAML并备份
107
+ backup_file = env_file.with_name(f"env.bak.{datetime.now().strftime('%Y%m%d%H%M%S')}")
108
+ env_file.rename(backup_file)
109
+ with open(env_file, "w", encoding="utf-8") as f:
110
+ yaml.dump(env_data, f, default_flow_style=False, allow_unicode=True)
111
+
112
+ PrettyOutput.print(f"检测到旧格式配置文件,已自动转换为YAML格式并备份到 {backup_file}", OutputType.INFO)
113
+
71
114
  except Exception as e:
72
115
  PrettyOutput.print(f"警告: 读取 {env_file} 失败: {e}", OutputType.WARNING)
73
116
 
@@ -143,6 +186,39 @@ def get_file_line_count(filename: str) -> int:
143
186
 
144
187
 
145
188
 
189
+ def _get_cmd_stats() -> Dict[str, int]:
190
+ """从数据目录获取命令调用统计"""
191
+ stats_file = Path(get_data_dir()) / "cmd_stat.yaml"
192
+ if stats_file.exists():
193
+ try:
194
+ with open(stats_file, "r", encoding="utf-8") as f:
195
+ return yaml.safe_load(f) or {}
196
+ except Exception as e:
197
+ PrettyOutput.print(
198
+ f"加载命令调用统计失败: {str(e)}", OutputType.WARNING
199
+ )
200
+ return {}
201
+
202
+ def _update_cmd_stats(cmd_name: str) -> None:
203
+ """更新命令调用统计"""
204
+ stats = _get_cmd_stats()
205
+ stats[cmd_name] = stats.get(cmd_name, 0) + 1
206
+ stats_file = Path(get_data_dir()) / "cmd_stat.yaml"
207
+ try:
208
+ with open(stats_file, "w", encoding="utf-8") as f:
209
+ yaml.safe_dump(stats, f)
210
+ except Exception as e:
211
+ PrettyOutput.print(
212
+ f"保存命令调用统计失败: {str(e)}", OutputType.WARNING
213
+ )
214
+
215
+ def count_cmd_usage() -> None:
216
+ """统计当前命令的使用次数"""
217
+ import sys
218
+ if len(sys.argv) > 1:
219
+ cmd_name = sys.argv[1]
220
+ _update_cmd_stats(cmd_name)
221
+
146
222
  def is_context_overflow(content: str) -> bool:
147
223
  """判断文件内容是否超出上下文限制"""
148
224
  return get_context_token_count(content) > get_max_big_content_size()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.177
3
+ Version: 0.1.179
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
@@ -46,16 +46,15 @@ Requires-Dist: prompt_toolkit==3.0.50
46
46
  Requires-Dist: yaspin==2.4.0
47
47
  Requires-Dist: pygments==2.19.1
48
48
  Requires-Dist: fuzzywuzzy==0.18.0
49
- Requires-Dist: jedi==0.19.2
50
49
  Requires-Dist: fastapi==0.115.12
51
50
  Requires-Dist: uvicorn==0.33.0
52
51
  Requires-Dist: rich==14.0.0
53
52
  Requires-Dist: transformers==4.46.3
54
53
  Requires-Dist: torch==2.4.1
55
54
  Requires-Dist: python-Levenshtein==0.25.1
56
- Requires-Dist: sseclient==0.0.27
57
55
  Requires-Dist: pillow==10.2.0
58
56
  Requires-Dist: openai==1.78.1
57
+ Requires-Dist: tabulate==0.9.0
59
58
  Provides-Extra: dev
60
59
  Requires-Dist: pytest; extra == "dev"
61
60
  Requires-Dist: black; extra == "dev"
@@ -78,15 +77,7 @@ Dynamic: requires-python
78
77
 
79
78
  *您的智能开发和系统交互助手*
80
79
 
81
- [核心特色](#core-features) •
82
- [视频介绍](#video-introduction) •
83
- [快速开始](#quick-start) •
84
- [配置说明](#configuration) •
85
- [工具说明](#tools) •
86
- [扩展开发](#extensions) •
87
- [贡献指南](#contributing) •
88
- [许可证](#license) •
89
- [Wiki文档](https://deepwiki.com/skyfireitdiy/Jarvis)
80
+ [核心特色](#core-features) • [视频介绍](#video-introduction) • [快速开始](#quick-start) • [配置说明](#configuration) • [工具说明](#tools) • [扩展开发](#extensions) • [贡献指南](#contributing) • [许可证](#license) • [Wiki文档](https://deepwiki.com/skyfireitdiy/Jarvis)
90
81
  </div>
91
82
 
92
83
  ---
@@ -123,15 +114,17 @@ pip3 install jarvis-ai-assistant
123
114
 
124
115
  ### 最小化配置
125
116
 
117
+ 将以下配置写入到`~/.jarvis/env`文件中。
118
+
126
119
  #### 腾讯元宝
127
- ```bash
128
- JARVIS_PLATFORM=yuanbao
129
- JARVIS_MODEL=deep_seek_v3
130
- JARVIS_THINKING_PLATFORM=yuanbao
131
- JARVIS_THINKING_MODEL=deep_seek
120
+ ```yaml
121
+ JARVIS_PLATFORM: yuanbao
122
+ JARVIS_MODEL: deep_seek_v3
123
+ JARVIS_THINKING_PLATFORM: yuanbao
124
+ JARVIS_THINKING_MODEL: deep_seek
132
125
 
133
- YUANBAO_COOKIES=<元宝cookies>
134
- YUANBAO_AGENT_ID=<元宝AgentID>
126
+ YUANBAO_COOKIES: <元宝cookies>
127
+ YUANBAO_AGENT_ID: <元宝AgentID>
135
128
  ```
136
129
 
137
130
  元宝cookies以及AgentID获取方式:
@@ -142,13 +135,13 @@ YUANBAO_AGENT_ID=<元宝AgentID>
142
135
 
143
136
 
144
137
  #### Kimi
145
- ```bash
146
- JARVIS_PLATFORM=kimi
147
- JARVIS_MODEL=kimi
148
- JARVIS_THINKING_PLATFORM=kimi
149
- JARVIS_THINKING_MODEL=k1
138
+ ```yaml
139
+ JARVIS_PLATFORM: kimi
140
+ JARVIS_MODEL: kimi
141
+ JARVIS_THINKING_PLATFORM: kimi
142
+ JARVIS_THINKING_MODEL: k1
150
143
 
151
- KIMI_API_KEY=<Kimi API KEY>
144
+ KIMI_API_KEY: <Kimi API KEY>
152
145
  ```
153
146
 
154
147
  Kimi API Key获取方式:
@@ -159,14 +152,14 @@ Kimi API Key获取方式:
159
152
 
160
153
 
161
154
  #### OpenAI
162
- ```bash
163
- JARVIS_PLATFORM=openai
164
- JARVIS_MODEL=gpt-4o # 默认模型,可选gpt-4-turbo, gpt-3.5-turbo等
165
- JARVIS_THINKING_PLATFORM=openai
166
- JARVIS_THINKING_MODEL=gpt-4o
155
+ ```yaml
156
+ JARVIS_PLATFORM: openai
157
+ JARVIS_MODEL: gpt-4o # 默认模型,可选gpt-4-turbo, gpt-3.5-turbo等
158
+ JARVIS_THINKING_PLATFORM: openai
159
+ JARVIS_THINKING_MODEL: gpt-4o
167
160
 
168
- OPENAI_API_KEY=<OpenAI API Key>
169
- OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
161
+ OPENAI_API_KEY: <OpenAI API Key>
162
+ OPENAI_API_BASE: https://api.openai.com/v1 # 可选,默认为官方API地址
170
163
  ```
171
164
 
172
165
  配置说明:
@@ -198,6 +191,24 @@ OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
198
191
  ---
199
192
 
200
193
  ## ⚙️ 配置说明 <a id="configuration"></a>
194
+ ### 配置文件格式
195
+ 配置文件支持两种格式:
196
+ 1. **YAML格式(推荐)**:
197
+ ```yaml
198
+ JARVIS_PLATFORM: yuanbao
199
+ JARVIS_MODEL: deep_seek_v3
200
+ YUANBAO_COOKIES: "your_cookies_here"
201
+ ```
202
+
203
+ 2. **传统键值对格式**:
204
+ ```
205
+ JARVIS_PLATFORM=yuanbao
206
+ JARVIS_MODEL=deep_seek_v3
207
+ YUANBAO_COOKIES=your_cookies_here
208
+ ```
209
+
210
+ 系统会自动检测格式并处理。当检测到传统格式时,会自动转换为YAML格式并备份原文件。
211
+
201
212
  ### 环境变量配置
202
213
  | 变量名称 | 默认值 | 说明 |
203
214
  |----------|--------|------|
@@ -215,6 +226,8 @@ OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
215
226
  | `JARVIS_AUTO_UPDATE` | true | 是否自动更新Jarvis(仅在以git仓库方式安装时有效) |
216
227
  | `JARVIS_MAX_BIG_CONTENT_SIZE` | 1024000 | 最大大内容大小 |
217
228
  | `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
229
+ | `JARVIS_GIT_COMMIT_PROMPT` | "" | 自定义git提交信息生成提示模板 |
230
+ | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
218
231
 
219
232
  所有配置编写到`~/.jarvis/env`文件中即可生效。
220
233
 
@@ -236,7 +249,6 @@ OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
236
249
  | file_analyzer | 分析文件内容并提取关键信息。支持的文件:文本文件、word文档、pdf文件、图片 |
237
250
  | file_operation | 文件批量操作工具,可批量读写多个文件,支持文本文件,适用于需要同时处理多个文件的场景(读取配置文件、保存生成内容等) |
238
251
  | find_methodology | 方法论查找工具,用于在执行过程中查看历史方法论辅助决策 |
239
- | lsp_get_diagnostics | 获取代码诊断信息(错误、警告) |
240
252
  | methodology | 方法论管理工具,支持添加、更新和删除操作 |
241
253
  | read_code | 代码阅读与分析工具,用于读取源代码文件并添加行号,针对代码文件优化,提供更好的格式化输出和行号显示,适用于代码分析、审查和理解代码实现的场景 |
242
254
  | read_webpage | 读取网页内容并分析 |