jarvis-ai-assistant 0.1.149__py3-none-any.whl → 0.1.151__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/__init__.py +1 -1
- jarvis/jarvis_agent/jarvis.py +7 -5
- jarvis/jarvis_git_utils/git_commiter.py +7 -0
- jarvis/jarvis_lsp/registry.py +2 -1
- jarvis/jarvis_mcp/__init__.py +65 -0
- jarvis/jarvis_mcp/local_mcp_client.py +326 -0
- jarvis/jarvis_mcp/remote_mcp_client.py +590 -0
- jarvis/jarvis_platform/kimi.py +3 -2
- jarvis/jarvis_platform/registry.py +2 -4
- jarvis/jarvis_platform/yuanbao.py +4 -4
- jarvis/jarvis_tools/ask_codebase.py +3 -10
- jarvis/jarvis_tools/file_operation.py +7 -26
- jarvis/jarvis_tools/methodology.py +2 -1
- jarvis/jarvis_tools/registry.py +168 -21
- jarvis/jarvis_utils/config.py +15 -9
- jarvis/jarvis_utils/embedding.py +2 -2
- jarvis/jarvis_utils/file_processors.py +0 -262
- jarvis/jarvis_utils/input.py +7 -1
- jarvis/jarvis_utils/methodology.py +4 -4
- jarvis/jarvis_utils/utils.py +5 -5
- {jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info}/METADATA +43 -18
- {jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info}/RECORD +26 -23
- {jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info}/WHEEL +1 -1
- {jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info/licenses}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
import fitz # PyMuPDF for PDF files
|
|
3
|
-
from docx import Document as DocxDocument # python-docx for DOCX files
|
|
4
|
-
from pptx import Presentation
|
|
5
|
-
import pandas as pd
|
|
6
1
|
import unicodedata
|
|
7
2
|
|
|
8
3
|
class FileProcessor:
|
|
@@ -84,260 +79,3 @@ class TextFileProcessor(FileProcessor):
|
|
|
84
79
|
|
|
85
80
|
except Exception as e:
|
|
86
81
|
raise Exception(f"Failed to read file: {str(e)}")
|
|
87
|
-
|
|
88
|
-
class PDFProcessor(FileProcessor):
|
|
89
|
-
"""PDF file processor"""
|
|
90
|
-
@staticmethod
|
|
91
|
-
def can_handle(file_path: str) -> bool:
|
|
92
|
-
return Path(file_path).suffix.lower() == '.pdf'
|
|
93
|
-
|
|
94
|
-
@staticmethod
|
|
95
|
-
def extract_text(file_path: str) -> str:
|
|
96
|
-
"""提取PDF文件中的所有文本内容,包括页码、图片描述等"""
|
|
97
|
-
try:
|
|
98
|
-
text_parts = []
|
|
99
|
-
with fitz.open(file_path) as doc: # type: ignore
|
|
100
|
-
# 添加文档信息
|
|
101
|
-
info = doc.metadata
|
|
102
|
-
if info:
|
|
103
|
-
meta_text = []
|
|
104
|
-
if info.get("title"):
|
|
105
|
-
meta_text.append(f"标题: {info['title']}")
|
|
106
|
-
if info.get("author"):
|
|
107
|
-
meta_text.append(f"作者: {info['author']}")
|
|
108
|
-
if info.get("subject"):
|
|
109
|
-
meta_text.append(f"主题: {info['subject']}")
|
|
110
|
-
if info.get("keywords"):
|
|
111
|
-
meta_text.append(f"关键词: {info['keywords']}")
|
|
112
|
-
|
|
113
|
-
if meta_text:
|
|
114
|
-
text_parts.append("=== 文档信息 ===")
|
|
115
|
-
text_parts.append("\n".join(meta_text))
|
|
116
|
-
|
|
117
|
-
# 提取目录结构(如果有)
|
|
118
|
-
toc = doc.get_toc() # type: ignore
|
|
119
|
-
if toc:
|
|
120
|
-
text_parts.append("\n=== 目录结构 ===")
|
|
121
|
-
for level, title, page in toc:
|
|
122
|
-
indent = " " * (level - 1)
|
|
123
|
-
text_parts.append(f"{indent}- {title} (第{page}页)")
|
|
124
|
-
|
|
125
|
-
# 处理各页内容
|
|
126
|
-
text_parts.append("\n=== 页面内容 ===")
|
|
127
|
-
for page_index in range(len(doc)): # 使用范围遍历而不是直接枚举文档对象
|
|
128
|
-
# 添加页码标记
|
|
129
|
-
text_parts.append(f"\n--- 第{page_index+1}页 ---")
|
|
130
|
-
|
|
131
|
-
# 获取页面
|
|
132
|
-
page = doc[page_index]
|
|
133
|
-
|
|
134
|
-
# 提取页面文本(包括结构信息)
|
|
135
|
-
try:
|
|
136
|
-
# 尝试使用结构化提取(保留段落和块结构)
|
|
137
|
-
text = page.get_text("text") # type: ignore
|
|
138
|
-
text = text.strip()
|
|
139
|
-
if text:
|
|
140
|
-
text_parts.append(text)
|
|
141
|
-
except Exception:
|
|
142
|
-
# 如果结构化提取失败,回退到简单文本提取
|
|
143
|
-
text = page.get_text() # type: ignore
|
|
144
|
-
if text.strip():
|
|
145
|
-
text_parts.append(text.strip())
|
|
146
|
-
|
|
147
|
-
# 提取图像信息(如果需要)
|
|
148
|
-
# 注意:这可能会增加处理时间,可根据需要启用
|
|
149
|
-
"""
|
|
150
|
-
image_list = page.get_images()
|
|
151
|
-
if image_list:
|
|
152
|
-
text_parts.append(f"本页包含 {len(image_list)} 个图像")
|
|
153
|
-
"""
|
|
154
|
-
|
|
155
|
-
# 合并所有文本
|
|
156
|
-
return "\n".join(text_parts)
|
|
157
|
-
|
|
158
|
-
except Exception as e:
|
|
159
|
-
# 处理可能的异常
|
|
160
|
-
return f"PDF处理错误: {str(e)}"
|
|
161
|
-
|
|
162
|
-
class DocxProcessor(FileProcessor):
|
|
163
|
-
"""DOCX file processor"""
|
|
164
|
-
@staticmethod
|
|
165
|
-
def can_handle(file_path: str) -> bool:
|
|
166
|
-
return Path(file_path).suffix.lower() == '.docx'
|
|
167
|
-
|
|
168
|
-
@staticmethod
|
|
169
|
-
def extract_text(file_path: str) -> str:
|
|
170
|
-
"""提取 DOCX 文件中的所有文本内容,包括段落、表格、页眉页脚等"""
|
|
171
|
-
doc = DocxDocument(file_path)
|
|
172
|
-
full_text = []
|
|
173
|
-
|
|
174
|
-
# 提取段落文本
|
|
175
|
-
for para in doc.paragraphs:
|
|
176
|
-
if para.text.strip(): # 跳过空段落
|
|
177
|
-
full_text.append(para.text)
|
|
178
|
-
|
|
179
|
-
# 提取表格文本
|
|
180
|
-
for table in doc.tables:
|
|
181
|
-
for row in table.rows:
|
|
182
|
-
row_texts = []
|
|
183
|
-
for cell in row.cells:
|
|
184
|
-
# 每个单元格可能包含多个段落
|
|
185
|
-
cell_text = "\n".join([p.text for p in cell.paragraphs if p.text.strip()])
|
|
186
|
-
if cell_text:
|
|
187
|
-
row_texts.append(cell_text)
|
|
188
|
-
if row_texts:
|
|
189
|
-
full_text.append(" | ".join(row_texts))
|
|
190
|
-
|
|
191
|
-
# 提取页眉页脚(如果有节)
|
|
192
|
-
try:
|
|
193
|
-
for section in doc.sections:
|
|
194
|
-
# 提取页眉
|
|
195
|
-
if section.header:
|
|
196
|
-
header_text = "\n".join([p.text for p in section.header.paragraphs if p.text.strip()])
|
|
197
|
-
if header_text:
|
|
198
|
-
full_text.append(f"页眉: {header_text}")
|
|
199
|
-
|
|
200
|
-
# 提取页脚
|
|
201
|
-
if section.footer:
|
|
202
|
-
footer_text = "\n".join([p.text for p in section.footer.paragraphs if p.text.strip()])
|
|
203
|
-
if footer_text:
|
|
204
|
-
full_text.append(f"页脚: {footer_text}")
|
|
205
|
-
except:
|
|
206
|
-
# 如果提取页眉页脚失败,忽略错误继续
|
|
207
|
-
pass
|
|
208
|
-
|
|
209
|
-
# 合并所有文本
|
|
210
|
-
return "\n\n".join(full_text)
|
|
211
|
-
|
|
212
|
-
class PPTProcessor(FileProcessor):
|
|
213
|
-
"""PPT file processor"""
|
|
214
|
-
@staticmethod
|
|
215
|
-
def can_handle(file_path: str) -> bool:
|
|
216
|
-
return Path(file_path).suffix.lower() in ['.ppt', '.pptx']
|
|
217
|
-
|
|
218
|
-
@staticmethod
|
|
219
|
-
def extract_text(file_path: str) -> str:
|
|
220
|
-
"""提取PPT文件中的所有文本内容,包括标题、文本框、备注等"""
|
|
221
|
-
prs = Presentation(file_path)
|
|
222
|
-
all_text = []
|
|
223
|
-
|
|
224
|
-
# 遍历所有幻灯片
|
|
225
|
-
for slide_index, slide in enumerate(prs.slides, 1):
|
|
226
|
-
slide_text = []
|
|
227
|
-
|
|
228
|
-
# 添加幻灯片编号
|
|
229
|
-
slide_text.append(f"=== 幻灯片 {slide_index} ===")
|
|
230
|
-
|
|
231
|
-
# 提取幻灯片中所有形状的文本
|
|
232
|
-
for shape in slide.shapes:
|
|
233
|
-
# 提取带有文本的形状
|
|
234
|
-
try:
|
|
235
|
-
if hasattr(shape, "text_frame") and shape.text_frame: # type: ignore
|
|
236
|
-
for paragraph in shape.text_frame.paragraphs: # type: ignore
|
|
237
|
-
text = paragraph.text.strip()
|
|
238
|
-
if text:
|
|
239
|
-
slide_text.append(text)
|
|
240
|
-
except AttributeError:
|
|
241
|
-
pass
|
|
242
|
-
|
|
243
|
-
# 提取表格内容
|
|
244
|
-
try:
|
|
245
|
-
if hasattr(shape, "table") and shape.table: # type: ignore
|
|
246
|
-
for row in shape.table.rows: # type: ignore
|
|
247
|
-
row_texts = []
|
|
248
|
-
for cell in row.cells:
|
|
249
|
-
if hasattr(cell, "text_frame") and cell.text_frame:
|
|
250
|
-
cell_paragraphs = cell.text_frame.paragraphs # type: ignore
|
|
251
|
-
cell_text = " ".join([p.text.strip() for p in cell_paragraphs if p.text.strip()])
|
|
252
|
-
if cell_text:
|
|
253
|
-
row_texts.append(cell_text)
|
|
254
|
-
if row_texts:
|
|
255
|
-
slide_text.append(" | ".join(row_texts))
|
|
256
|
-
except AttributeError:
|
|
257
|
-
pass
|
|
258
|
-
|
|
259
|
-
# 提取幻灯片备注
|
|
260
|
-
try:
|
|
261
|
-
if hasattr(slide, "has_notes_slide") and slide.has_notes_slide:
|
|
262
|
-
notes_slide = slide.notes_slide
|
|
263
|
-
if notes_slide and hasattr(notes_slide, "notes_text_frame") and notes_slide.notes_text_frame:
|
|
264
|
-
notes_text = notes_slide.notes_text_frame.text.strip() # type: ignore
|
|
265
|
-
if notes_text:
|
|
266
|
-
slide_text.append(f"备注: {notes_text}")
|
|
267
|
-
except AttributeError:
|
|
268
|
-
pass
|
|
269
|
-
|
|
270
|
-
# 合并当前幻灯片的所有文本
|
|
271
|
-
if len(slide_text) > 1: # 如果除了幻灯片编号外还有其他内容
|
|
272
|
-
all_text.append("\n".join(slide_text))
|
|
273
|
-
|
|
274
|
-
# 返回所有幻灯片的文本内容
|
|
275
|
-
return "\n\n".join(all_text)
|
|
276
|
-
|
|
277
|
-
class ExcelProcessor(FileProcessor):
|
|
278
|
-
"""Excel file processor"""
|
|
279
|
-
@staticmethod
|
|
280
|
-
def can_handle(file_path: str) -> bool:
|
|
281
|
-
return Path(file_path).suffix.lower() in ['.xls', '.xlsx']
|
|
282
|
-
|
|
283
|
-
@staticmethod
|
|
284
|
-
def extract_text(file_path: str) -> str:
|
|
285
|
-
"""提取 Excel 文件中的所有文本内容,包括多个工作表及格式化内容"""
|
|
286
|
-
try:
|
|
287
|
-
# 读取所有工作表
|
|
288
|
-
excel_file = pd.ExcelFile(file_path)
|
|
289
|
-
sheets_text = []
|
|
290
|
-
|
|
291
|
-
# 处理每个工作表
|
|
292
|
-
for sheet_name in excel_file.sheet_names:
|
|
293
|
-
# 读取当前工作表
|
|
294
|
-
df = pd.read_excel(file_path, sheet_name=sheet_name)
|
|
295
|
-
|
|
296
|
-
# 如果是空表格,跳过
|
|
297
|
-
if df.empty:
|
|
298
|
-
continue
|
|
299
|
-
|
|
300
|
-
# 添加工作表标题
|
|
301
|
-
sheet_text = [f"=== 工作表: {sheet_name} ==="]
|
|
302
|
-
|
|
303
|
-
# 填充空单元格,避免NaN显示
|
|
304
|
-
df = df.fillna("")
|
|
305
|
-
|
|
306
|
-
# 提取表格头信息
|
|
307
|
-
if not df.columns.empty:
|
|
308
|
-
headers = [str(col) for col in df.columns]
|
|
309
|
-
sheet_text.append("列标题: " + " | ".join(headers))
|
|
310
|
-
|
|
311
|
-
# 尝试提取表格中可能的关键信息
|
|
312
|
-
# 1. 表格内容概述
|
|
313
|
-
row_count, col_count = df.shape
|
|
314
|
-
sheet_text.append(f"表格大小: {row_count}行 x {col_count}列")
|
|
315
|
-
|
|
316
|
-
# 2. 表格数据,使用更友好的格式
|
|
317
|
-
try:
|
|
318
|
-
# 转换数据框为字符串表示
|
|
319
|
-
# 设置最大行数和列数,避免过大的表格
|
|
320
|
-
max_rows = min(500, row_count) # 最多显示500行
|
|
321
|
-
if row_count > max_rows:
|
|
322
|
-
sheet_text.append(f"注意: 表格太大,仅显示前{max_rows}行")
|
|
323
|
-
|
|
324
|
-
# 将DataFrame转换为字符串表格
|
|
325
|
-
table_str = df.head(max_rows).to_string(index=True, max_rows=max_rows, max_cols=None)
|
|
326
|
-
sheet_text.append(table_str)
|
|
327
|
-
|
|
328
|
-
except Exception as e:
|
|
329
|
-
sheet_text.append(f"表格数据提取错误: {str(e)}")
|
|
330
|
-
|
|
331
|
-
# 合并当前工作表的文本
|
|
332
|
-
sheets_text.append("\n".join(sheet_text))
|
|
333
|
-
|
|
334
|
-
# 如果没有提取到任何内容,返回一个提示信息
|
|
335
|
-
if not sheets_text:
|
|
336
|
-
return "Excel文件为空或无法提取内容"
|
|
337
|
-
|
|
338
|
-
# 合并所有工作表的文本
|
|
339
|
-
return "\n\n".join(sheets_text)
|
|
340
|
-
|
|
341
|
-
except Exception as e:
|
|
342
|
-
# 处理可能的异常,返回错误信息
|
|
343
|
-
return f"Excel文件处理错误: {str(e)}"
|
jarvis/jarvis_utils/input.py
CHANGED
|
@@ -158,8 +158,14 @@ def get_multiline_input(tip: str) -> str:
|
|
|
158
158
|
'prompt': 'ansicyan',
|
|
159
159
|
})
|
|
160
160
|
try:
|
|
161
|
+
from prompt_toolkit.history import FileHistory
|
|
162
|
+
from jarvis.jarvis_utils.config import get_data_dir
|
|
163
|
+
import os
|
|
164
|
+
# 获取数据目录路径
|
|
165
|
+
history_dir = get_data_dir()
|
|
166
|
+
# 初始化带历史记录的会话
|
|
161
167
|
session = PromptSession(
|
|
162
|
-
history=
|
|
168
|
+
history=FileHistory(os.path.join(history_dir, 'multiline_input_history')),
|
|
163
169
|
completer=FileCompleter(),
|
|
164
170
|
key_bindings=bindings,
|
|
165
171
|
complete_while_typing=True,
|
|
@@ -11,7 +11,7 @@ import json
|
|
|
11
11
|
import tempfile
|
|
12
12
|
from typing import Dict, Optional
|
|
13
13
|
|
|
14
|
-
from jarvis.jarvis_utils.config import INPUT_WINDOW_REVERSE_SIZE, get_max_input_token_count
|
|
14
|
+
from jarvis.jarvis_utils.config import INPUT_WINDOW_REVERSE_SIZE, get_max_input_token_count, get_data_dir
|
|
15
15
|
from jarvis.jarvis_utils.embedding import get_context_token_count
|
|
16
16
|
from jarvis.jarvis_utils.output import PrettyOutput, OutputType
|
|
17
17
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
@@ -23,7 +23,7 @@ def _get_methodology_directory() -> str:
|
|
|
23
23
|
返回:
|
|
24
24
|
str: 方法论目录的路径
|
|
25
25
|
"""
|
|
26
|
-
methodology_dir = os.path.
|
|
26
|
+
methodology_dir = os.path.join(get_data_dir(), "methodologies")
|
|
27
27
|
if not os.path.exists(methodology_dir):
|
|
28
28
|
try:
|
|
29
29
|
os.makedirs(methodology_dir, exist_ok=True)
|
|
@@ -144,10 +144,10 @@ def load_methodology(user_input: str) -> str:
|
|
|
144
144
|
prompt = f"""根据用户需求: {user_input}
|
|
145
145
|
|
|
146
146
|
请按以下格式回复:
|
|
147
|
-
###
|
|
147
|
+
### 与该任务/需求相关的方法论
|
|
148
148
|
1. [方法论名字]
|
|
149
149
|
2. [方法论名字]
|
|
150
|
-
###
|
|
150
|
+
### 根据以上方法论,总结出方法论内容
|
|
151
151
|
[总结的方法论内容]
|
|
152
152
|
|
|
153
153
|
如果没有匹配的方法论,请输出:没有历史方法论可参考
|
jarvis/jarvis_utils/utils.py
CHANGED
|
@@ -3,22 +3,22 @@ import time
|
|
|
3
3
|
import hashlib
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import List, Any, Callable
|
|
6
|
-
from jarvis.jarvis_utils.config import get_max_input_token_count
|
|
6
|
+
from jarvis.jarvis_utils.config import get_max_input_token_count, get_data_dir
|
|
7
7
|
from jarvis.jarvis_utils.embedding import get_context_token_count
|
|
8
8
|
from jarvis.jarvis_utils.input import get_single_line_input
|
|
9
9
|
from jarvis.jarvis_utils.output import PrettyOutput, OutputType
|
|
10
10
|
def init_env() -> None:
|
|
11
|
-
"""
|
|
11
|
+
"""初始化环境变量从jarvis_data/env文件
|
|
12
12
|
|
|
13
13
|
功能:
|
|
14
|
-
1.
|
|
14
|
+
1. 创建不存在的jarvis_data目录
|
|
15
15
|
2. 加载环境变量到os.environ
|
|
16
16
|
3. 处理文件读取异常
|
|
17
17
|
"""
|
|
18
|
-
jarvis_dir = Path
|
|
18
|
+
jarvis_dir = Path(get_data_dir())
|
|
19
19
|
env_file = jarvis_dir / "env"
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# 检查jarvis_data目录是否存在
|
|
22
22
|
if not jarvis_dir.exists():
|
|
23
23
|
jarvis_dir.mkdir(parents=True)
|
|
24
24
|
if env_file.exists():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: jarvis-ai-assistant
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.151
|
|
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
|
|
@@ -42,26 +42,28 @@ Description-Content-Type: text/markdown
|
|
|
42
42
|
License-File: LICENSE
|
|
43
43
|
Requires-Dist: requests==2.32.3
|
|
44
44
|
Requires-Dist: colorama==0.4.6
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist: PyMuPDF==1.24.11
|
|
45
|
+
Requires-Dist: prompt_toolkit==3.0.50
|
|
47
46
|
Requires-Dist: yaspin==2.4.0
|
|
48
47
|
Requires-Dist: pygments==2.19.1
|
|
49
48
|
Requires-Dist: fuzzywuzzy==0.18.0
|
|
50
49
|
Requires-Dist: jedi==0.19.2
|
|
51
50
|
Requires-Dist: fastapi==0.115.12
|
|
52
51
|
Requires-Dist: uvicorn==0.33.0
|
|
53
|
-
Requires-Dist: pandas==2.0.3
|
|
54
52
|
Requires-Dist: rich==14.0.0
|
|
55
53
|
Requires-Dist: transformers==4.46.3
|
|
56
|
-
Requires-Dist: python-docx==1.1.2
|
|
57
|
-
Requires-Dist: python-pptx==1.0.2
|
|
58
54
|
Requires-Dist: torch==2.4.1
|
|
59
55
|
Requires-Dist: python-Levenshtein==0.25.1
|
|
56
|
+
Requires-Dist: sseclient==0.0.27
|
|
57
|
+
Requires-Dist: pillow==10.2.1
|
|
60
58
|
Provides-Extra: dev
|
|
61
59
|
Requires-Dist: pytest; extra == "dev"
|
|
62
60
|
Requires-Dist: black; extra == "dev"
|
|
63
61
|
Requires-Dist: isort; extra == "dev"
|
|
64
62
|
Requires-Dist: mypy; extra == "dev"
|
|
63
|
+
Dynamic: author
|
|
64
|
+
Dynamic: home-page
|
|
65
|
+
Dynamic: license-file
|
|
66
|
+
Dynamic: requires-python
|
|
65
67
|
|
|
66
68
|
# 🤖 Jarvis AI 助手
|
|
67
69
|
<p align="center">
|
|
@@ -191,13 +193,12 @@ jarvis-methodology --help
|
|
|
191
193
|
|------|----------|--------|------|
|
|
192
194
|
| 核心配置 | `JARVIS_MAX_TOKEN_COUNT` | 102400000 | 上下文窗口的最大token数量 |
|
|
193
195
|
| 核心配置 | `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 |
|
|
194
|
-
| 核心配置 | `
|
|
195
|
-
| 核心配置 | `JARVIS_AUTO_COMPLETE` | false | 是否启用自动补全功能
|
|
196
|
+
| 核心配置 | `JARVIS_AUTO_COMPLETE` | false | 是否启用自动完成功能(任务判定完成的时候会自动终止) |
|
|
196
197
|
| 核心配置 | `JARVIS_SHELL_NAME` | bash | 系统shell名称 |
|
|
197
198
|
| 核心配置 | `JARVIS_PLATFORM` | yuanbao | 默认AI平台 |
|
|
198
199
|
| 核心配置 | `JARVIS_MODEL` | deep_seek_v3 | 默认模型 |
|
|
199
|
-
| 核心配置 | `JARVIS_THINKING_PLATFORM` | JARVIS_PLATFORM |
|
|
200
|
-
| 核心配置 | `JARVIS_THINKING_MODEL` | JARVIS_MODEL |
|
|
200
|
+
| 核心配置 | `JARVIS_THINKING_PLATFORM` | JARVIS_PLATFORM | 推理任务使用的平台 |
|
|
201
|
+
| 核心配置 | `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 |
|
|
201
202
|
| 核心配置 | `JARVIS_EXECUTE_TOOL_CONFIRM` | false | 执行工具前是否需要确认 |
|
|
202
203
|
| 核心配置 | `JARVIS_CONFIRM_BEFORE_APPLY_PATCH` | true | 应用补丁前是否需要确认 |
|
|
203
204
|
| 核心配置 | `JARVIS_MAX_TOOL_CALL_COUNT` | 20 | 最大连续工具调用次数 |
|
|
@@ -212,17 +213,17 @@ jarvis-methodology --help
|
|
|
212
213
|
| ask_user | 交互式用户输入收集 |
|
|
213
214
|
| chdir | 更改当前工作目录 |
|
|
214
215
|
| code_plan | 理解需求并制定详细的代码修改计划,在修改前获取用户确认 |
|
|
215
|
-
| create_code_agent |
|
|
216
|
+
| create_code_agent | 代码开发工具,当需要修改代码时使用 |
|
|
216
217
|
| create_sub_agent | 创建子代理以处理特定任务,子代理将生成任务总结报告 |
|
|
217
218
|
| execute_script | 执行脚本并返回结果,支持任意解释器。 |
|
|
218
219
|
| file_analyzer | 分析文件内容并提取关键信息。支持的文件:文本文件、word文档、pdf文件、图片 |
|
|
219
|
-
| file_operation |
|
|
220
|
+
| file_operation | 文件批量操作工具,可批量读写多个文件,支持文本文件,适用于需要同时处理多个文件的场景(读取配置文件、保存生成内容等) |
|
|
220
221
|
| find_methodology | 方法论查找工具,用于在执行过程中查看历史方法论辅助决策 |
|
|
221
222
|
| lsp_get_diagnostics | 获取代码诊断信息(错误、警告) |
|
|
222
|
-
| methodology |
|
|
223
|
+
| methodology | 方法论管理工具,支持添加、更新和删除操作 |
|
|
223
224
|
| read_code | 代码阅读与分析工具,用于读取源代码文件并添加行号,针对代码文件优化,提供更好的格式化输出和行号显示,适用于代码分析、审查和理解代码实现的场景 |
|
|
224
|
-
| read_webpage |
|
|
225
|
-
| search_web |
|
|
225
|
+
| read_webpage | 读取网页内容并分析 |
|
|
226
|
+
| search_web | 使用互联网搜索 |
|
|
226
227
|
| virtual_tty | 控制虚拟终端执行各种操作,如启动终端、输入命令、获取输出等。 |
|
|
227
228
|
|
|
228
229
|
|
|
@@ -232,7 +233,7 @@ jarvis-methodology --help
|
|
|
232
233
|
---
|
|
233
234
|
## 🛠️ 扩展开发 <a id="extensions"></a>
|
|
234
235
|
### 添加新工具
|
|
235
|
-
在 `~/.jarvis/tools
|
|
236
|
+
在 `~/.jarvis/tools/` 中创建新的 Python 文件:
|
|
236
237
|
```python
|
|
237
238
|
from typing import Dict, Any
|
|
238
239
|
from jarvis.utils import OutputType, PrettyOutput
|
|
@@ -280,8 +281,32 @@ class CustomTool:
|
|
|
280
281
|
```
|
|
281
282
|
|
|
282
283
|
|
|
284
|
+
### 添加MCP
|
|
285
|
+
MCP(模型上下文协议)。在`~/.jarvis/tools/mcp/`中创建YAML配置文件:
|
|
286
|
+
|
|
287
|
+
#### 本地MCP配置(`stdio`模式)
|
|
288
|
+
```yaml
|
|
289
|
+
type: local
|
|
290
|
+
name: MCP名称
|
|
291
|
+
command: 可执行命令
|
|
292
|
+
args: [参数列表] # 可选
|
|
293
|
+
env: # 可选环境变量
|
|
294
|
+
KEY: VALUE
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### 远程MCP配置(`sse`模式)
|
|
298
|
+
```yaml
|
|
299
|
+
type: remote
|
|
300
|
+
name: MCP名称
|
|
301
|
+
base_url: http://example.com/api
|
|
302
|
+
auth_token: 认证令牌 # 可选
|
|
303
|
+
headers: # 可选HTTP头
|
|
304
|
+
X-Custom-Header: value
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
|
|
283
308
|
### 添加新大模型平台
|
|
284
|
-
在 `~/.jarvis/platforms
|
|
309
|
+
在 `~/.jarvis/platforms/` 中创建新的 Python 文件:
|
|
285
310
|
```python
|
|
286
311
|
from jarvis.jarvis_platform.base import BasePlatform
|
|
287
312
|
class CustomPlatform(BasePlatform):
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=RgZgU-h6b2rFUONprNXY6qN0TgybOI3uDfFqF21sQzA,50
|
|
2
2
|
jarvis/jarvis_agent/__init__.py,sha256=QtWu2kh6o5IB_XtGLoxHi5K9lA1t8XoqNUXtX-OqujY,23796
|
|
3
3
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=0SjlBYnBWKNi3eVdZ7c2NuP82tQej7DEWLAqG6bY1Rc,4357
|
|
4
4
|
jarvis/jarvis_agent/file_input_handler.py,sha256=6R68cSjLBnSJjTKJrSO2IqziRDFnxazU_Jq2t1W1ndo,3695
|
|
5
|
-
jarvis/jarvis_agent/jarvis.py,sha256
|
|
5
|
+
jarvis/jarvis_agent/jarvis.py,sha256=-Q-h1M4dgElFnoA2B9H3r0LmnQdoPfiy2JPXzNNihBQ,5155
|
|
6
6
|
jarvis/jarvis_agent/main.py,sha256=Jlw_Tofh2C-sMVnkeOZBrwWJOWNH3IhsKDUn-WBlgU8,2602
|
|
7
7
|
jarvis/jarvis_agent/output_handler.py,sha256=4limQ-Kf-YYvQjT5SMjJIyyvD1DVG8tINv1A_qbv4ho,405
|
|
8
8
|
jarvis/jarvis_agent/patch.py,sha256=nhfAVHhSm4PWBMd_B9eeaUdnGDpryWTrGiJ7rMqvJ5g,22504
|
|
@@ -35,27 +35,30 @@ jarvis/jarvis_git_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
35
35
|
jarvis/jarvis_git_details/main.py,sha256=YowncVxYyJ3y2EvGrZhAJeR4yizXp6aB3dqvoYTepFY,6117
|
|
36
36
|
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
37
|
jarvis/jarvis_git_squash/main.py,sha256=xBNkAl7_8_pQC-C6RcUImA1mEU4KTqhjtA57rG_mMJ8,2179
|
|
38
|
-
jarvis/jarvis_git_utils/git_commiter.py,sha256=
|
|
38
|
+
jarvis/jarvis_git_utils/git_commiter.py,sha256=pnUiX-KkAMLDBRMXot93T9zTdoYsIJpqVMozMwQo6R0,11096
|
|
39
39
|
jarvis/jarvis_lsp/base.py,sha256=f-76xgNijfQ4G3Q0t8IfOGtCu-q2TSQ7a_in6XwDb_8,2030
|
|
40
40
|
jarvis/jarvis_lsp/cpp.py,sha256=ekci2M9_UtkCSEe9__72h26Gat93r9_knL2VmFr8X5M,3141
|
|
41
41
|
jarvis/jarvis_lsp/go.py,sha256=sSypuQSP5X2YtrVMC8XCc5nXkgfG93SO7sC89lHzoR8,3458
|
|
42
42
|
jarvis/jarvis_lsp/python.py,sha256=OJuYHLHI1aYNNWcAFayy_5GxogwyMC3A7KOYGjxN1yg,1843
|
|
43
|
-
jarvis/jarvis_lsp/registry.py,sha256
|
|
43
|
+
jarvis/jarvis_lsp/registry.py,sha256=-b7lAfZ6SNp3O0ifRiFSLxH0xJlPQhkq4DATDDjJb1U,6491
|
|
44
44
|
jarvis/jarvis_lsp/rust.py,sha256=ICmQs5UVdMZwn5KjaF1YRXBCLUMtGF8Z9IwE5rqWkrU,3686
|
|
45
|
+
jarvis/jarvis_mcp/__init__.py,sha256=gi74_Yz5nsEFhrAyCg1Ovxsj-hLweLjMGoOaceL2yx4,2090
|
|
46
|
+
jarvis/jarvis_mcp/local_mcp_client.py,sha256=JKmGJG0sOJxs4Sk-k4SfZq01RiZCGY6oYslvcK7lxJg,11790
|
|
47
|
+
jarvis/jarvis_mcp/remote_mcp_client.py,sha256=J9Y2-9VBQb0uJKglev-U3AQg1AfLDmghRbCvNDPSzdI,23478
|
|
45
48
|
jarvis/jarvis_methodology/main.py,sha256=IBv87UOmdCailgooMtWEcqZcQHmNLhZD-kkGw5jOcVg,3375
|
|
46
49
|
jarvis/jarvis_multi_agent/__init__.py,sha256=SX8lBErhltKyYRM-rymrMz3sJ0Zl3hBXrpsPdFgzkQc,4399
|
|
47
50
|
jarvis/jarvis_multi_agent/main.py,sha256=aGuUC3YQmahabqwDwZXJjfQLYsZ3KIZdf8DZDlVNMe4,1543
|
|
48
51
|
jarvis/jarvis_platform/__init__.py,sha256=WIJtD5J7lOrWLX2bsgZGkmlMcN0NOJsnh_reybmHPjg,58
|
|
49
52
|
jarvis/jarvis_platform/base.py,sha256=bihlnM5PowzKhi3dbxUp_eHOA14MLrHAbs_DXLe0s0g,3228
|
|
50
|
-
jarvis/jarvis_platform/kimi.py,sha256=
|
|
51
|
-
jarvis/jarvis_platform/registry.py,sha256=
|
|
52
|
-
jarvis/jarvis_platform/yuanbao.py,sha256=
|
|
53
|
+
jarvis/jarvis_platform/kimi.py,sha256=Bfm4SLELVkVQBoGqapokX41m5VojyHvQ6LRLIDhg_z4,16519
|
|
54
|
+
jarvis/jarvis_platform/registry.py,sha256=wvXTKXqAoW6GPaLKCPYhRB9QhVe1xfoVbVPBZAxl_uA,7716
|
|
55
|
+
jarvis/jarvis_platform/yuanbao.py,sha256=X2lYZ3SxBzdaCwd5ooq9fxYbu14RUpeDILYg0W5W7Xc,21902
|
|
53
56
|
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
57
|
jarvis/jarvis_platform_manager/main.py,sha256=o7UDrcCkLf9dTh2LOO-_bQVHjWf2X6RuSY5XRtCGvZs,20245
|
|
55
58
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
59
|
jarvis/jarvis_smart_shell/main.py,sha256=slP_8CwpfMjWFZis0At1ANRlPb3gx1KteAg1B7R7dl4,4546
|
|
57
60
|
jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
|
-
jarvis/jarvis_tools/ask_codebase.py,sha256=
|
|
61
|
+
jarvis/jarvis_tools/ask_codebase.py,sha256=S6NArvKZyK8WEbsEgeGCljjg4D9mteWrq9m352V58jU,9635
|
|
59
62
|
jarvis/jarvis_tools/ask_user.py,sha256=NjxTCHGKo4nthbEQD-isvPCW4PQhTcekEferjnukX70,2143
|
|
60
63
|
jarvis/jarvis_tools/base.py,sha256=vskI4czVdlhbo38ODuF9rFrnWBYQIhJSPAqAkLVcyTs,1165
|
|
61
64
|
jarvis/jarvis_tools/chdir.py,sha256=do_OdtabiH3lZcT_ynjSAX66XgH2gPl9mYiS7dMMDa8,2682
|
|
@@ -64,28 +67,28 @@ jarvis/jarvis_tools/create_code_agent.py,sha256=Vl76eqERuxJWKmVR3eUSKE7ZqlG9pVhz
|
|
|
64
67
|
jarvis/jarvis_tools/create_sub_agent.py,sha256=wGiHukvi58wb1AKW5beP7R8VvApOn8TOeGmtXsmcETE,3001
|
|
65
68
|
jarvis/jarvis_tools/execute_script.py,sha256=3sR_u6-SLbzmcUbXjHLN-rGjoelIj4uAefys5la_x7o,6759
|
|
66
69
|
jarvis/jarvis_tools/file_analyzer.py,sha256=XCsFB4dZ9qy2q929hqi1rTngj6AtRtIaPx_W7lJAcpQ,4814
|
|
67
|
-
jarvis/jarvis_tools/file_operation.py,sha256=
|
|
70
|
+
jarvis/jarvis_tools/file_operation.py,sha256=sB1x0zI1dULXV7FG17wkiMQ7mQAEnXVd_5rakQ0Thik,9109
|
|
68
71
|
jarvis/jarvis_tools/find_methodology.py,sha256=FnvjWt4Za2P9B_oDPSOqkotuaQFbgjM9WCPkB_OJRzQ,2225
|
|
69
72
|
jarvis/jarvis_tools/lsp_get_diagnostics.py,sha256=IYqv8jQwSK71sZpDBRolSDnYii8t0M7fzLthhMYTeGk,5322
|
|
70
|
-
jarvis/jarvis_tools/methodology.py,sha256=
|
|
73
|
+
jarvis/jarvis_tools/methodology.py,sha256=gnlJojY4Dg5v9AAB5xcpKqpPIHs0tOYVtzTHkwOrWk0,5214
|
|
71
74
|
jarvis/jarvis_tools/read_code.py,sha256=_X6D3AIgRD9YplSDnFhXOm8wQAZMA3pkkXy31SG33l0,6041
|
|
72
75
|
jarvis/jarvis_tools/read_webpage.py,sha256=syduSZK4kXRRTPzeZ2W9Q6YH5umKiMJZyjA0cCpSF4g,2198
|
|
73
|
-
jarvis/jarvis_tools/registry.py,sha256=
|
|
76
|
+
jarvis/jarvis_tools/registry.py,sha256=ELlX1ZqCSDQc5D9RwI5xVXgBgN0IeIjWG_lD6P9T5o0,24100
|
|
74
77
|
jarvis/jarvis_tools/search_web.py,sha256=kWW9K2QUR2AxPq6gcyx4Bgy-0Y4gzcdErq1DNT1EYM4,1333
|
|
75
78
|
jarvis/jarvis_tools/virtual_tty.py,sha256=Rpn9VXUG17LQsY87F_O6UCjN_opXB05mpwozxYf-xVI,16372
|
|
76
79
|
jarvis/jarvis_utils/__init__.py,sha256=KMg-KY5rZIhGTeOD5e2Xo5CU7DX1DUz4ULWAaTQ-ZNw,825
|
|
77
|
-
jarvis/jarvis_utils/config.py,sha256=
|
|
78
|
-
jarvis/jarvis_utils/embedding.py,sha256=
|
|
79
|
-
jarvis/jarvis_utils/file_processors.py,sha256=
|
|
80
|
+
jarvis/jarvis_utils/config.py,sha256=UXIwt1TknkYIuNW15TNiyZ1HJFdjjAzmt_D7_cd6xxQ,3317
|
|
81
|
+
jarvis/jarvis_utils/embedding.py,sha256=_Q-VurYHQZSsyISClTFjadDaNqNPBMqJe58lMM6bsVs,6991
|
|
82
|
+
jarvis/jarvis_utils/file_processors.py,sha256=oNtVlz2JHcQ60NS6sgI-VsvYXOnsQgFUEVenznCXHC4,2952
|
|
80
83
|
jarvis/jarvis_utils/git_utils.py,sha256=j_Jw6h7JD91XhMf0WD3MAH4URkLUBrrYCLnuLm1GeN4,5630
|
|
81
84
|
jarvis/jarvis_utils/globals.py,sha256=Ed2d6diWXCgI74HVV_tI4qW7yXxLpNvQKN2yG0IH9hc,3388
|
|
82
|
-
jarvis/jarvis_utils/input.py,sha256=
|
|
83
|
-
jarvis/jarvis_utils/methodology.py,sha256=
|
|
85
|
+
jarvis/jarvis_utils/input.py,sha256=QhqZEF4BpOGDgNEBrTBabA5n8DnlU0GaHqbKUEZ13Ls,6953
|
|
86
|
+
jarvis/jarvis_utils/methodology.py,sha256=E_FQOSLA9o8bKfmgORNMlkDtqPiqlCkQoIkPuxPQol4,6324
|
|
84
87
|
jarvis/jarvis_utils/output.py,sha256=BmWdB1bmizv0xfU4Z___9p_xQodorriIcEgADVq9fk0,8416
|
|
85
|
-
jarvis/jarvis_utils/utils.py,sha256=
|
|
86
|
-
jarvis_ai_assistant-0.1.
|
|
87
|
-
jarvis_ai_assistant-0.1.
|
|
88
|
-
jarvis_ai_assistant-0.1.
|
|
89
|
-
jarvis_ai_assistant-0.1.
|
|
90
|
-
jarvis_ai_assistant-0.1.
|
|
91
|
-
jarvis_ai_assistant-0.1.
|
|
88
|
+
jarvis/jarvis_utils/utils.py,sha256=j-YZap58avAzSb9ZuB2I71trVqVxIpFxxZDoh8_7a_o,4653
|
|
89
|
+
jarvis_ai_assistant-0.1.151.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
90
|
+
jarvis_ai_assistant-0.1.151.dist-info/METADATA,sha256=_QXsf2ezynGKHG9ZD-_qbOYk6mD0hQPwrW5bMrrPjHI,11562
|
|
91
|
+
jarvis_ai_assistant-0.1.151.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
92
|
+
jarvis_ai_assistant-0.1.151.dist-info/entry_points.txt,sha256=4ZS8kq6jahnmfDyXFSx39HRi-Tkbp0uFc6cTXt3QIHA,929
|
|
93
|
+
jarvis_ai_assistant-0.1.151.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
94
|
+
jarvis_ai_assistant-0.1.151.dist-info/RECORD,,
|
{jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info/licenses}/LICENSE
RENAMED
|
File without changes
|
{jarvis_ai_assistant-0.1.149.dist-info → jarvis_ai_assistant-0.1.151.dist-info}/top_level.txt
RENAMED
|
File without changes
|