jarvis-ai-assistant 0.1.185__py3-none-any.whl → 0.1.186__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.185"
4
+ __version__ = "0.1.186"
@@ -105,12 +105,13 @@ def _select_task(tasks: Dict[str, str]) -> str:
105
105
  def main() -> None:
106
106
 
107
107
 
108
- init_env("欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!")
109
108
  parser = argparse.ArgumentParser(description='Jarvis AI assistant')
110
109
  parser.add_argument('-p', '--platform', type=str, help='Platform to use')
111
110
  parser.add_argument('-m', '--model', type=str, help='Model to use')
112
111
  parser.add_argument('-t', '--task', type=str, help='Directly input task content from command line')
112
+ parser.add_argument('-f', '--config', type=str, help='Path to custom config file')
113
113
  args = parser.parse_args()
114
+ init_env("欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config)
114
115
 
115
116
  try:
116
117
  agent = Agent(
@@ -33,19 +33,21 @@ def load_config(config_path: str) -> dict:
33
33
 
34
34
  def main():
35
35
  """Main entry point for Jarvis agent"""
36
- # Initialize environment
37
- init_env("欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!")
38
-
39
36
  # Set up argument parser
40
37
  parser = argparse.ArgumentParser(description='Jarvis AI assistant')
41
- parser.add_argument('-c', '--config', type=str, required=True,
42
- help='Path to the YAML configuration file')
38
+ parser.add_argument('-f', '--config', type=str, required=True,
39
+ help='Path to agent config file')
40
+ parser.add_argument('-c', '--agent_definition', type=str,
41
+ help='Path to agent definition file')
43
42
  parser.add_argument('-t', '--task', type=str,
44
43
  help='Initial task to execute')
45
44
  args = parser.parse_args()
46
45
 
46
+ # Initialize environment
47
+ init_env("欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=args.config)
48
+
47
49
  # Load configuration
48
- config = load_config(args.config)
50
+ config = load_config(args.agent_definition) if args.agent_definition else {}
49
51
 
50
52
  # Create and run agent
51
53
  try:
@@ -136,7 +136,7 @@ class FileSearchReplaceTool:
136
136
  stderr_messages = []
137
137
  success = True
138
138
 
139
- file_path = args["file"]
139
+ file_path = os.path.abspath(args["file"])
140
140
  changes = args["changes"]
141
141
  agent = args.get("agent", None)
142
142
 
@@ -5,7 +5,7 @@ import subprocess
5
5
  import tarfile
6
6
  import time
7
7
  from pathlib import Path
8
- from typing import Any, Callable, Dict
8
+ from typing import Any, Callable, Dict, Optional
9
9
 
10
10
  import yaml
11
11
 
@@ -17,7 +17,7 @@ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
17
17
 
18
18
 
19
19
 
20
- def init_env(welcome_str: str) -> None:
20
+ def init_env(welcome_str: str, config_file: Optional[str] = None) -> None:
21
21
  """初始化环境变量从jarvis_data/env文件
22
22
  功能:
23
23
  1. 创建不存在的jarvis_data目录
@@ -25,6 +25,10 @@ def init_env(welcome_str: str) -> None:
25
25
  3. 处理文件读取异常
26
26
  4. 检查git仓库状态并在落后时更新
27
27
  5. 统计当前命令使用次数
28
+
29
+ 参数:
30
+ welcome_str: 欢迎信息字符串
31
+ config_file: 配置文件路径,默认为None(使用~/.jarvis/config.yaml)
28
32
  """
29
33
  count_cmd_usage()
30
34
 
@@ -43,35 +47,32 @@ def init_env(welcome_str: str) -> None:
43
47
  if welcome_str:
44
48
  PrettyOutput.print_gradient_text(jarvis_ascii_art, (0, 120, 255), (0, 255, 200))
45
49
 
46
- jarvis_dir = Path(get_data_dir())
47
- config_file = jarvis_dir / "config.yaml"
50
+ config_file_path = Path(config_file) if config_file is not None else Path(os.path.expanduser("~/.jarvis/config.yaml"))
48
51
 
49
- # 检查jarvis_data目录是否存在
50
- if not jarvis_dir.exists():
51
- jarvis_dir.mkdir(parents=True)
52
+ # 加载配置文件
53
+ if not config_file_path.exists():
54
+ old_config_file = config_file_path.parent / "env"
55
+ if old_config_file.exists():# 旧的配置文件存在
56
+ _read_old_config_file(old_config_file)
57
+ else:
58
+ _read_config_file(config_file_path.parent, config_file_path)
52
59
 
60
+ # 现在获取最终的数据目录(可能被配置文件修改)
61
+ data_dir = Path(get_data_dir())
53
62
  script_dir = Path(os.path.dirname(os.path.dirname(__file__)))
54
63
  hf_archive = script_dir / "jarvis_data" / "huggingface.tar.gz"
55
64
 
56
65
 
57
66
  # 检查并解压huggingface模型
58
- hf_dir = jarvis_dir / "huggingface" / "hub"
67
+ hf_dir = data_dir / "huggingface" / "hub"
59
68
  if not hf_dir.exists() and hf_archive.exists():
60
69
  try:
61
70
  PrettyOutput.print("正在解压HuggingFace模型...", OutputType.INFO)
62
71
  with tarfile.open(hf_archive, "r:gz") as tar:
63
- tar.extractall(path=jarvis_dir)
72
+ tar.extractall(path=data_dir)
64
73
  PrettyOutput.print("HuggingFace模型解压完成", OutputType.SUCCESS)
65
74
  except Exception as e:
66
- PrettyOutput.print(f"解压HuggingFace模型失败: {e}", OutputType.ERROR)
67
-
68
-
69
- if not config_file.exists():
70
- old_config_file = jarvis_dir / "env"
71
- if old_config_file.exists():# 旧的配置文件存在
72
- _read_old_config_file(old_config_file)
73
- else:
74
- _read_config_file(jarvis_dir, config_file)
75
+ PrettyOutput.print(f"解压HuggingFace模型失败: {e}", OutputType.ERROR)
75
76
 
76
77
  # 检查是否是git仓库并更新
77
78
  from jarvis.jarvis_utils.git_utils import check_and_update_git_repo
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.185
3
+ Version: 0.1.186
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
@@ -1,9 +1,9 @@
1
- jarvis/__init__.py,sha256=ctjj6eadc4jmCb3OWiljzQVxwTvbZ3urmkzwzSyoUYQ,74
1
+ jarvis/__init__.py,sha256=2Jubd1by59etw8bG1OynB8re955CEag1nBes2ilDJD4,74
2
2
  jarvis/jarvis_agent/__init__.py,sha256=Mho0roePyuitHFjVCbK0_v9FPgEarcpvgIvY3sQKLws,30843
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=7u8pXWD7F9mmiJkr9XO83mhFu40FSRoYQm55DbZHgQo,4203
5
- jarvis/jarvis_agent/jarvis.py,sha256=UkNMVUlSNKV6y3v12eAhqc_gIDB6Obxrwk5f7-sQeiQ,6137
6
- jarvis/jarvis_agent/main.py,sha256=GkjMTIbsd56nkVuRwD_tU_PZWyzixZZhMjVOCd0SzOA,2669
5
+ jarvis/jarvis_agent/jarvis.py,sha256=gOZfTwVlG-GZxPjgCoSiIcFsl4RwwfPA0CGUjE5J7oU,6249
6
+ jarvis/jarvis_agent/main.py,sha256=EDHk8N4QD2ssS9yWnxXC7rYMgWdsHeHf3VSLIz31fBk,2851
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
@@ -65,7 +65,7 @@ jarvis/jarvis_tools/chdir.py,sha256=DNKVFrWqu6t_sZ2ipv99s6802QR4cSGlqKlmaI--arE,
65
65
  jarvis/jarvis_tools/code_plan.py,sha256=gWR0lzY62x2PxWKoMRBqW6jq7zQuO8vhpjC4TcHSYjk,7685
66
66
  jarvis/jarvis_tools/create_code_agent.py,sha256=-nHfo5O5pDIG5IX3w1ClQafGvGcdI2_w75-KGrD-gUQ,3458
67
67
  jarvis/jarvis_tools/create_sub_agent.py,sha256=lyFrrg4V0yXULmU3vldwGp_euZjwZzJcRU6mJ20zejY,3023
68
- jarvis/jarvis_tools/edit_file.py,sha256=czpJOY7Y7Q-SH3UiGfgfB1lRcqtzuIZjLBLZzozcl0A,17330
68
+ jarvis/jarvis_tools/edit_file.py,sha256=o8Arp2-779m8GLVtocS4kfVbAjoBb87nND2fy3bzbV0,17347
69
69
  jarvis/jarvis_tools/execute_script.py,sha256=IA1SkcnwBB9PKG2voBNx5N9GXL303OC7OOtdqRfqWOk,6428
70
70
  jarvis/jarvis_tools/file_analyzer.py,sha256=7ILHkUFm8pPZn1y_s4uT0kaWHP-EmlHnpkovDdA1yRE,4872
71
71
  jarvis/jarvis_tools/file_operation.py,sha256=WloC1-oPJLwgICu4WBc9f7XA8N_Ggl73QQ5CxM2XTlE,9464
@@ -90,10 +90,10 @@ jarvis/jarvis_utils/input.py,sha256=FkLW7MXL8awQUghFLQnW1r5F1wV8K3EZeVPwHFRHJTo,
90
90
  jarvis/jarvis_utils/methodology.py,sha256=A8pE8ZqNHvGKaDO4TFtg7Oz-hAXPBcQfhmSPWMr6vdg,8629
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=atSK-2cUr7_tOIFsQzJnuQxebi7aFN4jtmaoXEaV4jM,10692
94
- jarvis_ai_assistant-0.1.185.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
95
- jarvis_ai_assistant-0.1.185.dist-info/METADATA,sha256=_DBSrubK80hRPGRBLXCpPy7r7tgcEhMM_RDS82mvaFw,15923
96
- jarvis_ai_assistant-0.1.185.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
97
- jarvis_ai_assistant-0.1.185.dist-info/entry_points.txt,sha256=Gy3DOP1PYLMK0GCj4rrP_9lkOyBQ39EK_lKGUSwn41E,869
98
- jarvis_ai_assistant-0.1.185.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
99
- jarvis_ai_assistant-0.1.185.dist-info/RECORD,,
93
+ jarvis/jarvis_utils/utils.py,sha256=dTFIN6EV48BuC4VOyvcVcj4P0tsWysc9ennbMRhLJjk,10960
94
+ jarvis_ai_assistant-0.1.186.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
95
+ jarvis_ai_assistant-0.1.186.dist-info/METADATA,sha256=9W9DQ__NkfHLemo6-uXEn62SiFyrg9iVuNSE2yPs2mE,15923
96
+ jarvis_ai_assistant-0.1.186.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
+ jarvis_ai_assistant-0.1.186.dist-info/entry_points.txt,sha256=Gy3DOP1PYLMK0GCj4rrP_9lkOyBQ39EK_lKGUSwn41E,869
98
+ jarvis_ai_assistant-0.1.186.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
99
+ jarvis_ai_assistant-0.1.186.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5