jarvis-ai-assistant 0.2.2__py3-none-any.whl → 0.2.4__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 +1 -1
- jarvis/jarvis_agent/edit_file_handler.py +5 -0
- jarvis/jarvis_agent/jarvis.py +22 -25
- jarvis/jarvis_agent/main.py +6 -6
- jarvis/jarvis_agent/prompts.py +26 -4
- jarvis/jarvis_code_agent/code_agent.py +279 -11
- jarvis/jarvis_code_analysis/code_review.py +21 -19
- jarvis/jarvis_data/config_schema.json +86 -18
- jarvis/jarvis_git_squash/main.py +3 -3
- jarvis/jarvis_git_utils/git_commiter.py +32 -11
- jarvis/jarvis_mcp/sse_mcp_client.py +4 -6
- jarvis/jarvis_mcp/streamable_mcp_client.py +5 -9
- jarvis/jarvis_platform/tongyi.py +9 -9
- jarvis/jarvis_rag/cli.py +79 -23
- jarvis/jarvis_rag/query_rewriter.py +61 -12
- jarvis/jarvis_rag/rag_pipeline.py +143 -34
- jarvis/jarvis_rag/retriever.py +6 -6
- jarvis/jarvis_smart_shell/main.py +2 -2
- jarvis/jarvis_stats/__init__.py +13 -0
- jarvis/jarvis_stats/cli.py +337 -0
- jarvis/jarvis_stats/stats.py +433 -0
- jarvis/jarvis_stats/storage.py +329 -0
- jarvis/jarvis_stats/visualizer.py +443 -0
- jarvis/jarvis_tools/cli/main.py +84 -15
- jarvis/jarvis_tools/generate_new_tool.py +22 -1
- jarvis/jarvis_tools/registry.py +35 -16
- jarvis/jarvis_tools/search_web.py +3 -3
- jarvis/jarvis_tools/virtual_tty.py +315 -26
- jarvis/jarvis_utils/config.py +98 -11
- jarvis/jarvis_utils/git_utils.py +8 -16
- jarvis/jarvis_utils/globals.py +29 -8
- jarvis/jarvis_utils/input.py +114 -121
- jarvis/jarvis_utils/utils.py +213 -37
- {jarvis_ai_assistant-0.2.2.dist-info → jarvis_ai_assistant-0.2.4.dist-info}/METADATA +99 -9
- {jarvis_ai_assistant-0.2.2.dist-info → jarvis_ai_assistant-0.2.4.dist-info}/RECORD +39 -34
- {jarvis_ai_assistant-0.2.2.dist-info → jarvis_ai_assistant-0.2.4.dist-info}/entry_points.txt +2 -0
- {jarvis_ai_assistant-0.2.2.dist-info → jarvis_ai_assistant-0.2.4.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.2.2.dist-info → jarvis_ai_assistant-0.2.4.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.2.2.dist-info → jarvis_ai_assistant-0.2.4.dist-info}/top_level.txt +0 -0
@@ -17,7 +17,7 @@ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
17
17
|
from jarvis.jarvis_utils.tag import ct, ot
|
18
18
|
from jarvis.jarvis_utils.utils import init_env, is_context_overflow
|
19
19
|
|
20
|
-
app = typer.Typer(help="
|
20
|
+
app = typer.Typer(help="自动代码审查工具")
|
21
21
|
|
22
22
|
|
23
23
|
class CodeReviewTool:
|
@@ -300,7 +300,7 @@ class CodeReviewTool:
|
|
300
300
|
|
301
301
|
# Execute git command and get diff output
|
302
302
|
diff_output = subprocess.check_output(
|
303
|
-
diff_cmd, shell=True, text=True
|
303
|
+
diff_cmd, shell=True, text=True, encoding="utf-8", errors="replace"
|
304
304
|
)
|
305
305
|
if not diff_output:
|
306
306
|
return {
|
@@ -310,11 +310,13 @@ class CodeReviewTool:
|
|
310
310
|
}
|
311
311
|
|
312
312
|
# Extract changed files using git command
|
313
|
-
|
313
|
+
# Use git show with proper formatting to avoid needing grep
|
314
|
+
files_cmd = f"git show --name-only --pretty=format: {commit_sha}"
|
314
315
|
try:
|
315
316
|
files_output = subprocess.check_output(
|
316
317
|
files_cmd, shell=True, text=True
|
317
318
|
)
|
319
|
+
# Filter out empty lines without using grep
|
318
320
|
file_paths = [
|
319
321
|
f.strip() for f in files_output.split("\n") if f.strip()
|
320
322
|
]
|
@@ -337,7 +339,7 @@ class CodeReviewTool:
|
|
337
339
|
|
338
340
|
# Execute git command and get diff output
|
339
341
|
diff_output = subprocess.check_output(
|
340
|
-
diff_cmd, shell=True, text=True
|
342
|
+
diff_cmd, shell=True, text=True, encoding="utf-8", errors="replace"
|
341
343
|
)
|
342
344
|
if not diff_output:
|
343
345
|
return {
|
@@ -379,7 +381,7 @@ class CodeReviewTool:
|
|
379
381
|
|
380
382
|
# Execute git command and get diff output
|
381
383
|
diff_output = subprocess.check_output(
|
382
|
-
diff_cmd, shell=True, text=True
|
384
|
+
diff_cmd, shell=True, text=True, encoding="utf-8", errors="replace"
|
383
385
|
)
|
384
386
|
if not diff_output:
|
385
387
|
return {
|
@@ -578,7 +580,7 @@ class CodeReviewTool:
|
|
578
580
|
|
579
581
|
tool_registry = ToolRegistry()
|
580
582
|
tool_registry.dont_use_tools(["code_review"])
|
581
|
-
|
583
|
+
|
582
584
|
# Use the provided agent's model_group or get it from globals
|
583
585
|
calling_agent = agent or get_agent(current_agent_name)
|
584
586
|
model_group = None
|
@@ -653,7 +655,7 @@ class CodeReviewTool:
|
|
653
655
|
{ot("REPORT")}
|
654
656
|
[在此处插入完整MARKDOWN格式的审查报告]
|
655
657
|
{ct("REPORT")}""",
|
656
|
-
output_handler=[tool_registry],
|
658
|
+
output_handler=[tool_registry], # type: ignore
|
657
659
|
llm_type="thinking",
|
658
660
|
auto_complete=False,
|
659
661
|
)
|
@@ -769,10 +771,10 @@ def extract_code_report(result: str) -> str:
|
|
769
771
|
|
770
772
|
@app.command("commit")
|
771
773
|
def review_commit(
|
772
|
-
commit: str = typer.Argument(..., help="
|
773
|
-
root_dir: str = typer.Option(".", "--root-dir", help="
|
774
|
+
commit: str = typer.Argument(..., help="要审查的提交SHA"),
|
775
|
+
root_dir: str = typer.Option(".", "--root-dir", help="代码库根目录路径"),
|
774
776
|
):
|
775
|
-
"""
|
777
|
+
"""审查指定的提交"""
|
776
778
|
tool = CodeReviewTool()
|
777
779
|
tool_args = {"review_type": "commit", "commit_sha": commit, "root_dir": root_dir}
|
778
780
|
result = tool.execute(tool_args)
|
@@ -786,9 +788,9 @@ def review_commit(
|
|
786
788
|
|
787
789
|
@app.command("current")
|
788
790
|
def review_current(
|
789
|
-
root_dir: str = typer.Option(".", "--root-dir", help="
|
791
|
+
root_dir: str = typer.Option(".", "--root-dir", help="代码库根目录路径"),
|
790
792
|
):
|
791
|
-
"""
|
793
|
+
"""审查当前的变更"""
|
792
794
|
tool = CodeReviewTool()
|
793
795
|
tool_args = {"review_type": "current", "root_dir": root_dir}
|
794
796
|
result = tool.execute(tool_args)
|
@@ -802,11 +804,11 @@ def review_current(
|
|
802
804
|
|
803
805
|
@app.command("range")
|
804
806
|
def review_range(
|
805
|
-
start_commit: str = typer.Argument(..., help="
|
806
|
-
end_commit: str = typer.Argument(..., help="
|
807
|
-
root_dir: str = typer.Option(".", "--root-dir", help="
|
807
|
+
start_commit: str = typer.Argument(..., help="起始提交SHA"),
|
808
|
+
end_commit: str = typer.Argument(..., help="结束提交SHA"),
|
809
|
+
root_dir: str = typer.Option(".", "--root-dir", help="代码库根目录路径"),
|
808
810
|
):
|
809
|
-
"""
|
811
|
+
"""审查提交范围"""
|
810
812
|
tool = CodeReviewTool()
|
811
813
|
tool_args = {
|
812
814
|
"review_type": "range",
|
@@ -825,10 +827,10 @@ def review_range(
|
|
825
827
|
|
826
828
|
@app.command("file")
|
827
829
|
def review_file(
|
828
|
-
file: str = typer.Argument(..., help="
|
829
|
-
root_dir: str = typer.Option(".", "--root-dir", help="
|
830
|
+
file: str = typer.Argument(..., help="要审查的文件路径"),
|
831
|
+
root_dir: str = typer.Option(".", "--root-dir", help="代码库根目录路径"),
|
830
832
|
):
|
831
|
-
"""
|
833
|
+
"""审查指定的文件"""
|
832
834
|
tool = CodeReviewTool()
|
833
835
|
tool_args = {"review_type": "file", "file_path": file, "root_dir": root_dir}
|
834
836
|
result = tool.execute(tool_args)
|
@@ -139,40 +139,49 @@
|
|
139
139
|
"JARVIS_THINKING_MODEL": {
|
140
140
|
"type": "string",
|
141
141
|
"description": "思考操作模型名称",
|
142
|
-
"default": "
|
142
|
+
"default": "deep_seek_v3"
|
143
143
|
},
|
144
|
-
"
|
144
|
+
"JARVIS_LLM_GROUP": {
|
145
145
|
"type": "string",
|
146
|
-
"description": "选择一个预定义的模型组"
|
146
|
+
"description": "选择一个预定义的模型组",
|
147
|
+
"default": ""
|
147
148
|
},
|
148
|
-
"
|
149
|
+
"JARVIS_LLM_GROUPS": {
|
149
150
|
"type": "array",
|
150
151
|
"description": "预定义的模型配置组",
|
152
|
+
"default": [],
|
151
153
|
"items": {
|
152
154
|
"type": "object",
|
153
155
|
"additionalProperties": {
|
154
156
|
"type": "object",
|
155
157
|
"properties": {
|
156
158
|
"JARVIS_PLATFORM": {
|
157
|
-
"type": "string"
|
159
|
+
"type": "string",
|
160
|
+
"default": "yuanbao"
|
158
161
|
},
|
159
162
|
"JARVIS_MODEL": {
|
160
|
-
"type": "string"
|
163
|
+
"type": "string",
|
164
|
+
"default": "deep_seek_v3"
|
161
165
|
},
|
162
166
|
"JARVIS_THINKING_PLATFORM": {
|
163
|
-
"type": "string"
|
167
|
+
"type": "string",
|
168
|
+
"default": "yuanbao"
|
164
169
|
},
|
165
170
|
"JARVIS_THINKING_MODEL": {
|
166
|
-
"type": "string"
|
171
|
+
"type": "string",
|
172
|
+
"default": "deep_seek_v3"
|
167
173
|
},
|
168
174
|
"JARVIS_MAX_TOKEN_COUNT": {
|
169
|
-
"type": "number"
|
175
|
+
"type": "number",
|
176
|
+
"default": 960000
|
170
177
|
},
|
171
178
|
"JARVIS_MAX_INPUT_TOKEN_COUNT": {
|
172
|
-
"type": "number"
|
179
|
+
"type": "number",
|
180
|
+
"default": 32000
|
173
181
|
},
|
174
182
|
"JARVIS_MAX_BIG_CONTENT_SIZE": {
|
175
|
-
"type": "number"
|
183
|
+
"type": "number",
|
184
|
+
"default": 160000
|
176
185
|
}
|
177
186
|
},
|
178
187
|
"required": [
|
@@ -225,6 +234,14 @@
|
|
225
234
|
},
|
226
235
|
"default": []
|
227
236
|
},
|
237
|
+
"JARVIS_METHODOLOGY_DIRS": {
|
238
|
+
"type": "array",
|
239
|
+
"description": "方法论加载目录",
|
240
|
+
"items": {
|
241
|
+
"type": "string"
|
242
|
+
},
|
243
|
+
"default": []
|
244
|
+
},
|
228
245
|
"JARVIS_PRINT_PROMPT": {
|
229
246
|
"type": "boolean",
|
230
247
|
"description": "是否打印提示",
|
@@ -235,24 +252,70 @@
|
|
235
252
|
"description": "是否启用静态代码分析",
|
236
253
|
"default": true
|
237
254
|
},
|
255
|
+
"JARVIS_RAG_GROUP": {
|
256
|
+
"type": "string",
|
257
|
+
"description": "选择一个预定义的RAG配置组",
|
258
|
+
"default": ""
|
259
|
+
},
|
260
|
+
"JARVIS_RAG_GROUPS": {
|
261
|
+
"type": "array",
|
262
|
+
"description": "预定义的RAG配置组",
|
263
|
+
"default": [],
|
264
|
+
"items": {
|
265
|
+
"type": "object",
|
266
|
+
"additionalProperties": {
|
267
|
+
"type": "object",
|
268
|
+
"properties": {
|
269
|
+
"embedding_model": {
|
270
|
+
"type": "string",
|
271
|
+
"default": "BAAI/bge-m3"
|
272
|
+
},
|
273
|
+
"rerank_model": {
|
274
|
+
"type": "string",
|
275
|
+
"default": "BAAI/bge-reranker-v2-m3"
|
276
|
+
},
|
277
|
+
"use_bm25": {
|
278
|
+
"type": "boolean",
|
279
|
+
"default": true
|
280
|
+
},
|
281
|
+
"use_rerank": {
|
282
|
+
"type": "boolean",
|
283
|
+
"default": true
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}
|
288
|
+
},
|
238
289
|
"JARVIS_RAG": {
|
239
290
|
"type": "object",
|
240
|
-
"description": "RAG
|
291
|
+
"description": "RAG框架的顶层配置。注意:此处的设置将覆盖任何由JARVIS_RAG_GROUP选择的组配置。",
|
241
292
|
"properties": {
|
242
293
|
"embedding_model": {
|
243
294
|
"type": "string",
|
244
|
-
"default": "BAAI/bge-
|
245
|
-
"description": "用于RAG的嵌入模型的名称, 默认为 'BAAI/bge-
|
295
|
+
"default": "BAAI/bge-m3",
|
296
|
+
"description": "用于RAG的嵌入模型的名称, 默认为 'BAAI/bge-m3'"
|
246
297
|
},
|
247
298
|
"rerank_model": {
|
248
299
|
"type": "string",
|
249
|
-
"default": "BAAI/bge-reranker-
|
250
|
-
"description": "用于RAG的rerank模型的名称, 默认为 'BAAI/bge-reranker-
|
300
|
+
"default": "BAAI/bge-reranker-v2-m3",
|
301
|
+
"description": "用于RAG的rerank模型的名称, 默认为 'BAAI/bge-reranker-v2-m3'"
|
302
|
+
},
|
303
|
+
"use_bm25": {
|
304
|
+
"type": "boolean",
|
305
|
+
"default": true,
|
306
|
+
"description": "是否在RAG中为检索使用BM25, 默认为 true"
|
307
|
+
},
|
308
|
+
"use_rerank": {
|
309
|
+
"type": "boolean",
|
310
|
+
"default": true,
|
311
|
+
"description": "是否在RAG中为检索使用rerank, 默认为 true"
|
251
312
|
}
|
252
313
|
},
|
253
314
|
"default": {
|
254
|
-
"embedding_model": "BAAI/bge-
|
255
|
-
"rerank_model": "BAAI/bge-reranker-
|
315
|
+
"embedding_model": "BAAI/bge-m3",
|
316
|
+
"rerank_model": "BAAI/bge-reranker-v2-m3",
|
317
|
+
"use_bm25": true,
|
318
|
+
"use_rerank": true
|
256
319
|
}
|
257
320
|
},
|
258
321
|
"JARVIS_REPLACE_MAP": {
|
@@ -306,6 +369,11 @@
|
|
306
369
|
"OYI_API_KEY": {
|
307
370
|
"type": "string",
|
308
371
|
"description": "Oyi API Key"
|
372
|
+
},
|
373
|
+
"SHELL": {
|
374
|
+
"type": "string",
|
375
|
+
"description": "系统Shell路径,用于获取当前使用的shell类型",
|
376
|
+
"default": "/bin/bash"
|
309
377
|
}
|
310
378
|
},
|
311
379
|
"additionalProperties": true
|
jarvis/jarvis_git_squash/main.py
CHANGED
@@ -9,7 +9,7 @@ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
9
9
|
from jarvis.jarvis_utils.utils import init_env
|
10
10
|
from jarvis.jarvis_utils.input import user_confirm
|
11
11
|
|
12
|
-
app = typer.Typer(help="Git
|
12
|
+
app = typer.Typer(help="Git压缩工具")
|
13
13
|
|
14
14
|
|
15
15
|
class GitSquashTool:
|
@@ -53,8 +53,8 @@ class GitSquashTool:
|
|
53
53
|
|
54
54
|
@app.command()
|
55
55
|
def cli(
|
56
|
-
commit_hash: str = typer.Argument(..., help="
|
57
|
-
lang: str = typer.Option("Chinese", "--lang", help="
|
56
|
+
commit_hash: str = typer.Argument(..., help="要压缩的基础提交哈希"),
|
57
|
+
lang: str = typer.Option("Chinese", "--lang", help="提交信息的语言"),
|
58
58
|
):
|
59
59
|
init_env("欢迎使用 Jarvis-GitSquash,您的Git压缩助手已准备就绪!")
|
60
60
|
tool = GitSquashTool()
|
@@ -21,7 +21,7 @@ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
21
21
|
from jarvis.jarvis_utils.tag import ct, ot
|
22
22
|
from jarvis.jarvis_utils.utils import init_env, is_context_overflow
|
23
23
|
|
24
|
-
app = typer.Typer(help="Git
|
24
|
+
app = typer.Typer(help="Git提交工具")
|
25
25
|
|
26
26
|
|
27
27
|
class GitCommitTool:
|
@@ -258,17 +258,38 @@ commit信息
|
|
258
258
|
|
259
259
|
# 执行提交
|
260
260
|
print("⚙️ 正在准备提交...")
|
261
|
-
|
261
|
+
# Windows 兼容性:使用 delete=False 避免权限错误
|
262
|
+
tmp_file = tempfile.NamedTemporaryFile(mode="w", delete=False)
|
263
|
+
tmp_file_path = tmp_file.name
|
264
|
+
try:
|
262
265
|
tmp_file.write(commit_message)
|
263
|
-
tmp_file.
|
266
|
+
tmp_file.close() # Windows 需要先关闭文件才能被其他进程读取
|
267
|
+
|
264
268
|
print("💾 正在执行提交...")
|
265
|
-
commit_cmd = ["git", "commit", "-F",
|
266
|
-
subprocess.Popen(
|
269
|
+
commit_cmd = ["git", "commit", "-F", tmp_file_path]
|
270
|
+
process = subprocess.Popen(
|
267
271
|
commit_cmd,
|
268
|
-
stdout=subprocess.
|
269
|
-
stderr=subprocess.
|
270
|
-
|
272
|
+
stdout=subprocess.PIPE,
|
273
|
+
stderr=subprocess.PIPE,
|
274
|
+
text=True,
|
275
|
+
)
|
276
|
+
stdout, stderr = process.communicate()
|
277
|
+
|
278
|
+
if process.returncode != 0:
|
279
|
+
# 如果提交失败,重置暂存区
|
280
|
+
subprocess.run(["git", "reset", "HEAD"], check=False)
|
281
|
+
error_msg = (
|
282
|
+
stderr.strip() if stderr else "Unknown git commit error"
|
283
|
+
)
|
284
|
+
raise Exception(f"Git commit failed: {error_msg}")
|
285
|
+
|
271
286
|
print("✅ 提交")
|
287
|
+
finally:
|
288
|
+
# 手动删除临时文件
|
289
|
+
try:
|
290
|
+
os.unlink(tmp_file_path)
|
291
|
+
except Exception:
|
292
|
+
pass
|
272
293
|
|
273
294
|
commit_hash = self._get_last_commit_hash()
|
274
295
|
print("✅ 完成提交")
|
@@ -310,17 +331,17 @@ commit信息
|
|
310
331
|
@app.command()
|
311
332
|
def cli(
|
312
333
|
root_dir: str = typer.Option(
|
313
|
-
".", "--root-dir", help="
|
334
|
+
".", "--root-dir", help="Git仓库的根目录路径"
|
314
335
|
),
|
315
336
|
prefix: str = typer.Option(
|
316
337
|
"",
|
317
338
|
"--prefix",
|
318
|
-
help="
|
339
|
+
help="提交信息前缀(用空格分隔)",
|
319
340
|
),
|
320
341
|
suffix: str = typer.Option(
|
321
342
|
"",
|
322
343
|
"--suffix",
|
323
|
-
help="
|
344
|
+
help="提交信息后缀(用换行分隔)",
|
324
345
|
),
|
325
346
|
):
|
326
347
|
init_env("欢迎使用 Jarvis-GitCommitTool,您的Git提交助手已准备就绪!")
|
@@ -50,9 +50,9 @@ class SSEMcpClient(McpClient):
|
|
50
50
|
self.sse_thread: Optional[threading.Thread] = None
|
51
51
|
self.messages_endpoint: Optional[str] = None
|
52
52
|
self.session_id: Optional[str] = None
|
53
|
-
self.pending_requests = {} # 存储等待响应的请求 {id: Event}
|
54
|
-
self.request_results = {} # 存储请求结果 {id: result}
|
55
|
-
self.notification_handlers = {}
|
53
|
+
self.pending_requests: Dict[str, threading.Event] = {} # 存储等待响应的请求 {id: Event}
|
54
|
+
self.request_results: Dict[str, Dict[str, Any]] = {} # 存储请求结果 {id: result}
|
55
|
+
self.notification_handlers: Dict[str, List[Callable]] = {}
|
56
56
|
self.event_lock = threading.Lock()
|
57
57
|
self.request_id_counter = 0
|
58
58
|
|
@@ -95,9 +95,7 @@ class SSEMcpClient(McpClient):
|
|
95
95
|
|
96
96
|
# 验证服务器响应
|
97
97
|
if "result" not in response:
|
98
|
-
raise RuntimeError(
|
99
|
-
f"初始化失败: {response.get('error', 'Unknown error')}"
|
100
|
-
)
|
98
|
+
raise RuntimeError(f"初始化失败: {response.get('error', 'Unknown error')}")
|
101
99
|
|
102
100
|
# 发送initialized通知
|
103
101
|
self._send_notification("notifications/initialized", {})
|
@@ -45,9 +45,9 @@ class StreamableMcpClient(McpClient):
|
|
45
45
|
self.session.headers.update(extra_headers)
|
46
46
|
|
47
47
|
# 请求相关属性
|
48
|
-
self.pending_requests = {} # 存储等待响应的请求 {id: Event}
|
49
|
-
self.request_results = {} # 存储请求结果 {id: result}
|
50
|
-
self.notification_handlers = {}
|
48
|
+
self.pending_requests: Dict[str, threading.Event] = {} # 存储等待响应的请求 {id: Event}
|
49
|
+
self.request_results: Dict[str, Dict[str, Any]] = {} # 存储请求结果 {id: result}
|
50
|
+
self.notification_handlers: Dict[str, List[Callable]] = {}
|
51
51
|
self.event_lock = threading.Lock()
|
52
52
|
self.request_id_counter = 0
|
53
53
|
|
@@ -70,9 +70,7 @@ class StreamableMcpClient(McpClient):
|
|
70
70
|
|
71
71
|
# 验证服务器响应
|
72
72
|
if "result" not in response:
|
73
|
-
raise RuntimeError(
|
74
|
-
f"初始化失败: {response.get('error', 'Unknown error')}"
|
75
|
-
)
|
73
|
+
raise RuntimeError(f"初始化失败: {response.get('error', 'Unknown error')}")
|
76
74
|
|
77
75
|
# 发送initialized通知
|
78
76
|
self._send_notification("notifications/initialized", {})
|
@@ -143,9 +141,7 @@ class StreamableMcpClient(McpClient):
|
|
143
141
|
|
144
142
|
# 发送请求到Streamable HTTP端点
|
145
143
|
mcp_url = urljoin(self.base_url, "mcp")
|
146
|
-
response = self.session.post(
|
147
|
-
mcp_url, json=request, stream=True # 启用流式传输
|
148
|
-
)
|
144
|
+
response = self.session.post(mcp_url, json=request, stream=True) # 启用流式传输
|
149
145
|
response.raise_for_status()
|
150
146
|
|
151
147
|
# 处理流式响应
|
jarvis/jarvis_platform/tongyi.py
CHANGED
@@ -81,10 +81,10 @@ class TongyiPlatform(BasePlatform):
|
|
81
81
|
"contentType": "text",
|
82
82
|
"role": "user",
|
83
83
|
"ext": {
|
84
|
-
"searchType": "",
|
84
|
+
"searchType": "depth" if self.web else "",
|
85
85
|
"pptGenerate": False,
|
86
|
-
"deepThink":
|
87
|
-
"deepResearch":
|
86
|
+
"deepThink": self.model_name == "Thinking",
|
87
|
+
"deepResearch": self.model_name == "Deep-Research",
|
88
88
|
},
|
89
89
|
}
|
90
90
|
]
|
@@ -98,10 +98,10 @@ class TongyiPlatform(BasePlatform):
|
|
98
98
|
"contentType": "text",
|
99
99
|
"role": "system",
|
100
100
|
"ext": {
|
101
|
-
"searchType": "",
|
101
|
+
"searchType": "depth" if self.web else "",
|
102
102
|
"pptGenerate": False,
|
103
|
-
"deepThink":
|
104
|
-
"deepResearch":
|
103
|
+
"deepThink": self.model_name == "Thinking",
|
104
|
+
"deepResearch": self.model_name == "Deep-Research",
|
105
105
|
},
|
106
106
|
},
|
107
107
|
)
|
@@ -140,13 +140,13 @@ class TongyiPlatform(BasePlatform):
|
|
140
140
|
"parentMsgId": self.msg_id,
|
141
141
|
"params": {
|
142
142
|
"agentId": "",
|
143
|
-
"searchType": "",
|
143
|
+
"searchType": "depth" if self.web else "",
|
144
144
|
"pptGenerate": False,
|
145
145
|
"bizScene": "code_chat" if self.model_name == "Code-Chat" else "",
|
146
146
|
"bizSceneInfo": {},
|
147
147
|
"specifiedModel": "",
|
148
|
-
"deepThink":
|
149
|
-
"deepResearch":
|
148
|
+
"deepThink": self.model_name == "Thinking",
|
149
|
+
"deepResearch": self.model_name == "Deep-Research",
|
150
150
|
"fileUploadBatchId": (
|
151
151
|
self.uploaded_file_info[0]["batchId"]
|
152
152
|
if self.uploaded_file_info
|