jarvis-ai-assistant 0.3.0__py3-none-any.whl → 0.3.2__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/__init__.py +19 -11
- jarvis/jarvis_agent/jarvis.py +4 -4
- jarvis/jarvis_agent/main.py +3 -4
- jarvis/jarvis_agent/memory_manager.py +4 -10
- jarvis/jarvis_agent/share_manager.py +22 -0
- jarvis/jarvis_code_agent/code_agent.py +2 -2
- jarvis/jarvis_data/config_schema.json +5 -4
- jarvis/jarvis_platform_manager/main.py +109 -14
- jarvis/jarvis_platform_manager/service.py +9 -4
- jarvis/jarvis_stats/storage.py +4 -1
- jarvis/jarvis_tools/search_web.py +1 -1
- jarvis/jarvis_utils/config.py +10 -0
- {jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/RECORD +19 -19
- {jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/jarvis_agent/__init__.py
CHANGED
@@ -34,6 +34,7 @@ from jarvis.jarvis_utils.config import (
|
|
34
34
|
get_thinking_model_name,
|
35
35
|
get_thinking_platform_name,
|
36
36
|
is_execute_tool_confirm,
|
37
|
+
is_force_save_memory,
|
37
38
|
is_use_analysis,
|
38
39
|
is_use_methodology,
|
39
40
|
)
|
@@ -115,6 +116,7 @@ class Agent:
|
|
115
116
|
multiline_inputer: Optional[Callable[[str], str]] = None,
|
116
117
|
use_methodology: Optional[bool] = None,
|
117
118
|
use_analysis: Optional[bool] = None,
|
119
|
+
force_save_memory: Optional[bool] = None,
|
118
120
|
files: List[str] = [],
|
119
121
|
):
|
120
122
|
"""初始化Jarvis Agent实例
|
@@ -134,6 +136,7 @@ class Agent:
|
|
134
136
|
multiline_inputer: 多行输入处理器
|
135
137
|
use_methodology: 是否使用方法论
|
136
138
|
use_analysis: 是否使用任务分析
|
139
|
+
force_save_memory: 是否强制保存记忆
|
137
140
|
"""
|
138
141
|
# 基础属性初始化
|
139
142
|
self.files = files
|
@@ -161,6 +164,7 @@ class Agent:
|
|
161
164
|
execute_tool_confirm,
|
162
165
|
summary_prompt,
|
163
166
|
model_group,
|
167
|
+
force_save_memory,
|
164
168
|
)
|
165
169
|
|
166
170
|
# 初始化管理器
|
@@ -186,9 +190,7 @@ class Agent:
|
|
186
190
|
|
187
191
|
self.model = PlatformRegistry().create_platform(platform_name)
|
188
192
|
if self.model is None:
|
189
|
-
PrettyOutput.print(
|
190
|
-
f"平台 {platform_name} 不存在,将使用普通模型", OutputType.WARNING
|
191
|
-
)
|
193
|
+
PrettyOutput.print(f"平台 {platform_name} 不存在,将使用普通模型", OutputType.WARNING)
|
192
194
|
self.model = PlatformRegistry().get_normal_platform()
|
193
195
|
|
194
196
|
if model_name:
|
@@ -227,6 +229,7 @@ class Agent:
|
|
227
229
|
execute_tool_confirm: Optional[bool],
|
228
230
|
summary_prompt: Optional[str],
|
229
231
|
model_group: Optional[str],
|
232
|
+
force_save_memory: Optional[bool],
|
230
233
|
):
|
231
234
|
"""初始化配置选项"""
|
232
235
|
# 如果有上传文件,自动禁用方法论
|
@@ -254,6 +257,12 @@ class Agent:
|
|
254
257
|
|
255
258
|
self.max_token_count = get_max_token_count(model_group)
|
256
259
|
|
260
|
+
self.force_save_memory = (
|
261
|
+
force_save_memory
|
262
|
+
if force_save_memory is not None
|
263
|
+
else is_force_save_memory()
|
264
|
+
)
|
265
|
+
|
257
266
|
def _setup_system_prompt(self):
|
258
267
|
"""设置系统提示词"""
|
259
268
|
action_prompt = self.get_tool_usage_prompt()
|
@@ -440,9 +449,10 @@ class Agent:
|
|
440
449
|
当上下文长度超过最大值时使用
|
441
450
|
"""
|
442
451
|
# 在清理历史之前,提示用户保存重要记忆
|
443
|
-
|
444
|
-
|
445
|
-
|
452
|
+
if self.force_save_memory:
|
453
|
+
print("📌 对话历史即将被总结和清理,请先保存重要信息...")
|
454
|
+
self.memory_manager.prompt_memory_save()
|
455
|
+
|
446
456
|
if self._should_use_file_upload():
|
447
457
|
return self._handle_history_with_file_upload()
|
448
458
|
else:
|
@@ -504,10 +514,10 @@ class Agent:
|
|
504
514
|
self.task_analyzer.analysis_task(satisfaction_feedback)
|
505
515
|
else:
|
506
516
|
# 如果没有开启分析,也提示用户是否有值得记忆的信息
|
507
|
-
self.
|
517
|
+
if self.force_save_memory:
|
518
|
+
self.memory_manager.prompt_memory_save()
|
508
519
|
|
509
520
|
if self.need_summary:
|
510
|
-
|
511
521
|
print("📄 正在生成总结...")
|
512
522
|
self.session.prompt = self.summary_prompt
|
513
523
|
if not self.model:
|
@@ -679,9 +689,7 @@ class Agent:
|
|
679
689
|
返回:
|
680
690
|
str: "continue" 或 "complete"
|
681
691
|
"""
|
682
|
-
user_input = self.multiline_inputer(
|
683
|
-
f"{self.name}: 请输入,或输入空行来结束当前任务:"
|
684
|
-
)
|
692
|
+
user_input = self.multiline_inputer(f"{self.name}: 请输入,或输入空行来结束当前任务:")
|
685
693
|
|
686
694
|
if user_input:
|
687
695
|
self.session.prompt = user_input
|
jarvis/jarvis_agent/jarvis.py
CHANGED
@@ -19,17 +19,17 @@ def run_cli(
|
|
19
19
|
ctx: typer.Context,
|
20
20
|
llm_type: str = typer.Option(
|
21
21
|
"normal",
|
22
|
-
"--llm_type",
|
22
|
+
"-t", "--llm_type",
|
23
23
|
help="使用的LLM类型,可选值:'normal'(普通)或 'thinking'(思考模式)",
|
24
24
|
),
|
25
25
|
task: Optional[str] = typer.Option(
|
26
|
-
None, "-
|
26
|
+
None, "-T", "--task", help="从命令行直接输入任务内容"
|
27
27
|
),
|
28
28
|
model_group: Optional[str] = typer.Option(
|
29
|
-
None, "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
29
|
+
None, "-g", "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
30
30
|
),
|
31
31
|
tool_group: Optional[str] = typer.Option(
|
32
|
-
None, "--tool_group", help="使用的工具组,覆盖配置文件中的设置"
|
32
|
+
None, "-G", "--tool_group", help="使用的工具组,覆盖配置文件中的设置"
|
33
33
|
),
|
34
34
|
config_file: Optional[str] = typer.Option(
|
35
35
|
None, "-f", "--config", help="自定义配置文件路径"
|
jarvis/jarvis_agent/main.py
CHANGED
@@ -50,13 +50,12 @@ def cli(
|
|
50
50
|
),
|
51
51
|
llm_type: str = typer.Option(
|
52
52
|
"normal",
|
53
|
-
"--llm_type",
|
53
|
+
"-t", "--llm_type",
|
54
54
|
help="使用的LLM类型,覆盖配置文件中的设置",
|
55
55
|
),
|
56
56
|
model_group: Optional[str] = typer.Option(
|
57
|
-
None, "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
58
|
-
),
|
59
|
-
):
|
57
|
+
None, "-g", "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
58
|
+
),):
|
60
59
|
"""Main entry point for Jarvis agent"""
|
61
60
|
# Initialize environment
|
62
61
|
init_env("欢迎使用 Jarvis AI 助手,您的智能助理已准备就绪!", config_file=config_file)
|
@@ -116,18 +116,12 @@ class MemoryManager:
|
|
116
116
|
memory_prompts += (
|
117
117
|
"\n - 如果有关键信息需要记忆,请调用save_memory工具进行记忆:"
|
118
118
|
)
|
119
|
-
memory_prompts +=
|
120
|
-
|
121
|
-
|
122
|
-
memory_prompts += (
|
123
|
-
"\n * global_long_term: 保存通用的信息、用户喜好、知识、方法等"
|
124
|
-
)
|
125
|
-
memory_prompts += "\n * short_term: 保存当前任务相关的临时信息"
|
119
|
+
memory_prompts += "\n * project_long_term: 保存与当前项目相关的长期信息(如:架构决策、关键配置、特定实现)"
|
120
|
+
memory_prompts += "\n * global_long_term: 保存通用的信息、用户喜好、知识、方法等(如:常用命令、个人偏好、解决方案)"
|
121
|
+
memory_prompts += "\n * short_term: 保存当前任务相关的临时信息(如:当前处理的文件、用户中间需求)"
|
126
122
|
|
127
123
|
# 如果有retrieve_memory工具,添加相关提示
|
128
124
|
if "retrieve_memory" in tool_names:
|
129
|
-
memory_prompts +=
|
130
|
-
"\n - 如果需要检索相关记忆信息,请调用retrieve_memory工具"
|
131
|
-
)
|
125
|
+
memory_prompts += "\n - 如果需要获取上下文或寻找解决方案,请调用retrieve_memory工具检索相关记忆"
|
132
126
|
|
133
127
|
return memory_prompts
|
@@ -60,6 +60,28 @@ class ShareManager(ABC):
|
|
60
60
|
subprocess.run(
|
61
61
|
["git", "clone", self.central_repo_url, self.repo_path], check=True
|
62
62
|
)
|
63
|
+
# 检查并添加.gitignore文件
|
64
|
+
gitignore_path = os.path.join(self.repo_path, ".gitignore")
|
65
|
+
modified = False
|
66
|
+
if not os.path.exists(gitignore_path):
|
67
|
+
with open(gitignore_path, "w") as f:
|
68
|
+
f.write("__pycache__/\n")
|
69
|
+
modified = True
|
70
|
+
else:
|
71
|
+
with open(gitignore_path, "r+") as f:
|
72
|
+
content = f.read()
|
73
|
+
if "__pycache__" not in content:
|
74
|
+
f.write("\n__pycache__/\n")
|
75
|
+
modified = True
|
76
|
+
|
77
|
+
if modified:
|
78
|
+
subprocess.run(["git", "add", ".gitignore"], cwd=self.repo_path, check=True)
|
79
|
+
subprocess.run(
|
80
|
+
["git", "commit", "-m", "chore: add __pycache__ to .gitignore"],
|
81
|
+
cwd=self.repo_path,
|
82
|
+
check=True
|
83
|
+
)
|
84
|
+
subprocess.run(["git", "push"], cwd=self.repo_path, check=True)
|
63
85
|
else:
|
64
86
|
PrettyOutput.print(
|
65
87
|
f"正在更新中心{self.get_resource_type()}仓库...", OutputType.INFO
|
@@ -642,11 +642,11 @@ class CodeAgent:
|
|
642
642
|
def cli(
|
643
643
|
llm_type: str = typer.Option(
|
644
644
|
"normal",
|
645
|
-
"--llm_type",
|
645
|
+
"-t", "--llm_type",
|
646
646
|
help="使用的LLM类型,可选值:'normal'(普通)或 'thinking'(思考模式)",
|
647
647
|
),
|
648
648
|
model_group: Optional[str] = typer.Option(
|
649
|
-
None, "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
649
|
+
None, "-g", "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
650
650
|
),
|
651
651
|
requirement: Optional[str] = typer.Option(
|
652
652
|
None, "-r", "--requirement", help="要处理的需求描述"
|
@@ -245,6 +245,11 @@
|
|
245
245
|
"description": "是否启用静态代码分析",
|
246
246
|
"default": true
|
247
247
|
},
|
248
|
+
"JARVIS_FORCE_SAVE_MEMORY": {
|
249
|
+
"type": "boolean",
|
250
|
+
"description": "是否强制保存记忆",
|
251
|
+
"default": true
|
252
|
+
},
|
248
253
|
"JARVIS_TOOL_GROUP": {
|
249
254
|
"type": "string",
|
250
255
|
"description": "选择一个预定义的工具配置组",
|
@@ -391,10 +396,6 @@
|
|
391
396
|
"type": "string",
|
392
397
|
"description": "AI8 API Key"
|
393
398
|
},
|
394
|
-
"OYI_API_KEY": {
|
395
|
-
"type": "string",
|
396
|
-
"description": "Oyi API Key"
|
397
|
-
},
|
398
399
|
"SHELL": {
|
399
400
|
"type": "string",
|
400
401
|
"description": "系统Shell路径,用于获取当前使用的shell类型",
|
@@ -8,6 +8,12 @@ import sys
|
|
8
8
|
from typing import Any, Dict, List, Optional
|
9
9
|
|
10
10
|
import typer
|
11
|
+
from jarvis.jarvis_utils.config import (
|
12
|
+
get_normal_platform_name,
|
13
|
+
get_normal_model_name,
|
14
|
+
get_thinking_platform_name,
|
15
|
+
get_thinking_model_name,
|
16
|
+
)
|
11
17
|
|
12
18
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
13
19
|
from jarvis.jarvis_utils.input import get_multiline_input, get_single_line_input
|
@@ -19,22 +25,26 @@ app = typer.Typer(help="Jarvis AI 平台")
|
|
19
25
|
|
20
26
|
|
21
27
|
@app.command("info")
|
22
|
-
def list_platforms(
|
23
|
-
|
28
|
+
def list_platforms(
|
29
|
+
platform: Optional[str] = typer.Option(
|
30
|
+
None, "--platform", "-p", help="指定要查看的平台"
|
31
|
+
)
|
32
|
+
) -> None:
|
33
|
+
"""列出所有支持的平台和模型,或指定平台的详细信息。"""
|
24
34
|
registry = PlatformRegistry.get_global_platform_registry()
|
25
|
-
|
35
|
+
platform_names = [platform] if platform else registry.get_available_platforms()
|
26
36
|
|
27
37
|
PrettyOutput.section("Supported platforms and models", OutputType.SUCCESS)
|
28
38
|
|
29
|
-
for platform_name in
|
39
|
+
for platform_name in platform_names:
|
30
40
|
try:
|
31
41
|
# Create platform instance
|
32
|
-
|
33
|
-
if not
|
42
|
+
platform_instance = registry.create_platform(platform_name)
|
43
|
+
if not platform_instance:
|
34
44
|
continue
|
35
45
|
|
36
46
|
# Get the list of models supported by the platform
|
37
|
-
models =
|
47
|
+
models = platform_instance.get_model_list()
|
38
48
|
|
39
49
|
# Print platform name
|
40
50
|
PrettyOutput.section(f"{platform_name}", OutputType.SUCCESS)
|
@@ -55,13 +65,25 @@ def list_platforms() -> None:
|
|
55
65
|
PrettyOutput.print(f"创建 {platform_name} 平台失败", OutputType.WARNING)
|
56
66
|
|
57
67
|
|
58
|
-
def chat_with_model(
|
59
|
-
""
|
68
|
+
def chat_with_model(
|
69
|
+
platform_name: str, model_name: str, system_prompt: str, llm_type: str = "normal"
|
70
|
+
) -> None:
|
71
|
+
"""与指定平台和模型进行对话。
|
72
|
+
|
73
|
+
参数:
|
74
|
+
platform_name: 平台名称
|
75
|
+
model_name: 模型名称
|
76
|
+
system_prompt: 系统提示语
|
77
|
+
llm_type: LLM类型,可选值:'normal'(普通)或 'thinking'(思考模式)
|
78
|
+
"""
|
60
79
|
registry = PlatformRegistry.get_global_platform_registry()
|
61
80
|
conversation_history: List[Dict[str, str]] = [] # 存储对话记录
|
62
81
|
|
63
82
|
# Create platform instance
|
64
83
|
platform = registry.create_platform(platform_name)
|
84
|
+
if platform:
|
85
|
+
platform.set_model_name(model_name)
|
86
|
+
|
65
87
|
if not platform:
|
66
88
|
PrettyOutput.print(f"创建平台 {platform_name} 失败", OutputType.WARNING)
|
67
89
|
return
|
@@ -100,7 +122,7 @@ def chat_with_model(platform_name: str, model_name: str, system_prompt: str) ->
|
|
100
122
|
# Check if it is a clear session command
|
101
123
|
if user_input.strip() == "/clear":
|
102
124
|
try:
|
103
|
-
platform.reset()
|
125
|
+
platform.reset() # type: ignore[no-untyped-call] # type: ignore[no-untyped-call] # type: ignore[no-untyped-call]
|
104
126
|
platform.set_model_name(model_name) # Reinitialize session
|
105
127
|
conversation_history = [] # 重置对话记录
|
106
128
|
PrettyOutput.print("会话已清除", OutputType.SUCCESS)
|
@@ -332,11 +354,32 @@ def chat_command(
|
|
332
354
|
None, "--platform", "-p", help="指定要使用的平台"
|
333
355
|
),
|
334
356
|
model: Optional[str] = typer.Option(None, "--model", "-m", help="指定要使用的模型"),
|
357
|
+
llm_type: str = typer.Option(
|
358
|
+
"normal",
|
359
|
+
"-t",
|
360
|
+
"--llm_type",
|
361
|
+
help="使用的LLM类型,可选值:'normal'(普通)或 'thinking'(思考模式)",
|
362
|
+
),
|
363
|
+
llm_group: Optional[str] = typer.Option(
|
364
|
+
None, "-g", "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
365
|
+
),
|
335
366
|
) -> None:
|
336
367
|
"""与指定平台和模型聊天。"""
|
368
|
+
# 如果未提供平台或模型参数,则从config获取默认值
|
369
|
+
platform = platform or (
|
370
|
+
get_thinking_platform_name(llm_group)
|
371
|
+
if llm_type == "thinking"
|
372
|
+
else get_normal_platform_name(llm_group)
|
373
|
+
)
|
374
|
+
model = model or (
|
375
|
+
get_thinking_model_name(llm_group)
|
376
|
+
if llm_type == "thinking"
|
377
|
+
else get_normal_model_name(llm_group)
|
378
|
+
)
|
379
|
+
|
337
380
|
if not validate_platform_model(platform, model):
|
338
381
|
return
|
339
|
-
chat_with_model(platform, model, "")
|
382
|
+
chat_with_model(platform, model, "", llm_type)
|
340
383
|
|
341
384
|
|
342
385
|
@app.command("service")
|
@@ -351,6 +394,9 @@ def service_command(
|
|
351
394
|
),
|
352
395
|
) -> None:
|
353
396
|
"""启动OpenAI兼容的API服务。"""
|
397
|
+
# 如果未提供平台或模型参数,则从config获取默认值
|
398
|
+
platform = platform or get_normal_platform_name()
|
399
|
+
model = model or get_normal_model_name()
|
354
400
|
start_service(host=host, port=port, default_platform=platform, default_model=model)
|
355
401
|
|
356
402
|
|
@@ -392,6 +438,15 @@ def role_command(
|
|
392
438
|
model: Optional[str] = typer.Option(
|
393
439
|
None, "--model", "-m", help="指定要使用的模型,覆盖角色配置"
|
394
440
|
),
|
441
|
+
llm_type: Optional[str] = typer.Option(
|
442
|
+
None,
|
443
|
+
"-t",
|
444
|
+
"--llm_type",
|
445
|
+
help="使用的LLM类型,可选值:'normal'(普通)或 'thinking'(思考模式),覆盖角色配置",
|
446
|
+
),
|
447
|
+
llm_group: Optional[str] = typer.Option(
|
448
|
+
None, "-g", "--llm_group", help="使用的模型组,覆盖配置文件中的设置"
|
449
|
+
),
|
395
450
|
) -> None:
|
396
451
|
"""加载角色配置文件并开始对话。"""
|
397
452
|
config_path = os.path.expanduser(config_file)
|
@@ -418,14 +473,54 @@ def role_command(
|
|
418
473
|
PrettyOutput.print("无效的选择", OutputType.ERROR)
|
419
474
|
return
|
420
475
|
|
476
|
+
# 获取llm_type,优先使用命令行参数,否则使用角色配置,默认为normal
|
477
|
+
role_llm_type = llm_type or selected_role.get("llm_type", "normal")
|
478
|
+
|
421
479
|
# 初始化平台和模型
|
422
|
-
|
423
|
-
|
480
|
+
# 如果提供了platform或model参数,优先使用命令行参数
|
481
|
+
# 否则,如果提供了llm_group,根据llm_type从配置中获取
|
482
|
+
# 最后才使用角色配置中的platform和model
|
483
|
+
if platform:
|
484
|
+
platform_name = platform
|
485
|
+
elif llm_group:
|
486
|
+
platform_name = (
|
487
|
+
get_thinking_platform_name(llm_group)
|
488
|
+
if role_llm_type == "thinking"
|
489
|
+
else get_normal_platform_name(llm_group)
|
490
|
+
)
|
491
|
+
else:
|
492
|
+
platform_name = selected_role.get("platform")
|
493
|
+
if not platform_name:
|
494
|
+
# 如果角色配置中没有platform,使用默认配置
|
495
|
+
platform_name = (
|
496
|
+
get_thinking_platform_name()
|
497
|
+
if role_llm_type == "thinking"
|
498
|
+
else get_normal_platform_name()
|
499
|
+
)
|
500
|
+
|
501
|
+
if model:
|
502
|
+
model_name = model
|
503
|
+
elif llm_group:
|
504
|
+
model_name = (
|
505
|
+
get_thinking_model_name(llm_group)
|
506
|
+
if role_llm_type == "thinking"
|
507
|
+
else get_normal_model_name(llm_group)
|
508
|
+
)
|
509
|
+
else:
|
510
|
+
model_name = selected_role.get("model")
|
511
|
+
if not model_name:
|
512
|
+
# 如果角色配置中没有model,使用默认配置
|
513
|
+
model_name = (
|
514
|
+
get_thinking_model_name()
|
515
|
+
if role_llm_type == "thinking"
|
516
|
+
else get_normal_model_name()
|
517
|
+
)
|
518
|
+
|
424
519
|
system_prompt = selected_role.get("system_prompt", "")
|
425
520
|
|
426
521
|
# 开始对话
|
427
522
|
PrettyOutput.print(f"已选择角色: {selected_role['name']}", OutputType.SUCCESS)
|
428
|
-
chat_with_model(platform_name, model_name, system_prompt)
|
523
|
+
chat_with_model(platform_name, model_name, system_prompt, role_llm_type)
|
429
524
|
|
430
525
|
|
431
526
|
def main() -> None:
|
@@ -195,11 +195,16 @@ def start_service(
|
|
195
195
|
if "/" in model:
|
196
196
|
platform_name, model_name = model.split("/", 1)
|
197
197
|
else:
|
198
|
-
# Use default platform
|
199
|
-
if default_platform
|
200
|
-
platform_name
|
198
|
+
# Use default platform if not specified in the model name
|
199
|
+
if default_platform:
|
200
|
+
platform_name = default_platform
|
201
|
+
model_name = model
|
201
202
|
else:
|
202
|
-
|
203
|
+
raise HTTPException(
|
204
|
+
status_code=400,
|
205
|
+
detail="Model name must be in 'platform/model_name' format "
|
206
|
+
"or a default platform must be set.",
|
207
|
+
)
|
203
208
|
|
204
209
|
# Get platform instance
|
205
210
|
platform = get_platform_instance(platform_name, model_name)
|
jarvis/jarvis_stats/storage.py
CHANGED
@@ -12,6 +12,7 @@ from typing import Dict, List, Optional, Any
|
|
12
12
|
from collections import defaultdict
|
13
13
|
import sys
|
14
14
|
import time
|
15
|
+
import uuid
|
15
16
|
|
16
17
|
|
17
18
|
class StatsStorage:
|
@@ -76,7 +77,9 @@ class StatsStorage:
|
|
76
77
|
def _save_json(self, filepath: Path, data: Dict):
|
77
78
|
"""保存JSON文件"""
|
78
79
|
# 使用临时文件+重命名的原子操作来避免并发写入问题
|
79
|
-
|
80
|
+
# 使用唯一的临时文件名避免并发冲突
|
81
|
+
temp_suffix = f".tmp.{uuid.uuid4().hex[:8]}"
|
82
|
+
temp_filepath = filepath.with_suffix(temp_suffix)
|
80
83
|
max_retries = 3
|
81
84
|
|
82
85
|
for attempt in range(max_retries):
|
@@ -31,7 +31,7 @@ class SearchWebTool:
|
|
31
31
|
"""执行网络搜索、抓取内容并总结结果。"""
|
32
32
|
try:
|
33
33
|
PrettyOutput.print("▶️ 使用 DuckDuckGo 开始网页搜索...", OutputType.INFO)
|
34
|
-
results = list(DDGS().text(query, max_results=50))
|
34
|
+
results = list(DDGS().text(query, max_results=50, page=3))
|
35
35
|
|
36
36
|
if not results:
|
37
37
|
return {
|
jarvis/jarvis_utils/config.py
CHANGED
@@ -339,6 +339,16 @@ def is_print_prompt() -> bool:
|
|
339
339
|
return GLOBAL_CONFIG_DATA.get("JARVIS_PRINT_PROMPT", False) == True
|
340
340
|
|
341
341
|
|
342
|
+
def is_force_save_memory() -> bool:
|
343
|
+
"""
|
344
|
+
获取是否强制保存记忆。
|
345
|
+
|
346
|
+
返回:
|
347
|
+
bool: 如果强制保存记忆则返回True,默认为True
|
348
|
+
"""
|
349
|
+
return GLOBAL_CONFIG_DATA.get("JARVIS_FORCE_SAVE_MEMORY", True) is True
|
350
|
+
|
351
|
+
|
342
352
|
def is_enable_static_analysis() -> bool:
|
343
353
|
"""
|
344
354
|
获取是否启用静态代码分析。
|
@@ -1,27 +1,27 @@
|
|
1
|
-
jarvis/__init__.py,sha256=
|
2
|
-
jarvis/jarvis_agent/__init__.py,sha256=
|
1
|
+
jarvis/__init__.py,sha256=lEwB7boP3teN71H_7lteEF13tfqihaQwtXiRqbFAWro,73
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=2zScM4N6GN4Vv5y_jDmJjTirea8ZGtRMiPf-UaGl0XE,25789
|
3
3
|
jarvis/jarvis_agent/agent_manager.py,sha256=YzpMiF0H2-eyk2kn2o24Bkj3bXsQx7Pv2vfD4gWepo0,2893
|
4
4
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=Qs4LAr4xdKLBJpQE81YP4CkucAop86ms0iVoKa1nnso,2468
|
5
5
|
jarvis/jarvis_agent/config_editor.py,sha256=Ctk82sO6w2cNW0-_5L7Bomj-hgM4U7WwMc52fwhAJyg,1809
|
6
6
|
jarvis/jarvis_agent/edit_file_handler.py,sha256=w-byNJ4TN_SlV3djjfFC7OksySOFGrM8ku49w662dzc,11854
|
7
7
|
jarvis/jarvis_agent/file_methodology_manager.py,sha256=h2ogMK9mSKjg_n04ITw24m28J_U225bhLNhfwpf9jpU,4383
|
8
|
-
jarvis/jarvis_agent/jarvis.py,sha256=
|
9
|
-
jarvis/jarvis_agent/main.py,sha256=
|
10
|
-
jarvis/jarvis_agent/memory_manager.py,sha256=
|
8
|
+
jarvis/jarvis_agent/jarvis.py,sha256=2XMuMA3A4ihE4RAo-XnYZHnJ0ZrGRFagE1s-eiGdZ9Q,3252
|
9
|
+
jarvis/jarvis_agent/main.py,sha256=Sd4-OnBcMqY5i7vb-Riy_JT2fGfuANtgiAWvWFY8LXM,3345
|
10
|
+
jarvis/jarvis_agent/memory_manager.py,sha256=F7HTNzdN1_-cSygnz7zKSJRJvPLUOosqcXQeiW8zG4U,5266
|
11
11
|
jarvis/jarvis_agent/methodology_share_manager.py,sha256=vwWNexluTXSI3qeNP3zJAemOjWW37o_1AlqDR1C8wCI,6910
|
12
12
|
jarvis/jarvis_agent/output_handler.py,sha256=P7oWpXBGFfOsWq7cIhS_z9crkQ19ES7qU5pM92KKjAs,1172
|
13
13
|
jarvis/jarvis_agent/prompt_builder.py,sha256=PH1fPDVa8z_RXkoXHJFNDf8PQjUoLNLYwkh2lC__p40,1705
|
14
14
|
jarvis/jarvis_agent/prompts.py,sha256=X6cXa-n0xqBQ8LDTgLsD0kqziAh1s0cNp89i4mxcvHg,9444
|
15
15
|
jarvis/jarvis_agent/protocols.py,sha256=JWnJDikFEuwvFUv7uzXu0ggJ4O9K2FkMnfVCwIJ5REw,873
|
16
16
|
jarvis/jarvis_agent/session_manager.py,sha256=DnvI9rWkVmkyO1XfKZyo9lTn4ajg4ccwzEkoRHFPOJM,2925
|
17
|
-
jarvis/jarvis_agent/share_manager.py,sha256=
|
17
|
+
jarvis/jarvis_agent/share_manager.py,sha256=7w25cX2zupnBDdn_HDusMyOAXbHQMWKYVZYq9i4EJs0,7619
|
18
18
|
jarvis/jarvis_agent/shell_input_handler.py,sha256=1IboqdxcJuoIqRpmDU10GugR9fWXUHyCEbVF4nIWbyo,1328
|
19
19
|
jarvis/jarvis_agent/task_analyzer.py,sha256=-fQ9YBYFcc-Z1FSoDIPzRfAgkREFoIOXtU2TdBkB-e0,4656
|
20
20
|
jarvis/jarvis_agent/task_manager.py,sha256=HJm4_SMpsFbQMUUsAZeHm7cZuhNbz28YW-DRLYgoarc,4422
|
21
21
|
jarvis/jarvis_agent/tool_executor.py,sha256=nIq-sPNgrtimtM-IHpN09cWmId8jDzWRdCFoRzXnnoo,1721
|
22
22
|
jarvis/jarvis_agent/tool_share_manager.py,sha256=R5ONIQlDXX9pFq3clwHFhEW8BAJ3ECaR2DqWCEC9tzM,5205
|
23
23
|
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
-
jarvis/jarvis_code_agent/code_agent.py,sha256=
|
24
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=mFcvj3F2ZJS550Cbv8TrVyY1evQVow8SI6B-LCdRfxI,29317
|
25
25
|
jarvis/jarvis_code_agent/lint.py,sha256=LZPsfyZPMo7Wm7LN4osZocuNJwZx1ojacO3MlF870x8,4009
|
26
26
|
jarvis/jarvis_code_analysis/code_review.py,sha256=TMov1pqDe1bg0vM1ndnYeW9ejHrRN_jMroo3T4L9yag,32368
|
27
27
|
jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=LIXAYa1sW3l7foP6kohLWnE98I_EQ0T7z5bYKHq6rJA,78
|
@@ -44,7 +44,7 @@ jarvis/jarvis_code_analysis/checklists/shell.py,sha256=aRFYhQQvTgbYd-uY5pc8UHIUA
|
|
44
44
|
jarvis/jarvis_code_analysis/checklists/sql.py,sha256=vR0T6qC7b4dURjJVAd7kSVxyvZEQXPG1Jqc2sNTGp5c,2355
|
45
45
|
jarvis/jarvis_code_analysis/checklists/swift.py,sha256=TPx4I6Gupvs6tSerRKmTSKEPQpOLEbH2Y7LXg1uBgxc,2566
|
46
46
|
jarvis/jarvis_code_analysis/checklists/web.py,sha256=25gGD7pDadZQybNFvALYxWvK0VRjGQb1NVJQElwjyk0,3943
|
47
|
-
jarvis/jarvis_data/config_schema.json,sha256=
|
47
|
+
jarvis/jarvis_data/config_schema.json,sha256=xri_qfCrs2AJ-fPwvnV4oU7VJpIrUxddffQMoSaHZ2A,11419
|
48
48
|
jarvis/jarvis_data/tiktoken/9b5ad71b2ce5302211f9c61530b329a4922fc6a4,sha256=Ijkht27pm96ZW3_3OFE-7xAPtR0YyTWXoRO8_-hlsqc,1681126
|
49
49
|
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
50
50
|
jarvis/jarvis_git_squash/main.py,sha256=6PECdAbTbrsJBRLK1pXBh4hdJ_LADh-XXSic1xJi97E,2255
|
@@ -66,8 +66,8 @@ jarvis/jarvis_platform/registry.py,sha256=1bMy0YZUa8NLzuZlKfC4CBtpa0iniypTxUZk0H
|
|
66
66
|
jarvis/jarvis_platform/tongyi.py,sha256=uZP5ceCbHPApimKBqKthP5QynG52C3tMBglIyoBHwaY,22186
|
67
67
|
jarvis/jarvis_platform/yuanbao.py,sha256=mS4aywK9CzgFU6FHh6GUxyY1Ly-NoBtGkBi74Jo_0XM,22921
|
68
68
|
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
|
-
jarvis/jarvis_platform_manager/main.py,sha256=
|
70
|
-
jarvis/jarvis_platform_manager/service.py,sha256=
|
69
|
+
jarvis/jarvis_platform_manager/main.py,sha256=fRZbtCH6zrG7NXTMlplf0Oq4gRYkhebvPm3RrQtN_WU,20988
|
70
|
+
jarvis/jarvis_platform_manager/service.py,sha256=myJYGSUclCEiRTf3JKs4JndwhXJeQj7MQQy4i13jMt0,13767
|
71
71
|
jarvis/jarvis_rag/__init__.py,sha256=HRTXgnQxDuaE9x-e3r6SYqhJ5d4DSI_rrIxy2IGY6qk,320
|
72
72
|
jarvis/jarvis_rag/cache.py,sha256=Tqx_Oe-AhuWlMXHGHUaIuG6OEHoHBVZq7mL3kldtFFU,2723
|
73
73
|
jarvis/jarvis_rag/cli.py,sha256=bIQKibp8swJDyfFBXaiX5C20LHN_2W2knO2I-MQp58c,15620
|
@@ -82,7 +82,7 @@ jarvis/jarvis_smart_shell/main.py,sha256=ReCC9bWPlgl84ylI0uvdzlE3J6fS0XzFSLOpQQy
|
|
82
82
|
jarvis/jarvis_stats/__init__.py,sha256=jJzgP43nxzLbNGs8Do4Jfta1PNCJMf1Oq9YTPd6EnFM,342
|
83
83
|
jarvis/jarvis_stats/cli.py,sha256=KqLH-9Kd_YlBJSke3QXY90XnFmiH2kYkRacL8ygtSsM,12649
|
84
84
|
jarvis/jarvis_stats/stats.py,sha256=qLyOJvWAv0fgV7oohAUSQ2W2E1Hr4wWgEQXDOiI-4Cg,17674
|
85
|
-
jarvis/jarvis_stats/storage.py,sha256=
|
85
|
+
jarvis/jarvis_stats/storage.py,sha256=MBQRxExIWdePXzY1EE8JAs1IEpMqamImpgjruqt_u9A,12853
|
86
86
|
jarvis/jarvis_stats/visualizer.py,sha256=ZIBmGELzs6c7qM01tQql1HF6eFKn6HDGVQfKXRUUIY0,8529
|
87
87
|
jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
88
|
jarvis/jarvis_tools/ask_user.py,sha256=M6DdLNryCE8y1JcdZHEifUgZkPUEPNKc-zDW5p0Mb1k,2029
|
@@ -99,14 +99,14 @@ jarvis/jarvis_tools/registry.py,sha256=TtZ415LUMfWqfcgn3G5V4e3QLLU2ILNRatkP10U0Y
|
|
99
99
|
jarvis/jarvis_tools/retrieve_memory.py,sha256=0UBZm4wQTXLTj5WHXR9fjsiIDQh-Z2UINVu8cJ12YYg,9488
|
100
100
|
jarvis/jarvis_tools/rewrite_file.py,sha256=eG_WKg6cVAXmuGwUqlWkcuyay5S8DOzEi8vZCmX3O8w,7255
|
101
101
|
jarvis/jarvis_tools/save_memory.py,sha256=DjeFb38OtK9Y_RpWYHz8vL72JdauXZTlc_Y0FUQBtiM,7486
|
102
|
-
jarvis/jarvis_tools/search_web.py,sha256=
|
102
|
+
jarvis/jarvis_tools/search_web.py,sha256=kDwC6fy4TFFyok5zFYZ4VCZXyLsbU9jAoxxy26--GIk,5809
|
103
103
|
jarvis/jarvis_tools/virtual_tty.py,sha256=LTsg1PlsPvgaLShUaxpAKwTpyjXRr0l0qSREI7Q-fBc,26349
|
104
104
|
jarvis/jarvis_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
105
|
jarvis/jarvis_tools/cli/main.py,sha256=GsfZJ4OS4Hvxh0H2XiLkgbzm-ajBsb4c0LyjuIAAatE,7718
|
106
106
|
jarvis/jarvis_utils/__init__.py,sha256=67h0ldisGlh3oK4DAeNEL2Bl_VsI3tSmfclasyVlueM,850
|
107
107
|
jarvis/jarvis_utils/builtin_replace_map.py,sha256=4BurljGuiG_I93EBs7mlFlPm9wYC_4CmdTG5tQWpF6g,1712
|
108
108
|
jarvis/jarvis_utils/clipboard.py,sha256=WgbQIQR2sh7_5ZzeX04eT3zXx_mxQbKyJOZXgGX_TcI,2907
|
109
|
-
jarvis/jarvis_utils/config.py,sha256=
|
109
|
+
jarvis/jarvis_utils/config.py,sha256=RSmKvpfB9-cq5PVZPNSirc0qiNtNKw8AUpuz5RKK2vs,15378
|
110
110
|
jarvis/jarvis_utils/embedding.py,sha256=oEOEM2qf16DMYwPsQe6srET9BknyjOdY2ef0jsp3Or8,2714
|
111
111
|
jarvis/jarvis_utils/file_processors.py,sha256=XiM248SHS7lLgQDCbORVFWqinbVDUawYxWDOsLXDxP8,3043
|
112
112
|
jarvis/jarvis_utils/git_utils.py,sha256=FxvmKkGlHWP0bTxzL1KR9fwr_ZYuBhtWX3Tt3JuMYKI,21865
|
@@ -117,9 +117,9 @@ jarvis/jarvis_utils/methodology.py,sha256=i8-chZtggN3GbhaDzeLV4eBl0DP3I5zctZ-I5H
|
|
117
117
|
jarvis/jarvis_utils/output.py,sha256=QRLlKObQKT0KuRSeZRqYb7NlTQvsd1oZXZ41WxeWEuU,10894
|
118
118
|
jarvis/jarvis_utils/tag.py,sha256=f211opbbbTcSyzCDwuIK_oCnKhXPNK-RknYyGzY1yD0,431
|
119
119
|
jarvis/jarvis_utils/utils.py,sha256=RwhyPfBGx_x9OKawWUVw6bAbZeI4IlvxBhhYQ_RHpWQ,40847
|
120
|
-
jarvis_ai_assistant-0.3.
|
121
|
-
jarvis_ai_assistant-0.3.
|
122
|
-
jarvis_ai_assistant-0.3.
|
123
|
-
jarvis_ai_assistant-0.3.
|
124
|
-
jarvis_ai_assistant-0.3.
|
125
|
-
jarvis_ai_assistant-0.3.
|
120
|
+
jarvis_ai_assistant-0.3.2.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
121
|
+
jarvis_ai_assistant-0.3.2.dist-info/METADATA,sha256=DL481NElSBIOwMBr1GXz6tfFmzR1vE86Z0keZubnZ_E,16807
|
122
|
+
jarvis_ai_assistant-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
123
|
+
jarvis_ai_assistant-0.3.2.dist-info/entry_points.txt,sha256=8cwi1VxZGU5UeSZMFiH-jG6NK95Asjukj5SBLBrGiGo,1257
|
124
|
+
jarvis_ai_assistant-0.3.2.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
125
|
+
jarvis_ai_assistant-0.3.2.dist-info/RECORD,,
|
File without changes
|
{jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/entry_points.txt
RENAMED
File without changes
|
{jarvis_ai_assistant-0.3.0.dist-info → jarvis_ai_assistant-0.3.2.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|