jarvis-ai-assistant 0.1.63__py3-none-any.whl → 0.1.74__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.

jarvis/models/oyi.py CHANGED
@@ -25,8 +25,6 @@ class OyiModel(BasePlatform):
25
25
  else:
26
26
  PrettyOutput.print("获取模型列表失败", OutputType.WARNING)
27
27
 
28
- PrettyOutput.print("使用OYI_MODEL环境变量配置模型", OutputType.SUCCESS)
29
-
30
28
  self.messages = []
31
29
  self.system_message = ""
32
30
  self.conversation = None
@@ -37,11 +35,10 @@ class OyiModel(BasePlatform):
37
35
  if not self.token:
38
36
  raise Exception("OYI_API_KEY is not set")
39
37
 
40
- self.model_name = os.getenv("OYI_MODEL") or os.getenv("JARVIS_MODEL") or "deepseek-chat"
38
+ self.model_name = os.getenv("JARVIS_MODEL") or "deepseek-chat"
41
39
  if self.model_name not in [m.split()[0] for m in available_models]:
42
40
  PrettyOutput.print(f"警告: 当前选择的模型 {self.model_name} 不在可用列表中", OutputType.WARNING)
43
41
 
44
- PrettyOutput.print(f"当前使用模型: {self.model_name}", OutputType.SYSTEM)
45
42
 
46
43
  def set_model_name(self, model_name: str):
47
44
  """设置模型名称"""
jarvis/models/registry.py CHANGED
@@ -121,7 +121,7 @@ class PlatformRegistry:
121
121
  # 检查平台实现
122
122
  if not PlatformRegistry.check_platform_implementation(obj):
123
123
  continue
124
-
124
+ PrettyOutput.print(f"从 {os.path.join(directory, filename)} 加载平台:{obj.platform_name}", OutputType.SUCCESS)
125
125
  platforms[obj.platform_name] = obj
126
126
  break
127
127
  except Exception as e:
jarvis/tools/__init__.py CHANGED
@@ -3,3 +3,4 @@ from .registry import ToolRegistry
3
3
  __all__ = [
4
4
  'ToolRegistry',
5
5
  ]
6
+
@@ -0,0 +1,74 @@
1
+ import os
2
+ from typing import Any, Dict
3
+ from jarvis.jarvis_codebase.main import CodeBase
4
+ from jarvis.utils import find_git_root, PrettyOutput, OutputType
5
+
6
+ class CodebaseQATool:
7
+ """代码库问答工具,用于回答关于代码库的问题"""
8
+
9
+ name = "codebase_qa"
10
+ description = "回答关于代码库的问题,可以查询和理解代码的功能、结构和实现细节"
11
+ parameters = {
12
+ "type": "object",
13
+ "properties": {
14
+ "dir": {
15
+ "type": "string",
16
+ "description": "项目根目录"
17
+ },
18
+ "question": {
19
+ "type": "string",
20
+ "description": "关于代码库的问题"
21
+ },
22
+ "top_k": {
23
+ "type": "integer",
24
+ "description": "搜索相关文件的数量",
25
+ "default": 5
26
+ }
27
+ },
28
+ "required": ["question"]
29
+ }
30
+
31
+ def execute(self, params: Dict[str, Any]) -> Dict[str, Any]:
32
+ """执行代码问答"""
33
+ try:
34
+ dir = params.get("dir")
35
+ question = params["question"]
36
+ top_k = params.get("top_k", 5)
37
+
38
+ # 初始化代码库
39
+ current_dir = os.getcwd()
40
+ root_dir = find_git_root(dir or current_dir)
41
+ if not root_dir:
42
+ return {
43
+ "success": False,
44
+ "stdout": "",
45
+ "stderr": "错误:当前目录不在Git仓库中",
46
+ "error": "NotInGitRepository"
47
+ }
48
+
49
+ os.chdir(root_dir)
50
+ codebase = CodeBase(root_dir)
51
+ # 生成索引
52
+
53
+ codebase.generate_codebase(force=True)
54
+ # 执行问答
55
+ response = codebase.ask_codebase(question, top_k)
56
+ os.chdir(current_dir)
57
+ return {
58
+ "success": True,
59
+ "stdout": response,
60
+ "stderr": "",
61
+ "error": None
62
+ }
63
+
64
+ except Exception as e:
65
+ PrettyOutput.print(f"代码问答出错: {str(e)}", output_type=OutputType.ERROR)
66
+ return {
67
+ "success": False,
68
+ "stdout": "",
69
+ "stderr": f"执行代码问答时发生错误: {str(e)}",
70
+ "error": str(type(e).__name__)
71
+ }
72
+
73
+ def register():
74
+ return CodebaseQATool()
jarvis/tools/registry.py CHANGED
@@ -99,7 +99,7 @@ class ToolRegistry:
99
99
  parameters=tool_instance.parameters,
100
100
  func=tool_instance.execute
101
101
  )
102
- PrettyOutput.print(f"从 {file_path} 加载工具: {tool_instance.name}: {tool_instance.description}", OutputType.INFO)
102
+ PrettyOutput.print(f"从 {file_path} 加载工具: {tool_instance.name}: {tool_instance.description}", OutputType.SUCCESS)
103
103
  tool_found = True
104
104
  break
105
105
 
jarvis/utils.py CHANGED
@@ -158,7 +158,7 @@ def get_multiline_input(tip: str) -> str:
158
158
  lines.append(line)
159
159
 
160
160
  except KeyboardInterrupt:
161
- PrettyOutput.print("\n输入已取消", OutputType.ERROR)
161
+ PrettyOutput.print("\n输入已取消", OutputType.INFO)
162
162
  return "__interrupt__"
163
163
 
164
164
  return "\n".join(lines)
@@ -200,3 +200,10 @@ def while_true(func, sleep_time: float = 0.1):
200
200
  PrettyOutput.print(f"执行失败,{sleep_time}s后重试...", OutputType.WARNING)
201
201
  time.sleep(sleep_time)
202
202
  return ret
203
+
204
+ def find_git_root(dir="."):
205
+ curr_dir = os.getcwd()
206
+ os.chdir(dir)
207
+ ret = os.popen("git rev-parse --show-toplevel").read().strip()
208
+ os.chdir(curr_dir)
209
+ return ret
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.63
3
+ Version: 0.1.74
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
@@ -44,6 +44,10 @@ Requires-Dist: colorama>=0.4.6
44
44
  Requires-Dist: prompt_toolkit>=3.0.0
45
45
  Requires-Dist: openai>=1.20.0
46
46
  Requires-Dist: playwright>=1.41.1
47
+ Requires-Dist: numpy>=1.24.0
48
+ Requires-Dist: faiss-cpu>=1.8.0
49
+ Requires-Dist: sentence-transformers>=2.2.2
50
+ Requires-Dist: bs4>=0.0.1
47
51
  Provides-Extra: dev
48
52
  Requires-Dist: pytest; extra == "dev"
49
53
  Requires-Dist: black; extra == "dev"
@@ -122,6 +126,9 @@ Jarvis supports configuration through environment variables that can be set in t
122
126
  | JARVIS_MODEL | Model name to use | - | No |
123
127
  | JARVIS_CODEGEN_PLATFORM | AI platform for code generation | Same as JARVIS_PLATFORM | No |
124
128
  | JARVIS_CODEGEN_MODEL | Model name for code generation | Same as JARVIS_MODEL | No |
129
+ | JARVIS_CHEAP_PLATFORM | AI platform for cheap operations | Same as JARVIS_PLATFORM | No |
130
+ | JARVIS_CHEAP_MODEL | Model name for cheap operations | Same as JARVIS_MODEL | No |
131
+ | JARVIS_EMBEDDING_MODEL | Embedding model for code analysis | BAAI/bge-large-zh-v1.5 | No |
125
132
  | OPENAI_API_KEY | API key for OpenAI platform | - | Required for OpenAI |
126
133
  | OPENAI_API_BASE | Base URL for OpenAI API | https://api.deepseek.com | No |
127
134
  | OPENAI_MODEL_NAME | Model name for OpenAI | deepseek-chat | No |
@@ -139,15 +146,26 @@ Jarvis supports configuration through environment variables that can be set in t
139
146
  jarvis
140
147
  ```
141
148
 
149
+
142
150
  ### With Specific Model
143
151
  ```bash
144
152
  jarvis -p kimi # Use Kimi platform
145
153
  jarvis -p openai # Use OpenAI platform
146
154
  ```
147
155
 
148
- ### Process Files
156
+ ### Code Modification
149
157
  ```bash
150
- jarvis -f file1.py file2.py # Process specific files
158
+ jarvis-coder --feature "Add new feature" # Modify code to add new feature
159
+ ```
160
+
161
+ ### Codebase Search
162
+ ```bash
163
+ jarvis-codebase --search "database connection" # Search codebase
164
+ ```
165
+
166
+ ### Codebase Question
167
+ ```bash
168
+ jarvis-codebase --ask "How to use the database?" # Ask about codebase
151
169
  ```
152
170
 
153
171
  ### Keep Chat History
@@ -157,6 +175,7 @@ jarvis --keep-history # Don't delete chat session after completion
157
175
 
158
176
  ## 🛠️ Tools
159
177
 
178
+
160
179
  ### Built-in Tools
161
180
 
162
181
  | Tool | Description |
@@ -166,27 +185,43 @@ jarvis --keep-history # Don't delete chat session after completion
166
185
  | generate_tool | AI-powered tool generation and integration |
167
186
  | methodology | Experience accumulation and methodology management |
168
187
  | create_sub_agent | Create specialized sub-agents for specific tasks |
188
+ | coder | Automatic code modification and generation tool |
189
+ | codebase | Codebase management and search tool |
169
190
 
170
191
  ### Tool Locations
171
192
  - Built-in tools: `src/jarvis/tools/`
172
193
  - User tools: `~/.jarvis_tools/`
173
194
 
195
+
174
196
  ### Key Features
175
197
 
176
198
  #### 1. Self-Extending Capabilities
177
199
  - Tool generation through natural language description
178
200
  - Automatic code generation and integration
179
201
  - Dynamic capability expansion through sub-agents
202
+ - Automatic code modification with version control
203
+ - Codebase indexing and semantic search
180
204
 
181
205
  #### 2. Methodology Learning
182
206
  - Automatic experience accumulation from interactions
183
207
  - Pattern recognition and methodology extraction
184
208
  - Continuous refinement through usage
209
+ - Code modification history tracking
210
+ - Codebase analysis and documentation generation
185
211
 
186
212
  #### 3. Adaptive Problem Solving
187
213
  - Context-aware sub-agent creation
188
214
  - Dynamic tool composition
189
215
  - Learning from execution feedback
216
+ - Codebase-aware problem solving
217
+ - Multi-model collaboration for complex tasks
218
+
219
+ #### 4. Code Intelligence
220
+ - Automatic codebase indexing
221
+ - Semantic code search
222
+ - Code modification with git integration
223
+ - Code analysis and documentation
224
+ - Multi-model code generation
190
225
 
191
226
  ## 🎯 Extending Jarvis
192
227
 
@@ -0,0 +1,33 @@
1
+ jarvis/__init__.py,sha256=un8MKMurE4TQ58dJg7nKMX1AVpzjB6SOlLsT0fZsdWI,50
2
+ jarvis/agent.py,sha256=jQAEJ3C8DEcmtCozXCieUcRKhhPSXJe8ylWuI4LSrOk,15032
3
+ jarvis/main.py,sha256=7EcSlxa5JFFXBujzKDWdNtwX6axLhFFdJMc2GxTjfdk,6295
4
+ jarvis/utils.py,sha256=vZV8sHj0ggZy4Rb8RxIujQhRWgeNEomhqVl4WXmpq7c,7498
5
+ jarvis/jarvis_codebase/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ jarvis/jarvis_codebase/main.py,sha256=G8ADdTgjZTxEjvP11IBbjHiNWCvuTkFiLkDKq_8UpI0,26947
7
+ jarvis/jarvis_coder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ jarvis/jarvis_coder/main.py,sha256=4YhQ20MD8ntdD5hjmjJbBHYEDPDZ2aPIgAviJCvtOXE,24458
9
+ jarvis/models/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
10
+ jarvis/models/ai8.py,sha256=vgy-r_3HHxGMAalZrA65VWHC1PuwBTYgtprSgHkCbrk,12557
11
+ jarvis/models/base.py,sha256=ShV1H8Unee4RMaiFO4idROQA0Hc6wu4dyeRPX5fcszk,1433
12
+ jarvis/models/kimi.py,sha256=1iTB0Z_WOmCML3Ufsge6jmeKOYvccr7I5lS3JUXymU4,17611
13
+ jarvis/models/openai.py,sha256=ayaBWAN5VexMcKVrjEPDNB-Q9wx0sCV9Z4BCrvwYJ9w,4315
14
+ jarvis/models/oyi.py,sha256=X2c5SWDIuQDCCFBcEKbzIWEz3I34eOAi0d1XAFgxlpw,15001
15
+ jarvis/models/registry.py,sha256=YpooKSpk5pSWfb5cBDz5wRfPK-abb9uuUZr4WBejqwI,7762
16
+ jarvis/tools/__init__.py,sha256=7Rqyj5hBAv5cWDVr5T9ZTZASO7ssBHeQNm2_4ZARdkA,72
17
+ jarvis/tools/base.py,sha256=EGRGbdfbLXDLwtyoWdvp9rlxNX7bzc20t0Vc2VkwIEY,652
18
+ jarvis/tools/codebase_qa.py,sha256=LsowsgL7HBmdBwa7zXcYi_OkwOok4qbnzYWYsuZxHtU,2413
19
+ jarvis/tools/coder.py,sha256=ZJfPInKms4Hj3-eQlBwamVsvZ-2nlZ-4jsqJ-tJc6mg,2040
20
+ jarvis/tools/file_ops.py,sha256=h8g0eT9UvlJf4kt0DLXvdSsjcPj7x19lxWdDApeDfpg,3842
21
+ jarvis/tools/generator.py,sha256=vVP3eN5cCDpRXf_fn0skETkPXAW1XZFWx9pt2_ahK48,5999
22
+ jarvis/tools/methodology.py,sha256=UG6s5VYRcd9wrKX4cg6f7zJhet5AIcthFGMOAdevBiw,5175
23
+ jarvis/tools/registry.py,sha256=MeTYNdZNRdhlgABviVxzbDPSgLpwDp2Nx2dGzedRu8U,7212
24
+ jarvis/tools/search.py,sha256=1EqOVvLhg2Csh-i03-XeCrusbyfmH69FZ8khwZt8Tow,6131
25
+ jarvis/tools/shell.py,sha256=UPKshPyOaUwTngresUw-ot1jHjQIb4wCY5nkJqa38lU,2520
26
+ jarvis/tools/sub_agent.py,sha256=rEtAmSVY2ZjFOZEKr5m5wpACOQIiM9Zr_3dT92FhXYU,2621
27
+ jarvis/tools/webpage.py,sha256=d3w3Jcjcu1ESciezTkz3n3Zf-rp_l91PrVoDEZnckOo,2391
28
+ jarvis_ai_assistant-0.1.74.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
29
+ jarvis_ai_assistant-0.1.74.dist-info/METADATA,sha256=ajh1yMCWevAgppfPVYQxcKV4J143iOBz1SyBC9KGd9o,12399
30
+ jarvis_ai_assistant-0.1.74.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
31
+ jarvis_ai_assistant-0.1.74.dist-info/entry_points.txt,sha256=QNUeqmUJd7nHufel2FO7cRttS1uKFfnbIyObv8eVyOY,140
32
+ jarvis_ai_assistant-0.1.74.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
33
+ jarvis_ai_assistant-0.1.74.dist-info/RECORD,,
@@ -1,3 +1,4 @@
1
1
  [console_scripts]
2
2
  jarvis = jarvis.main:main
3
+ jarvis-codebase = jarvis.jarvis_codebase.main:main
3
4
  jarvis-coder = jarvis.jarvis_coder.main:main
@@ -1,29 +0,0 @@
1
- jarvis/__init__.py,sha256=sZ5DQXpur0P2tY_PCFzbnYK8EQLpCoUcnhPRL-xFwRg,50
2
- jarvis/agent.py,sha256=aIth7geQ2ZIugBYjW_Rx3sr-I6NuZtH1INEj4hOBVD4,14242
3
- jarvis/main.py,sha256=gXXtnrkkvGwEswJL6qiYjVrg3bpzye-GJeAe0Nf2B9o,6509
4
- jarvis/utils.py,sha256=JlkuC9RtspXH2VWDmj9nR0vnb8ie1gIsKc4vC7WRco8,7321
5
- jarvis/jarvis_coder/main.py,sha256=TosDDiaYSjDpzKPNKcygxZ3XXWbcnvBmIIMn3UMBc60,35102
6
- jarvis/models/__init__.py,sha256=mrOt67nselz_H1gX9wdAO4y2DY5WPXzABqJbr5Des8k,63
7
- jarvis/models/ai8.py,sha256=AMBZRS9hKW1Ts_YoHMMelhT0CRMeMzHtVH31z0FpP-Q,12671
8
- jarvis/models/base.py,sha256=ShV1H8Unee4RMaiFO4idROQA0Hc6wu4dyeRPX5fcszk,1433
9
- jarvis/models/kimi.py,sha256=1iTB0Z_WOmCML3Ufsge6jmeKOYvccr7I5lS3JUXymU4,17611
10
- jarvis/models/openai.py,sha256=7oOxrL6EM7iaqJgZsaFvVmyzY0ars4BP3EKAUlX1RPw,4403
11
- jarvis/models/oyi.py,sha256=mW-uhUZbts2L_oI8WueZUTEmrLY1CiBHn4UV2HP7ZCE,15214
12
- jarvis/models/registry.py,sha256=hJyaROiOF_TkbtIXsjOD8-ArOvAvtxviawyqBFfLV6s,7617
13
- jarvis/tools/__init__.py,sha256=Kj1bKj34lwRDKMKHLOrLyQElf2lHbqA2tDgP359eaDo,71
14
- jarvis/tools/base.py,sha256=EGRGbdfbLXDLwtyoWdvp9rlxNX7bzc20t0Vc2VkwIEY,652
15
- jarvis/tools/coder.py,sha256=ZJfPInKms4Hj3-eQlBwamVsvZ-2nlZ-4jsqJ-tJc6mg,2040
16
- jarvis/tools/file_ops.py,sha256=h8g0eT9UvlJf4kt0DLXvdSsjcPj7x19lxWdDApeDfpg,3842
17
- jarvis/tools/generator.py,sha256=vVP3eN5cCDpRXf_fn0skETkPXAW1XZFWx9pt2_ahK48,5999
18
- jarvis/tools/methodology.py,sha256=UG6s5VYRcd9wrKX4cg6f7zJhet5AIcthFGMOAdevBiw,5175
19
- jarvis/tools/registry.py,sha256=mlOAmUq3yzRz-7yvwrrCwbe5Lmw8eh1v8-_Fa5sezwI,7209
20
- jarvis/tools/search.py,sha256=1EqOVvLhg2Csh-i03-XeCrusbyfmH69FZ8khwZt8Tow,6131
21
- jarvis/tools/shell.py,sha256=UPKshPyOaUwTngresUw-ot1jHjQIb4wCY5nkJqa38lU,2520
22
- jarvis/tools/sub_agent.py,sha256=rEtAmSVY2ZjFOZEKr5m5wpACOQIiM9Zr_3dT92FhXYU,2621
23
- jarvis/tools/webpage.py,sha256=d3w3Jcjcu1ESciezTkz3n3Zf-rp_l91PrVoDEZnckOo,2391
24
- jarvis_ai_assistant-0.1.63.dist-info/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
25
- jarvis_ai_assistant-0.1.63.dist-info/METADATA,sha256=8Kq0xkFkfbqX9sB6kR3h9yKJhtb2T5hgeVBy_1Onyx4,11213
26
- jarvis_ai_assistant-0.1.63.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
- jarvis_ai_assistant-0.1.63.dist-info/entry_points.txt,sha256=ieRI4ilnGNx1R6LlzT2P510mJ27lhLesVZToezDjSd8,89
28
- jarvis_ai_assistant-0.1.63.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
29
- jarvis_ai_assistant-0.1.63.dist-info/RECORD,,