jarvis-ai-assistant 0.1.63__tar.gz → 0.1.65__tar.gz

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 (40) hide show
  1. {jarvis_ai_assistant-0.1.63/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.65}/PKG-INFO +38 -3
  2. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/README.md +34 -2
  3. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/pyproject.toml +6 -2
  4. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/setup.py +6 -2
  5. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/__init__.py +1 -1
  6. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/agent.py +28 -22
  7. jarvis_ai_assistant-0.1.65/src/jarvis/jarvis_codebase/__init__.py +0 -0
  8. jarvis_ai_assistant-0.1.65/src/jarvis/jarvis_codebase/main.py +342 -0
  9. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/jarvis_coder/main.py +24 -361
  10. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/main.py +0 -2
  11. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/models/ai8.py +1 -2
  12. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/models/openai.py +0 -1
  13. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/models/oyi.py +1 -4
  14. jarvis_ai_assistant-0.1.65/src/jarvis/tools/__init__.py +9 -0
  15. jarvis_ai_assistant-0.1.65/src/jarvis/tools/codebase_qa.py +70 -0
  16. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/utils.py +7 -0
  17. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65/src/jarvis_ai_assistant.egg-info}/PKG-INFO +38 -3
  18. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +3 -0
  19. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis_ai_assistant.egg-info/entry_points.txt +1 -0
  20. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis_ai_assistant.egg-info/requires.txt +3 -0
  21. jarvis_ai_assistant-0.1.63/src/jarvis/tools/__init__.py +0 -5
  22. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/LICENSE +0 -0
  23. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/MANIFEST.in +0 -0
  24. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/setup.cfg +0 -0
  25. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/models/__init__.py +0 -0
  26. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/models/base.py +0 -0
  27. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/models/kimi.py +0 -0
  28. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/models/registry.py +0 -0
  29. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/base.py +0 -0
  30. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/coder.py +0 -0
  31. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/file_ops.py +0 -0
  32. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/generator.py +0 -0
  33. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/methodology.py +0 -0
  34. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/registry.py +0 -0
  35. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/search.py +0 -0
  36. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/shell.py +0 -0
  37. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/sub_agent.py +0 -0
  38. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis/tools/webpage.py +0 -0
  39. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  40. {jarvis_ai_assistant-0.1.63 → jarvis_ai_assistant-0.1.65}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
@@ -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.65
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,9 @@ 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.26.0
48
+ Requires-Dist: faiss-cpu>=1.8.1
49
+ Requires-Dist: sentence-transformers>=2.2.2
47
50
  Provides-Extra: dev
48
51
  Requires-Dist: pytest; extra == "dev"
49
52
  Requires-Dist: black; extra == "dev"
@@ -120,8 +123,12 @@ Jarvis supports configuration through environment variables that can be set in t
120
123
  |---------|------|--------|------|
121
124
  | JARVIS_PLATFORM | AI platform to use, supports kimi/openai/ai8 etc | kimi | Yes |
122
125
  | JARVIS_MODEL | Model name to use | - | No |
126
+
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
157
+ ```bash
158
+ jarvis coder --feature "Add new feature" # Modify code to add new feature
159
+ ```
160
+
161
+ ### Codebase Search
149
162
  ```bash
150
- jarvis -f file1.py file2.py # Process specific files
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
 
@@ -65,8 +65,12 @@ Jarvis supports configuration through environment variables that can be set in t
65
65
  |---------|------|--------|------|
66
66
  | JARVIS_PLATFORM | AI platform to use, supports kimi/openai/ai8 etc | kimi | Yes |
67
67
  | JARVIS_MODEL | Model name to use | - | No |
68
+
68
69
  | JARVIS_CODEGEN_PLATFORM | AI platform for code generation | Same as JARVIS_PLATFORM | No |
69
70
  | JARVIS_CODEGEN_MODEL | Model name for code generation | Same as JARVIS_MODEL | No |
71
+ | JARVIS_CHEAP_PLATFORM | AI platform for cheap operations | Same as JARVIS_PLATFORM | No |
72
+ | JARVIS_CHEAP_MODEL | Model name for cheap operations | Same as JARVIS_MODEL | No |
73
+ | JARVIS_EMBEDDING_MODEL | Embedding model for code analysis | BAAI/bge-large-zh-v1.5 | No |
70
74
  | OPENAI_API_KEY | API key for OpenAI platform | - | Required for OpenAI |
71
75
  | OPENAI_API_BASE | Base URL for OpenAI API | https://api.deepseek.com | No |
72
76
  | OPENAI_MODEL_NAME | Model name for OpenAI | deepseek-chat | No |
@@ -84,15 +88,26 @@ Jarvis supports configuration through environment variables that can be set in t
84
88
  jarvis
85
89
  ```
86
90
 
91
+
87
92
  ### With Specific Model
88
93
  ```bash
89
94
  jarvis -p kimi # Use Kimi platform
90
95
  jarvis -p openai # Use OpenAI platform
91
96
  ```
92
97
 
93
- ### Process Files
98
+ ### Code Modification
99
+ ```bash
100
+ jarvis coder --feature "Add new feature" # Modify code to add new feature
101
+ ```
102
+
103
+ ### Codebase Search
94
104
  ```bash
95
- jarvis -f file1.py file2.py # Process specific files
105
+ jarvis codebase --search "database connection" # Search codebase
106
+ ```
107
+
108
+ ### Codebase Question
109
+ ```bash
110
+ jarvis codebase --ask "How to use the database?" # Ask about codebase
96
111
  ```
97
112
 
98
113
  ### Keep Chat History
@@ -102,6 +117,7 @@ jarvis --keep-history # Don't delete chat session after completion
102
117
 
103
118
  ## 🛠️ Tools
104
119
 
120
+
105
121
  ### Built-in Tools
106
122
 
107
123
  | Tool | Description |
@@ -111,27 +127,43 @@ jarvis --keep-history # Don't delete chat session after completion
111
127
  | generate_tool | AI-powered tool generation and integration |
112
128
  | methodology | Experience accumulation and methodology management |
113
129
  | create_sub_agent | Create specialized sub-agents for specific tasks |
130
+ | coder | Automatic code modification and generation tool |
131
+ | codebase | Codebase management and search tool |
114
132
 
115
133
  ### Tool Locations
116
134
  - Built-in tools: `src/jarvis/tools/`
117
135
  - User tools: `~/.jarvis_tools/`
118
136
 
137
+
119
138
  ### Key Features
120
139
 
121
140
  #### 1. Self-Extending Capabilities
122
141
  - Tool generation through natural language description
123
142
  - Automatic code generation and integration
124
143
  - Dynamic capability expansion through sub-agents
144
+ - Automatic code modification with version control
145
+ - Codebase indexing and semantic search
125
146
 
126
147
  #### 2. Methodology Learning
127
148
  - Automatic experience accumulation from interactions
128
149
  - Pattern recognition and methodology extraction
129
150
  - Continuous refinement through usage
151
+ - Code modification history tracking
152
+ - Codebase analysis and documentation generation
130
153
 
131
154
  #### 3. Adaptive Problem Solving
132
155
  - Context-aware sub-agent creation
133
156
  - Dynamic tool composition
134
157
  - Learning from execution feedback
158
+ - Codebase-aware problem solving
159
+ - Multi-model collaboration for complex tasks
160
+
161
+ #### 4. Code Intelligence
162
+ - Automatic codebase indexing
163
+ - Semantic code search
164
+ - Code modification with git integration
165
+ - Code analysis and documentation
166
+ - Multi-model code generation
135
167
 
136
168
  ## 🎯 Extending Jarvis
137
169
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jarvis-ai-assistant"
7
- version = "0.1.63"
7
+ version = "0.1.65"
8
8
  description = "Jarvis: An AI assistant that uses tools to interact with the system"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Your Name", email = "your.email@example.com" }]
@@ -26,6 +26,9 @@ dependencies = [
26
26
  "prompt_toolkit>=3.0.0",
27
27
  "openai>=1.20.0",
28
28
  "playwright>=1.41.1",
29
+ "numpy>=1.26.0",
30
+ "faiss-cpu>=1.8.1",
31
+ "sentence-transformers>=2.2.2",
29
32
  ]
30
33
  requires-python = ">=3.8"
31
34
 
@@ -37,4 +40,5 @@ Homepage = "https://github.com/skyfireitdiy/Jarvis"
37
40
 
38
41
  [project.scripts]
39
42
  jarvis = "jarvis.main:main"
40
- jarvis-coder = "jarvis.jarvis_coder.main:main"
43
+ jarvis-coder = "jarvis.jarvis_coder.main:main"
44
+ jarvis-codebase = "jarvis.jarvis_codebase.main:main"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="jarvis-ai-assistant",
5
- version="0.1.63",
5
+ version="0.1.65",
6
6
  author="skyfire",
7
7
  author_email="skyfireitdiy@hotmail.com",
8
8
  description="An AI assistant that uses various tools to interact with the system",
@@ -19,11 +19,15 @@ setup(
19
19
  "prompt_toolkit>=3.0.0",
20
20
  "openai>=1.20.0",
21
21
  "playwright>=1.41.1",
22
+ "numpy>=1.26.0",
23
+ "faiss-cpu>=1.8.1",
24
+ "sentence-transformers>=2.2.2",
22
25
  ],
23
26
  entry_points={
24
27
  "console_scripts": [
25
28
  "jarvis=jarvis.main:main",
26
- "jarvis-coder=jarvis.jarvis_coder.main:main"
29
+ "jarvis-coder=jarvis.jarvis_coder.main:main",
30
+ "jarvis-codebase=jarvis.jarvis_codebase.main:main",
27
31
  ],
28
32
  },
29
33
  python_requires=">=3.8",
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.63"
3
+ __version__ = "0.1.65"
@@ -142,20 +142,6 @@ class Agent:
142
142
  except Exception as e:
143
143
  PrettyOutput.print(f"总结对话历史失败: {str(e)}", OutputType.ERROR)
144
144
 
145
-
146
- def _choose_methodology(self, methodology: Dict[str, str], task: str) -> str:
147
- """选择方法论"""
148
- prompt = f"""请根据任务内容选择合适的方法论,并返回方法论内容,格式如下:
149
- 任务内容:
150
- {task}
151
-
152
- 方法论:
153
- """
154
- for k, v in methodology.items():
155
- prompt += f"问题类型:{k}\n"
156
- prompt += f"方法论:{v}\n"
157
- return self._call_model(prompt)
158
-
159
145
  def _complete_task(self) -> str:
160
146
  """完成任务并生成总结
161
147
 
@@ -164,6 +150,34 @@ class Agent:
164
150
  """
165
151
  PrettyOutput.section("任务完成", OutputType.SUCCESS)
166
152
 
153
+ # 询问是否生成方法论,带输入验证
154
+ while True:
155
+ user_input = input("是否要为此任务生成方法论?(y/n): ").strip().lower()
156
+ if user_input in ['y', 'n', '']:
157
+ break
158
+ PrettyOutput.print("无效输入,请输入 y 或 n", OutputType.WARNING)
159
+
160
+ if user_input == 'y':
161
+ try:
162
+ # 让模型判断是否需要生成方法论
163
+ analysis_prompt = """本次任务已结束,请分析是否需要生成方法论。
164
+ 如果认为需要生成方法论,请先判断是创建新的方法论还是更新已有方法论。如果是更新已有方法论,使用update,否则使用add。
165
+ 如果认为不需要生成方法论,请说明原因。
166
+ 仅输出方法论工具的调用指令,或者是不需要生成方法论的说明,除此之外不要输出任何内容。
167
+ """
168
+ self.prompt = analysis_prompt
169
+ response = self._call_model(self.prompt)
170
+
171
+ # 检查是否包含工具调用
172
+ try:
173
+ result = Agent.extract_tool_calls(response)
174
+ PrettyOutput.print(result, OutputType.RESULT)
175
+ except Exception as e:
176
+ PrettyOutput.print(f"处理方法论生成失败: {str(e)}", OutputType.ERROR)
177
+
178
+ except Exception as e:
179
+ PrettyOutput.print(f"生成方法论时发生错误: {str(e)}", OutputType.ERROR)
180
+
167
181
  if not self.is_sub_agent:
168
182
  return "Task completed"
169
183
 
@@ -198,9 +212,6 @@ class Agent:
198
212
 
199
213
  # 加载方法论
200
214
  methodology = self._load_methodology()
201
-
202
- methodology =self._choose_methodology(methodology, user_input)
203
-
204
215
  methodology_prompt = ""
205
216
  if methodology:
206
217
  methodology_prompt = f"""这是以往处理问题的标准方法论,如果当前任务与此类似,可参考:
@@ -271,7 +282,6 @@ arguments:
271
282
 
272
283
  特殊指令:
273
284
  1. !<<SUMMARIZE>>! - 当你发现对话历史过长可能导致token超限时,可以使用此指令总结当前对话要点并清空历史。使用方法:直接回复"!<<SUMMARIZE>>!"即可。
274
- 2. !<<FINISHED>>! - 当你确认任务已经完成时,使用此指令结束任务。使用方法:在回复中包含"!<<FINISHED>>!"即可。
275
285
 
276
286
  -------------------------------------------------------------
277
287
 
@@ -316,10 +326,6 @@ arguments:
316
326
  self.prompt = tool_result
317
327
  continue
318
328
 
319
- # 检查是否完成任务
320
- if "!<<FINISHED>>!" in current_response:
321
- return self._complete_task()
322
-
323
329
  # 获取用户输入
324
330
  user_input = get_multiline_input(f"{self.name}: 您可以继续输入,或输入空行结束当前任务")
325
331
  if user_input == "__interrupt__":