jarvis-ai-assistant 0.1.225__tar.gz → 0.2.0__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.
Files changed (117) hide show
  1. {jarvis_ai_assistant-0.1.225/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.2.0}/PKG-INFO +47 -11
  2. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/README.md +46 -10
  3. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/pyproject.toml +1 -1
  4. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/setup.py +1 -1
  5. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/__init__.py +1 -1
  6. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/__init__.py +8 -5
  7. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/jarvis.py +6 -0
  8. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/main.py +7 -0
  9. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_agent/code_agent.py +12 -1
  10. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/code_review.py +14 -3
  11. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_data/config_schema.json +41 -0
  12. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_git_utils/git_commiter.py +9 -2
  13. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_mcp/sse_mcp_client.py +9 -7
  14. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_mcp/stdio_mcp_client.py +2 -2
  15. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/base.py +28 -13
  16. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/generate_new_tool.py +1 -0
  17. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/registry.py +13 -8
  18. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/config.py +80 -21
  19. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/git_utils.py +2 -2
  20. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/globals.py +17 -11
  21. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/methodology.py +37 -23
  22. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/output.py +2 -2
  23. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/utils.py +137 -3
  24. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0/src/jarvis_ai_assistant.egg-info}/PKG-INFO +47 -11
  25. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/LICENSE +0 -0
  26. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/MANIFEST.in +0 -0
  27. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/setup.cfg +0 -0
  28. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/builtin_input_handler.py +0 -0
  29. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/edit_file_handler.py +0 -0
  30. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/output_handler.py +0 -0
  31. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/prompt_builder.py +0 -0
  32. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/prompts.py +0 -0
  33. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/protocols.py +0 -0
  34. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/session_manager.py +0 -0
  35. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/shell_input_handler.py +0 -0
  36. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_agent/tool_executor.py +0 -0
  37. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
  38. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_agent/lint.py +0 -0
  39. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/__init__.py +0 -0
  40. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/c_cpp.py +0 -0
  41. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/csharp.py +0 -0
  42. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/data_format.py +0 -0
  43. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/devops.py +0 -0
  44. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/docs.py +0 -0
  45. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/go.py +0 -0
  46. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/infrastructure.py +0 -0
  47. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/java.py +0 -0
  48. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/javascript.py +0 -0
  49. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/kotlin.py +0 -0
  50. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/loader.py +0 -0
  51. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/php.py +0 -0
  52. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/python.py +0 -0
  53. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/ruby.py +0 -0
  54. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/rust.py +0 -0
  55. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/shell.py +0 -0
  56. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/sql.py +0 -0
  57. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/swift.py +0 -0
  58. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_code_analysis/checklists/web.py +0 -0
  59. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_data/tiktoken/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +0 -0
  60. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_git_details/__init__.py +0 -0
  61. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_git_details/main.py +0 -0
  62. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_git_squash/__init__.py +0 -0
  63. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_git_squash/main.py +0 -0
  64. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_mcp/__init__.py +0 -0
  65. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_mcp/streamable_mcp_client.py +0 -0
  66. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_methodology/main.py +0 -0
  67. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_multi_agent/__init__.py +0 -0
  68. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_multi_agent/main.py +0 -0
  69. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/__init__.py +0 -0
  70. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/ai8.py +0 -0
  71. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/human.py +0 -0
  72. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/kimi.py +0 -0
  73. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/openai.py +0 -0
  74. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/oyi.py +0 -0
  75. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/registry.py +0 -0
  76. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/tongyi.py +0 -0
  77. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform/yuanbao.py +0 -0
  78. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform_manager/__init__.py +0 -0
  79. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform_manager/main.py +0 -0
  80. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_platform_manager/service.py +0 -0
  81. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/__init__.py +0 -0
  82. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/cache.py +0 -0
  83. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/cli.py +0 -0
  84. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/embedding_manager.py +0 -0
  85. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/llm_interface.py +0 -0
  86. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/query_rewriter.py +0 -0
  87. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/rag_pipeline.py +0 -0
  88. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/reranker.py +0 -0
  89. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_rag/retriever.py +0 -0
  90. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
  91. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_smart_shell/main.py +0 -0
  92. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/__init__.py +0 -0
  93. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/ask_user.py +0 -0
  94. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/base.py +0 -0
  95. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/cli/__init__.py +0 -0
  96. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/cli/main.py +0 -0
  97. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/edit_file.py +0 -0
  98. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/execute_script.py +0 -0
  99. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/file_analyzer.py +0 -0
  100. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/methodology.py +0 -0
  101. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/read_code.py +0 -0
  102. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/read_webpage.py +0 -0
  103. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/rewrite_file.py +0 -0
  104. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/search_web.py +0 -0
  105. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_tools/virtual_tty.py +0 -0
  106. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/__init__.py +0 -0
  107. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/builtin_replace_map.py +0 -0
  108. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/embedding.py +0 -0
  109. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/file_processors.py +0 -0
  110. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/http.py +0 -0
  111. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/input.py +0 -0
  112. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis/jarvis_utils/tag.py +0 -0
  113. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +0 -0
  114. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  115. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis_ai_assistant.egg-info/entry_points.txt +0 -0
  116. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis_ai_assistant.egg-info/requires.txt +0 -0
  117. {jarvis_ai_assistant-0.1.225 → jarvis_ai_assistant-0.2.0}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.225
3
+ Version: 0.2.0
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
@@ -508,9 +508,9 @@ ENV:
508
508
  #### Kimi
509
509
  ```yaml
510
510
  JARVIS_PLATFORM: kimi
511
- JARVIS_MODEL: kimi
511
+ JARVIS_MODEL: k1.5
512
512
  JARVIS_THINKING_PLATFORM: kimi
513
- JARVIS_THINKING_MODEL: k1
513
+ JARVIS_THINKING_MODEL: k1.5-thinking
514
514
  ENV:
515
515
  KIMI_API_KEY: <Kimi API KEY>
516
516
  ```
@@ -535,19 +535,55 @@ OPENAI_API_KEY: <OpenAI API Key>
535
535
  OPENAI_API_BASE: https://api.openai.com/v1
536
536
  ```
537
537
 
538
- ### 2. 配置项说明
538
+ ### 2. 模型组配置 (高级)
539
+
540
+ 除了单独配置每个模型参数,您还可以定义和使用**模型组**来快速切换不同的模型组合。这对于需要在不同任务或平台间频繁切换的场景非常有用。
541
+
542
+ **配置示例** (`~/.jarvis/config.yaml`):
543
+
544
+ ```yaml
545
+ # 定义模型组
546
+ JARVIS_MODEL_GROUPS:
547
+ - kimi:
548
+ JARVIS_PLATFORM: kimi
549
+ JARVIS_MODEL: k1.5
550
+ JARVIS_THINKING_PLATFORM: kimi
551
+ JARVIS_THINKING_MODEL: k1.5-thinking
552
+ JARVIS_MAX_TOKEN_COUNT: 8192
553
+ - ai8:
554
+ JARVIS_PLATFORM: ai8
555
+ JARVIS_MODEL: gemini-2.5-pro
556
+ # 如果不指定思考模型,将自动使用常规模型
557
+ # JARVIS_THINKING_PLATFORM: ai8
558
+ # JARVIS_THINKING_MODEL: gemini-2.5-pro
559
+
560
+ # 选择要使用的模型组
561
+ JARVIS_MODEL_GROUP: kimi
562
+ ```
563
+
564
+ **配置优先级规则:**
565
+
566
+ Jarvis 会按照以下顺序解析模型配置,序号越小优先级越高:
567
+
568
+ 1. **独立配置**: 直接设置的 `JARVIS_PLATFORM`, `JARVIS_MODEL`, `JARVIS_THINKING_PLATFORM`, `JARVIS_THINKING_MODEL` 环境变量。这些配置会**覆盖**任何模型组中的设置。
569
+ 2. **模型组配置**: 通过 `JARVIS_MODEL_GROUP` 选中的模型组配置。
570
+ 3. **默认值**: 如果以上均未配置,则使用代码中定义的默认模型(如 `yuanbao` 和 `deep_seek_v3`)。
571
+
572
+ ### 3. 全部配置项说明
539
573
  | 变量名称 | 默认值 | 说明 |
540
574
  |----------|--------|------|
541
575
  | `ENV` | {} | 环境变量配置 |
542
- | `JARVIS_MAX_TOKEN_COUNT` | 960000 | 上下文窗口的最大token数量 |
543
- | `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 |
544
- | `JARVIS_PLATFORM` | yuanbao | 默认AI平台 |
545
- | `JARVIS_MODEL` | deep_seek_v3 | 默认模型 |
546
- | `JARVIS_THINKING_PLATFORM` | JARVIS_PLATFORM | 推理任务使用的平台 |
547
- | `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 |
576
+ | `JARVIS_MODEL_GROUPS` | `[]` | 预定义的模型配置组列表 |
577
+ | `JARVIS_MODEL_GROUP` | `null` | 选择要激活的模型组名称 |
578
+ | `JARVIS_MAX_TOKEN_COUNT` | 960000 | 上下文窗口的最大token数量 (可被模型组覆盖) |
579
+ | `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 (可被模型组覆盖) |
580
+ | `JARVIS_PLATFORM` | yuanbao | 默认AI平台 (可被模型组覆盖) |
581
+ | `JARVIS_MODEL` | deep_seek_v3 | 默认模型 (可被模型组覆盖) |
582
+ | `JARVIS_THINKING_PLATFORM` | JARVIS_PLATFORM | 推理任务使用的平台 (可被模型组覆盖) |
583
+ | `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 (可被模型组覆盖) |
548
584
  | `JARVIS_EXECUTE_TOOL_CONFIRM` | false | 执行工具前是否需要确认 |
549
585
  | `JARVIS_CONFIRM_BEFORE_APPLY_PATCH` | false | 应用补丁前是否需要确认 |
550
- | `JARVIS_MAX_BIG_CONTENT_SIZE` | 160000 | 最大大内容大小 |
586
+ | `JARVIS_MAX_BIG_CONTENT_SIZE` | 160000 | 最大大内容大小 (可被模型组覆盖) |
551
587
  | `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
552
588
  | `JARVIS_GIT_COMMIT_PROMPT` | "" | 自定义git提交信息生成提示模板 |
553
589
  | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
@@ -424,9 +424,9 @@ ENV:
424
424
  #### Kimi
425
425
  ```yaml
426
426
  JARVIS_PLATFORM: kimi
427
- JARVIS_MODEL: kimi
427
+ JARVIS_MODEL: k1.5
428
428
  JARVIS_THINKING_PLATFORM: kimi
429
- JARVIS_THINKING_MODEL: k1
429
+ JARVIS_THINKING_MODEL: k1.5-thinking
430
430
  ENV:
431
431
  KIMI_API_KEY: <Kimi API KEY>
432
432
  ```
@@ -451,19 +451,55 @@ OPENAI_API_KEY: <OpenAI API Key>
451
451
  OPENAI_API_BASE: https://api.openai.com/v1
452
452
  ```
453
453
 
454
- ### 2. 配置项说明
454
+ ### 2. 模型组配置 (高级)
455
+
456
+ 除了单独配置每个模型参数,您还可以定义和使用**模型组**来快速切换不同的模型组合。这对于需要在不同任务或平台间频繁切换的场景非常有用。
457
+
458
+ **配置示例** (`~/.jarvis/config.yaml`):
459
+
460
+ ```yaml
461
+ # 定义模型组
462
+ JARVIS_MODEL_GROUPS:
463
+ - kimi:
464
+ JARVIS_PLATFORM: kimi
465
+ JARVIS_MODEL: k1.5
466
+ JARVIS_THINKING_PLATFORM: kimi
467
+ JARVIS_THINKING_MODEL: k1.5-thinking
468
+ JARVIS_MAX_TOKEN_COUNT: 8192
469
+ - ai8:
470
+ JARVIS_PLATFORM: ai8
471
+ JARVIS_MODEL: gemini-2.5-pro
472
+ # 如果不指定思考模型,将自动使用常规模型
473
+ # JARVIS_THINKING_PLATFORM: ai8
474
+ # JARVIS_THINKING_MODEL: gemini-2.5-pro
475
+
476
+ # 选择要使用的模型组
477
+ JARVIS_MODEL_GROUP: kimi
478
+ ```
479
+
480
+ **配置优先级规则:**
481
+
482
+ Jarvis 会按照以下顺序解析模型配置,序号越小优先级越高:
483
+
484
+ 1. **独立配置**: 直接设置的 `JARVIS_PLATFORM`, `JARVIS_MODEL`, `JARVIS_THINKING_PLATFORM`, `JARVIS_THINKING_MODEL` 环境变量。这些配置会**覆盖**任何模型组中的设置。
485
+ 2. **模型组配置**: 通过 `JARVIS_MODEL_GROUP` 选中的模型组配置。
486
+ 3. **默认值**: 如果以上均未配置,则使用代码中定义的默认模型(如 `yuanbao` 和 `deep_seek_v3`)。
487
+
488
+ ### 3. 全部配置项说明
455
489
  | 变量名称 | 默认值 | 说明 |
456
490
  |----------|--------|------|
457
491
  | `ENV` | {} | 环境变量配置 |
458
- | `JARVIS_MAX_TOKEN_COUNT` | 960000 | 上下文窗口的最大token数量 |
459
- | `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 |
460
- | `JARVIS_PLATFORM` | yuanbao | 默认AI平台 |
461
- | `JARVIS_MODEL` | deep_seek_v3 | 默认模型 |
462
- | `JARVIS_THINKING_PLATFORM` | JARVIS_PLATFORM | 推理任务使用的平台 |
463
- | `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 |
492
+ | `JARVIS_MODEL_GROUPS` | `[]` | 预定义的模型配置组列表 |
493
+ | `JARVIS_MODEL_GROUP` | `null` | 选择要激活的模型组名称 |
494
+ | `JARVIS_MAX_TOKEN_COUNT` | 960000 | 上下文窗口的最大token数量 (可被模型组覆盖) |
495
+ | `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 (可被模型组覆盖) |
496
+ | `JARVIS_PLATFORM` | yuanbao | 默认AI平台 (可被模型组覆盖) |
497
+ | `JARVIS_MODEL` | deep_seek_v3 | 默认模型 (可被模型组覆盖) |
498
+ | `JARVIS_THINKING_PLATFORM` | JARVIS_PLATFORM | 推理任务使用的平台 (可被模型组覆盖) |
499
+ | `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 (可被模型组覆盖) |
464
500
  | `JARVIS_EXECUTE_TOOL_CONFIRM` | false | 执行工具前是否需要确认 |
465
501
  | `JARVIS_CONFIRM_BEFORE_APPLY_PATCH` | false | 应用补丁前是否需要确认 |
466
- | `JARVIS_MAX_BIG_CONTENT_SIZE` | 160000 | 最大大内容大小 |
502
+ | `JARVIS_MAX_BIG_CONTENT_SIZE` | 160000 | 最大大内容大小 (可被模型组覆盖) |
467
503
  | `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
468
504
  | `JARVIS_GIT_COMMIT_PROMPT` | "" | 自定义git提交信息生成提示模板 |
469
505
  | `JARVIS_PRINT_PROMPT` | false | 是否打印提示 |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jarvis-ai-assistant"
7
- version = "0.1.225"
7
+ version = "0.2.0"
8
8
  description = "Jarvis: An AI assistant that uses tools to interact with the system"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "skyfire", email = "skyfireitdiy@hotmail.com" }]
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages # type: ignore
3
3
 
4
4
  setup(
5
5
  name="jarvis-ai-assistant",
6
- version="0.1.225",
6
+ version="0.2.0",
7
7
  author="skyfire",
8
8
  author_email="skyfireitdiy@hotmail.com",
9
9
  description="An AI assistant that uses various tools to interact with the system",
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Jarvis AI Assistant"""
3
3
 
4
- __version__ = "0.1.225"
4
+ __version__ = "0.2.0"
@@ -102,6 +102,7 @@ class Agent:
102
102
  name: str = "Jarvis",
103
103
  description: str = "",
104
104
  llm_type: str = "normal",
105
+ model_group: Optional[str] = None,
105
106
  summary_prompt: Optional[str] = None,
106
107
  auto_complete: bool = False,
107
108
  output_handler: List[OutputHandlerProtocol] = [],
@@ -137,11 +138,11 @@ class Agent:
137
138
  self.description = description
138
139
  # 初始化平台和模型
139
140
  if llm_type == "thinking":
140
- platform_name = get_thinking_platform_name()
141
- model_name = get_thinking_model_name()
141
+ platform_name = get_thinking_platform_name(model_group)
142
+ model_name = get_thinking_model_name(model_group)
142
143
  else: # 默认为 normal
143
- platform_name = get_normal_platform_name()
144
- model_name = get_normal_model_name()
144
+ platform_name = get_normal_platform_name(model_group)
145
+ model_name = get_normal_model_name(model_group)
145
146
 
146
147
  self.model = PlatformRegistry().create_platform(platform_name)
147
148
  if self.model is None:
@@ -153,6 +154,8 @@ class Agent:
153
154
  if model_name:
154
155
  self.model.set_model_name(model_name)
155
156
 
157
+ self.model.set_model_group(model_group)
158
+
156
159
  self.user_data: Dict[str, Any] = {}
157
160
 
158
161
  self.model.set_suppress_output(False)
@@ -197,7 +200,7 @@ class Agent:
197
200
  summary_prompt if summary_prompt else DEFAULT_SUMMARY_PROMPT
198
201
  )
199
202
 
200
- self.max_token_count = get_max_token_count()
203
+ self.max_token_count = get_max_token_count(model_group)
201
204
  self.auto_complete = auto_complete
202
205
  welcome_message = f"{name} 初始化完成 - 使用 {self.model.name()} 模型"
203
206
 
@@ -125,6 +125,11 @@ def _parse_args() -> argparse.Namespace:
125
125
  type=str,
126
126
  help="Directly input task content from command line",
127
127
  )
128
+ parser.add_argument(
129
+ "--model_group",
130
+ type=str,
131
+ help="Model group to use, overriding config",
132
+ )
128
133
  parser.add_argument("-f", "--config", type=str, help="Path to custom config file")
129
134
  parser.add_argument(
130
135
  "--restore-session",
@@ -170,6 +175,7 @@ def _initialize_agent(args: argparse.Namespace) -> Agent:
170
175
  agent = Agent(
171
176
  system_prompt=origin_agent_system_prompt,
172
177
  llm_type=args.llm_type,
178
+ model_group=args.model_group,
173
179
  input_handler=[shell_input_handler, builtin_input_handler],
174
180
  output_handler=[ToolRegistry()], # type: ignore
175
181
  need_summary=False,
@@ -52,6 +52,11 @@ def main():
52
52
  choices=["normal", "thinking"],
53
53
  help="LLM type to use, overriding config",
54
54
  )
55
+ parser.add_argument(
56
+ "--model_group",
57
+ type=str,
58
+ help="Model group to use, overriding config",
59
+ )
55
60
  args = parser.parse_args()
56
61
 
57
62
  # Initialize environment
@@ -65,6 +70,8 @@ def main():
65
70
  # Override config with command-line arguments if provided
66
71
  if args.llm_type:
67
72
  config["llm_type"] = args.llm_type
73
+ if args.model_group:
74
+ config["model_group"] = args.model_group
68
75
 
69
76
  # Create and run agent
70
77
  try:
@@ -47,6 +47,7 @@ class CodeAgent:
47
47
  def __init__(
48
48
  self,
49
49
  llm_type: str = "normal",
50
+ model_group: Optional[str] = None,
50
51
  need_summary: bool = True,
51
52
  ):
52
53
  self.root_dir = os.getcwd()
@@ -120,6 +121,7 @@ class CodeAgent:
120
121
  auto_complete=False,
121
122
  output_handler=[tool_registry, EditFileHandler()], # type: ignore
122
123
  llm_type=llm_type,
124
+ model_group=model_group,
123
125
  input_handler=[shell_input_handler, builtin_input_handler],
124
126
  need_summary=need_summary,
125
127
  use_methodology=False, # 禁用方法论
@@ -411,6 +413,11 @@ def main() -> None:
411
413
  choices=["normal", "thinking"],
412
414
  help="LLM type to use",
413
415
  )
416
+ parser.add_argument(
417
+ "--model_group",
418
+ type=str,
419
+ help="Model group to use, overriding config",
420
+ )
414
421
  parser.add_argument(
415
422
  "-r", "--requirement", type=str, help="Requirement to process", default=None
416
423
  )
@@ -427,7 +434,11 @@ def main() -> None:
427
434
  PrettyOutput.print(f"当前目录: {git_dir}", OutputType.INFO)
428
435
 
429
436
  try:
430
- agent = CodeAgent(llm_type=args.llm_type, need_summary=False)
437
+ agent = CodeAgent(
438
+ llm_type=args.llm_type,
439
+ model_group=args.model_group,
440
+ need_summary=False,
441
+ )
431
442
 
432
443
  # 尝试恢复会话
433
444
  if args.restore_session:
@@ -3,12 +3,13 @@ import os
3
3
  import re
4
4
  import subprocess
5
5
  import tempfile
6
- from typing import Any, Dict, List
6
+ from typing import Any, Dict, List, Optional
7
7
 
8
8
  from jarvis.jarvis_agent import Agent
9
9
  from jarvis.jarvis_code_analysis.checklists.loader import get_language_checklist
10
10
  from jarvis.jarvis_platform.registry import PlatformRegistry
11
11
  from jarvis.jarvis_tools.read_code import ReadCodeTool
12
+ from jarvis.jarvis_utils.globals import get_agent, current_agent_name
12
13
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
13
14
  from jarvis.jarvis_utils.tag import ct, ot
14
15
  from jarvis.jarvis_utils.utils import init_env, is_context_overflow
@@ -261,7 +262,9 @@ class CodeReviewTool:
261
262
  checklist = get_language_checklist(language)
262
263
  return checklist if checklist else ""
263
264
 
264
- def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
265
+ def execute(
266
+ self, args: Dict[str, Any], agent: Optional["Agent"] = None
267
+ ) -> Dict[str, Any]:
265
268
  try:
266
269
  review_type = args.get("review_type", "current").strip()
267
270
  root_dir = args.get("root_dir", ".")
@@ -570,9 +573,17 @@ class CodeReviewTool:
570
573
 
571
574
  tool_registry = ToolRegistry()
572
575
  tool_registry.dont_use_tools(["code_review"])
576
+
577
+ # Use the provided agent's model_group or get it from globals
578
+ calling_agent = agent or get_agent(current_agent_name)
579
+ model_group = None
580
+ if calling_agent and hasattr(calling_agent, "model") and calling_agent.model:
581
+ model_group = calling_agent.model.model_group
582
+
573
583
  agent = Agent(
574
584
  system_prompt=system_prompt,
575
585
  name="Code Review Agent",
586
+ model_group=model_group,
576
587
  summary_prompt=f"""<code_review_report>
577
588
  <overview>
578
589
  # 整体评估
@@ -675,7 +686,7 @@ class CodeReviewTool:
675
686
 
676
687
  try:
677
688
  # Check if content is too large
678
- is_large_content = is_context_overflow(diff_output)
689
+ is_large_content = is_context_overflow(diff_output, model_group)
679
690
 
680
691
  # Upload the file to the agent's model
681
692
  if is_large_content:
@@ -141,6 +141,47 @@
141
141
  "description": "思考操作模型名称",
142
142
  "default": "deep_seek"
143
143
  },
144
+ "JARVIS_MODEL_GROUP": {
145
+ "type": "string",
146
+ "description": "选择一个预定义的模型组"
147
+ },
148
+ "JARVIS_MODEL_GROUPS": {
149
+ "type": "array",
150
+ "description": "预定义的模型配置组",
151
+ "items": {
152
+ "type": "object",
153
+ "additionalProperties": {
154
+ "type": "object",
155
+ "properties": {
156
+ "JARVIS_PLATFORM": {
157
+ "type": "string"
158
+ },
159
+ "JARVIS_MODEL": {
160
+ "type": "string"
161
+ },
162
+ "JARVIS_THINKING_PLATFORM": {
163
+ "type": "string"
164
+ },
165
+ "JARVIS_THINKING_MODEL": {
166
+ "type": "string"
167
+ },
168
+ "JARVIS_MAX_TOKEN_COUNT": {
169
+ "type": "number"
170
+ },
171
+ "JARVIS_MAX_INPUT_TOKEN_COUNT": {
172
+ "type": "number"
173
+ },
174
+ "JARVIS_MAX_BIG_CONTENT_SIZE": {
175
+ "type": "number"
176
+ }
177
+ },
178
+ "required": [
179
+ "JARVIS_PLATFORM",
180
+ "JARVIS_MODEL"
181
+ ]
182
+ }
183
+ }
184
+ },
144
185
  "JARVIS_EXECUTE_TOOL_CONFIRM": {
145
186
  "type": "boolean",
146
187
  "description": "执行工具前是否需要确认",
@@ -16,6 +16,7 @@ from jarvis.jarvis_utils.git_utils import (
16
16
  find_git_root_and_cd,
17
17
  has_uncommitted_changes,
18
18
  )
19
+ from jarvis.jarvis_utils.globals import get_agent, current_agent_name
19
20
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
20
21
  from jarvis.jarvis_utils.tag import ct, ot
21
22
  from jarvis.jarvis_utils.utils import init_env, is_context_overflow
@@ -162,11 +163,17 @@ commit信息
162
163
  """
163
164
 
164
165
  # 获取模型并尝试上传文件
165
- platform = PlatformRegistry().get_normal_platform()
166
+ agent = get_agent(current_agent_name)
167
+ if agent:
168
+ platform = agent.model
169
+ model_group = agent.model.model_group
170
+ else:
171
+ platform = PlatformRegistry().get_normal_platform()
172
+ model_group = None
166
173
  upload_success = False
167
174
 
168
175
  # Check if content is too large
169
- is_large_content = is_context_overflow(diff)
176
+ is_large_content = is_context_overflow(diff, model_group)
170
177
 
171
178
  if is_large_content:
172
179
  if not platform.support_upload_files():
@@ -2,7 +2,7 @@
2
2
  import json
3
3
  import threading
4
4
  import time
5
- from typing import Any, Callable, Dict, List
5
+ from typing import Any, Callable, Dict, List, Optional
6
6
  from urllib.parse import parse_qs, urlencode, urljoin
7
7
 
8
8
  import requests
@@ -46,10 +46,10 @@ class SSEMcpClient(McpClient):
46
46
  self.session.headers.update(extra_headers)
47
47
 
48
48
  # SSE相关属性
49
- self.sse_response = None
50
- self.sse_thread = None
51
- self.messages_endpoint = None
52
- self.session_id = None # 从SSE连接获取的会话ID
49
+ self.sse_response: Optional[requests.Response] = None
50
+ self.sse_thread: Optional[threading.Thread] = None
51
+ self.messages_endpoint: Optional[str] = None
52
+ self.session_id: Optional[str] = None
53
53
  self.pending_requests = {} # 存储等待响应的请求 {id: Event}
54
54
  self.request_results = {} # 存储请求结果 {id: result}
55
55
  self.notification_handlers = {}
@@ -123,13 +123,15 @@ class SSEMcpClient(McpClient):
123
123
  self.sse_response = self.session.get(
124
124
  sse_url, stream=True, headers=sse_headers, timeout=30
125
125
  )
126
- self.sse_response.raise_for_status()
126
+ if self.sse_response:
127
+ self.sse_response.raise_for_status()
127
128
 
128
129
  # 启动事件处理线程
129
130
  self.sse_thread = threading.Thread(
130
131
  target=self._process_sse_events, daemon=True
131
132
  )
132
- self.sse_thread.start()
133
+ if self.sse_thread:
134
+ self.sse_thread.start()
133
135
 
134
136
  except Exception as e:
135
137
  PrettyOutput.print(f"SSE连接失败: {str(e)}", OutputType.ERROR)
@@ -2,7 +2,7 @@
2
2
  import json
3
3
  import os
4
4
  import subprocess
5
- from typing import Any, Dict, List
5
+ from typing import Any, Dict, List, Optional
6
6
 
7
7
  from jarvis.jarvis_mcp import McpClient
8
8
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
@@ -17,7 +17,7 @@ class StdioMcpClient(McpClient):
17
17
 
18
18
  def __init__(self, config: Dict[str, Any]):
19
19
  self.config = config
20
- self.process = None
20
+ self.process: Optional[subprocess.Popen] = None
21
21
  self.protocol_version = "2025-03-26" # MCP协议版本
22
22
  self._start_process()
23
23
  self._initialize()
@@ -1,7 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import re
3
3
  from abc import ABC, abstractmethod
4
- from typing import Generator, List, Tuple
4
+ from types import TracebackType
5
+ from typing import Generator, List, Optional, Tuple, Type
6
+
7
+ from typing_extensions import Self
5
8
 
6
9
  from rich import box # type: ignore
7
10
  from rich.live import Live # type: ignore
@@ -28,9 +31,19 @@ class BasePlatform(ABC):
28
31
  self.suppress_output = True # 添加输出控制标志
29
32
  self.web = False # 添加web属性,默认false
30
33
  self._saved = False
31
-
32
- def __del__(self):
33
- """Destroy model"""
34
+ self.model_group: Optional[str] = None
35
+
36
+ def __enter__(self) -> Self:
37
+ """Enter context manager"""
38
+ return self
39
+
40
+ def __exit__(
41
+ self,
42
+ exc_type: Optional[Type[BaseException]],
43
+ exc_val: Optional[BaseException],
44
+ exc_tb: Optional[TracebackType],
45
+ ) -> None:
46
+ """Exit context manager"""
34
47
  if not self._saved:
35
48
  self.delete_chat()
36
49
 
@@ -64,9 +77,11 @@ class BasePlatform(ABC):
64
77
 
65
78
  input_token_count = get_context_token_count(message)
66
79
 
67
- if input_token_count > get_max_input_token_count():
68
- max_chunk_size = get_max_input_token_count() - 1024 # 留出一些余量
69
- min_chunk_size = get_max_input_token_count() - 2048
80
+ if input_token_count > get_max_input_token_count(self.model_group):
81
+ max_chunk_size = (
82
+ get_max_input_token_count(self.model_group) - 1024
83
+ ) # 留出一些余量
84
+ min_chunk_size = get_max_input_token_count(self.model_group) - 2048
70
85
  inputs = split_text_into_chunks(message, max_chunk_size, min_chunk_size)
71
86
  print("📤 正在提交长上下文...")
72
87
  prefix_prompt = f"""
@@ -95,14 +110,10 @@ class BasePlatform(ABC):
95
110
  ):
96
111
  response += trunk
97
112
 
98
- print(
99
- f"📤 提交第{submit_count}部分完成,当前进度:{length}/{len(message)}"
100
- )
113
+ print(f"📤 提交第{submit_count}部分完成,当前进度:{length}/{len(message)}")
101
114
  print("✅ 提交完成")
102
115
  response += "\n" + while_true(
103
- lambda: while_success(
104
- lambda: self._chat("内容已经全部提供完毕,请根据内容继续"), 5
105
- ),
116
+ lambda: while_success(lambda: self._chat("内容已经全部提供完毕,请根据内容继续"), 5),
106
117
  5,
107
118
  )
108
119
  else:
@@ -233,6 +244,10 @@ class BasePlatform(ABC):
233
244
  """Set whether to suppress output"""
234
245
  self.suppress_output = suppress
235
246
 
247
+ def set_model_group(self, model_group: Optional[str]):
248
+ """Set model group"""
249
+ self.model_group = model_group
250
+
236
251
  def set_web(self, web: bool):
237
252
  """Set web flag"""
238
253
  self.web = web
@@ -12,6 +12,7 @@ class generate_new_tool:
12
12
  生成并注册新的Jarvis工具。该工具会在用户数据目录下创建新的工具文件,
13
13
  并自动注册到当前的工具注册表中。适用场景:1. 需要创建新的自定义工具;
14
14
  2. 扩展Jarvis功能;3. 自动化重复性操作;4. 封装特定领域的功能。
15
+ 重要提示:在编写工具代码时,应尽量将工具执行的过程和结果打印出来,方便追踪工具的执行状态。
15
16
  """
16
17
 
17
18
  parameters = {
@@ -17,7 +17,7 @@ from jarvis.jarvis_tools.base import Tool
17
17
  from jarvis.jarvis_utils.config import get_data_dir, get_tool_load_dirs
18
18
  from jarvis.jarvis_utils.output import OutputType, PrettyOutput
19
19
  from jarvis.jarvis_utils.tag import ct, ot
20
- from jarvis.jarvis_utils.utils import is_context_overflow
20
+ from jarvis.jarvis_utils.utils import is_context_overflow, daily_check_git_updates
21
21
 
22
22
  tool_call_help = f"""
23
23
  <tool_system_guide>
@@ -124,7 +124,7 @@ class ToolRegistry(OutputHandlerProtocol):
124
124
  """加载工具"""
125
125
  tools = self.get_all_tools()
126
126
  if tools:
127
- tools_prompt = "<tools_section>\n"
127
+ tools_prompt = f"{tool_call_help}\n<tools_section>\n"
128
128
  tools_prompt += " <header>## 可用工具:</header>\n"
129
129
  tools_prompt += " <tools_list>\n"
130
130
  for tool in tools:
@@ -287,16 +287,18 @@ class ToolRegistry(OutputHandlerProtocol):
287
287
 
288
288
  def _load_external_tools(self) -> None:
289
289
  """从jarvis_data/tools和配置的目录加载外部工具"""
290
- tool_dirs = [Path(get_data_dir()) / "tools"] + [
291
- Path(p) for p in get_tool_load_dirs()
292
- ]
290
+ tool_dirs = [str(Path(get_data_dir()) / "tools")] + get_tool_load_dirs()
291
+
292
+ # --- 全局每日更新检查 ---
293
+ daily_check_git_updates(tool_dirs, "tools")
293
294
 
294
295
  for tool_dir in tool_dirs:
295
- if not tool_dir.exists():
296
+ p_tool_dir = Path(tool_dir)
297
+ if not p_tool_dir.exists() or not p_tool_dir.is_dir():
296
298
  continue
297
299
 
298
300
  # 遍历目录中的所有.py文件
299
- for file_path in tool_dir.glob("*.py"):
301
+ for file_path in p_tool_dir.glob("*.py"):
300
302
  # 跳过__init__.py
301
303
  if file_path.name == "__init__.py":
302
304
  continue
@@ -717,7 +719,10 @@ class ToolRegistry(OutputHandlerProtocol):
717
719
  )
718
720
 
719
721
  # 检查内容是否过大
720
- is_large_content = is_context_overflow(output)
722
+ model_group = None
723
+ if agent_instance.model:
724
+ model_group = agent_instance.model.model_group
725
+ is_large_content = is_context_overflow(output, model_group)
721
726
 
722
727
  if is_large_content:
723
728
  # 创建临时文件