jarvis-ai-assistant 0.1.175__py3-none-any.whl → 0.1.177__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/__init__.py +22 -35
- jarvis/jarvis_agent/jarvis.py +14 -12
- jarvis/jarvis_agent/main.py +6 -6
- jarvis/jarvis_code_agent/code_agent.py +10 -8
- jarvis/jarvis_code_analysis/code_review.py +1 -1
- jarvis/jarvis_dev/main.py +1 -1
- jarvis/jarvis_git_details/main.py +1 -1
- jarvis/jarvis_git_squash/main.py +1 -1
- jarvis/jarvis_git_utils/git_commiter.py +1 -1
- jarvis/jarvis_multi_agent/main.py +1 -1
- jarvis/jarvis_platform/base.py +53 -32
- jarvis/jarvis_platform/human.py +4 -3
- jarvis/jarvis_platform/kimi.py +22 -170
- jarvis/jarvis_platform/openai.py +8 -30
- jarvis/jarvis_platform/yuanbao.py +35 -83
- jarvis/jarvis_platform_manager/main.py +1 -1
- jarvis/jarvis_smart_shell/main.py +4 -2
- jarvis/jarvis_tools/ask_codebase.py +8 -2
- jarvis/jarvis_tools/cli/main.py +28 -1
- jarvis/jarvis_tools/edit_file.py +163 -103
- jarvis/jarvis_tools/read_code.py +0 -2
- jarvis/jarvis_tools/registry.py +30 -0
- jarvis/jarvis_utils/config.py +12 -3
- jarvis/jarvis_utils/embedding.py +1 -10
- jarvis/jarvis_utils/output.py +78 -41
- jarvis/jarvis_utils/utils.py +19 -1
- {jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/METADATA +5 -4
- {jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/RECORD +33 -34
- {jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/WHEEL +1 -1
- jarvis/jarvis_agent/file_input_handler.py +0 -108
- {jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-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.
|
|
3
|
+
Version: 0.1.177
|
|
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
|
|
@@ -201,7 +201,7 @@ OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
|
|
|
201
201
|
### 环境变量配置
|
|
202
202
|
| 变量名称 | 默认值 | 说明 |
|
|
203
203
|
|----------|--------|------|
|
|
204
|
-
| `JARVIS_MAX_TOKEN_COUNT` |
|
|
204
|
+
| `JARVIS_MAX_TOKEN_COUNT` | 960000 | 上下文窗口的最大token数量 |
|
|
205
205
|
| `JARVIS_MAX_INPUT_TOKEN_COUNT` | 32000 | 输入的最大token数量 |
|
|
206
206
|
| `JARVIS_AUTO_COMPLETE` | false | 是否启用自动完成功能(任务判定完成的时候会自动终止) |
|
|
207
207
|
| `JARVIS_SHELL_NAME` | bash | 系统shell名称 |
|
|
@@ -211,9 +211,10 @@ OPENAI_API_BASE=https://api.openai.com/v1 # 可选,默认为官方API地址
|
|
|
211
211
|
| `JARVIS_THINKING_MODEL` | JARVIS_MODEL | 推理任务使用的模型 |
|
|
212
212
|
| `JARVIS_EXECUTE_TOOL_CONFIRM` | false | 执行工具前是否需要确认 |
|
|
213
213
|
| `JARVIS_CONFIRM_BEFORE_APPLY_PATCH` | true | 应用补丁前是否需要确认 |
|
|
214
|
-
| `JARVIS_MAX_TOOL_CALL_COUNT` | 20 |
|
|
214
|
+
| `JARVIS_MAX_TOOL_CALL_COUNT` | 20 | 最大连续工具调用次数,如果是0表示无限制 |
|
|
215
215
|
| `JARVIS_AUTO_UPDATE` | true | 是否自动更新Jarvis(仅在以git仓库方式安装时有效) |
|
|
216
|
-
| `JARVIS_MAX_BIG_CONTENT_SIZE` |
|
|
216
|
+
| `JARVIS_MAX_BIG_CONTENT_SIZE` | 1024000 | 最大大内容大小 |
|
|
217
|
+
| `JARVIS_PRETTY_OUTPUT` | false | 是否启用PrettyOutput |
|
|
217
218
|
|
|
218
219
|
所有配置编写到`~/.jarvis/env`文件中即可生效。
|
|
219
220
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
jarvis/__init__.py,sha256=
|
|
2
|
-
jarvis/jarvis_agent/__init__.py,sha256=
|
|
1
|
+
jarvis/__init__.py,sha256=0MngHgwvNC88-Zyu-Vgu75cfUiHVHhf7dT3ntn_mOvQ,74
|
|
2
|
+
jarvis/jarvis_agent/__init__.py,sha256=sDUOtM7Y-BQt2WBavx2bV5OkHD_iMGV32FfSu4IEa3s,29175
|
|
3
3
|
jarvis/jarvis_agent/builtin_input_handler.py,sha256=KhvlV_QdB3P-M0TCkWvdxidNie1jU7KoMOqTIXCpwwA,1529
|
|
4
|
-
jarvis/jarvis_agent/
|
|
5
|
-
jarvis/jarvis_agent/
|
|
6
|
-
jarvis/jarvis_agent/main.py,sha256=IAD59fEMWWSSAtHJhOQMPs_NMoKtcYjrxlTvhCHEVII,2626
|
|
4
|
+
jarvis/jarvis_agent/jarvis.py,sha256=h3-FsL9Y4GtbNPk6qWYs2t6VB8CKabY7_UNe58tzucE,6142
|
|
5
|
+
jarvis/jarvis_agent/main.py,sha256=jvxnBmm4BM13quaCip2PC1-DkAX0MAU25b8nhHIQ5xM,2667
|
|
7
6
|
jarvis/jarvis_agent/output_handler.py,sha256=7qori-RGrQmdiFepoEe3oPPKJIvRt90l_JDmvCoa4zA,1219
|
|
8
7
|
jarvis/jarvis_agent/shell_input_handler.py,sha256=pi3AtPKrkKc6K9e99S1djKXQ_XrxtP6FrSWebQmRT6E,1261
|
|
9
8
|
jarvis/jarvis_code_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
jarvis/jarvis_code_agent/code_agent.py,sha256=
|
|
11
|
-
jarvis/jarvis_code_analysis/code_review.py,sha256=
|
|
9
|
+
jarvis/jarvis_code_agent/code_agent.py,sha256=9SBMlLWNGR6lqVD7xZaLjokka-yoNGb-OxpHtJjCf_k,17166
|
|
10
|
+
jarvis/jarvis_code_analysis/code_review.py,sha256=9zfVY_u_WSRIKQ69lXeW-pOunh5lYYyQe9i_zEO3m2k,30212
|
|
12
11
|
jarvis/jarvis_code_analysis/checklists/__init__.py,sha256=cKQ_FOGy5TQgM-YkRCqORo-mUOZaPAJ9VDmZoFX58us,78
|
|
13
12
|
jarvis/jarvis_code_analysis/checklists/c_cpp.py,sha256=SXPpYCNeCtU1PpKdKPiYDuOybfY9vaL0ejDn4imxDwA,1317
|
|
14
13
|
jarvis/jarvis_code_analysis/checklists/csharp.py,sha256=vS-cu6RCGg5SyK9MJ3RE381gt3xYl-yea3Bj2UQEcwQ,2420
|
|
@@ -30,12 +29,12 @@ jarvis/jarvis_code_analysis/checklists/sql.py,sha256=ecKKT6wJAibn8R0NxGZDNlm4teY
|
|
|
30
29
|
jarvis/jarvis_code_analysis/checklists/swift.py,sha256=YcsYFxAitHqOtBZjG-RV9-KNM7X5lIcl6zlEI9XfmfM,2566
|
|
31
30
|
jarvis/jarvis_code_analysis/checklists/web.py,sha256=-Pnj1FQTsGVZUQK7-4ptDsGd7a22Cs0585jRAPT2SdQ,3943
|
|
32
31
|
jarvis/jarvis_data/huggingface.tar.gz,sha256=dWKnc_tvyx-I_ZkXo91O0b38KxDmLW1ZbmJ3E6fCl_k,1120205
|
|
33
|
-
jarvis/jarvis_dev/main.py,sha256=
|
|
32
|
+
jarvis/jarvis_dev/main.py,sha256=kyCLm2Ta-iMK20m62O7_rB-Biy_bGxpqrLrLtMOkT5c,43022
|
|
34
33
|
jarvis/jarvis_git_details/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
-
jarvis/jarvis_git_details/main.py,sha256=
|
|
34
|
+
jarvis/jarvis_git_details/main.py,sha256=lYx2tSaV1cKCvs3iRf-gHwotg-sljvxC4iPeODpBnbA,9007
|
|
36
35
|
jarvis/jarvis_git_squash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
-
jarvis/jarvis_git_squash/main.py,sha256=
|
|
38
|
-
jarvis/jarvis_git_utils/git_commiter.py,sha256=
|
|
36
|
+
jarvis/jarvis_git_squash/main.py,sha256=nGygczZlRbczKAU8LEFLHQVjpgCkbGx7GQQcwo57cSo,2276
|
|
37
|
+
jarvis/jarvis_git_utils/git_commiter.py,sha256=58ZhxwDdYzMH9-uvVe2dazQfq8uNcZTJQq7SMJEFsic,13020
|
|
39
38
|
jarvis/jarvis_lsp/base.py,sha256=ZngrQ4NUy9iPrXORcw4QR-tWZi2G79nsfqeqqkaxSZ0,2054
|
|
40
39
|
jarvis/jarvis_lsp/cpp.py,sha256=WL7rItrwFkYRSZzQHnoOoQ-EDho7Jd6BOaCn1UgsQ3A,3165
|
|
41
40
|
jarvis/jarvis_lsp/go.py,sha256=FkBJAeJex8jamn44o_cpYCygSTGMnsykJGrnkVFlTww,3482
|
|
@@ -47,27 +46,27 @@ jarvis/jarvis_mcp/sse_mcp_client.py,sha256=FOVzroTw-pifmnF0qdsoQ6KweDCQ0Gxs6d6jl
|
|
|
47
46
|
jarvis/jarvis_mcp/stdio_mcp_client.py,sha256=KO0ewJuLBZLNqG4EGJcBOtn-8VJIipkq84ENvSwgQAo,11830
|
|
48
47
|
jarvis/jarvis_methodology/main.py,sha256=QJUMIb9o8JO-l207X5UIbazZKJYKG3F4iuUKtkm0dmg,11840
|
|
49
48
|
jarvis/jarvis_multi_agent/__init__.py,sha256=Xab5sFltJmX_9MoXqanmZs6FqKfUb2v_pG29Vk8ZXaw,4311
|
|
50
|
-
jarvis/jarvis_multi_agent/main.py,sha256=
|
|
49
|
+
jarvis/jarvis_multi_agent/main.py,sha256=Ax3Oe0mjcW567VhFYPt3H5MwqLS1VdxKCeiNgXltmXk,1644
|
|
51
50
|
jarvis/jarvis_platform/__init__.py,sha256=0YnsUoM4JkIBOtImFdjfuDbrqQZT3dEaAwSJ62DrpCc,104
|
|
52
|
-
jarvis/jarvis_platform/base.py,sha256=
|
|
53
|
-
jarvis/jarvis_platform/human.py,sha256=
|
|
54
|
-
jarvis/jarvis_platform/kimi.py,sha256=
|
|
55
|
-
jarvis/jarvis_platform/openai.py,sha256=
|
|
51
|
+
jarvis/jarvis_platform/base.py,sha256=ioIEtuEVuXCdLpPofR9c-lqvADM-pCz5XOMQVKq8xeI,6740
|
|
52
|
+
jarvis/jarvis_platform/human.py,sha256=1Jh9xigQaU78WVvsIMaVH0i6QRhaSA1oaErv9BdntF8,2565
|
|
53
|
+
jarvis/jarvis_platform/kimi.py,sha256=p18Ydb_0rgnK3-WZXKUtTBQTh7Da33O277PKWOMqBhA,13106
|
|
54
|
+
jarvis/jarvis_platform/openai.py,sha256=ln-OYxZkWaSY9oDoBPMmMh2TDGN40iTtUURLk8batvQ,4159
|
|
56
55
|
jarvis/jarvis_platform/registry.py,sha256=UjCdPT9WIRxU-F0uuPpKmKRRCcNNxjr-bRTEPgRSNx4,7740
|
|
57
|
-
jarvis/jarvis_platform/yuanbao.py,sha256=
|
|
56
|
+
jarvis/jarvis_platform/yuanbao.py,sha256=Vi8D3lhTOwg2-PmMj7HHRXKg-dViI2ghtJcxm3tf8nc,21669
|
|
58
57
|
jarvis/jarvis_platform_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
-
jarvis/jarvis_platform_manager/main.py,sha256=
|
|
58
|
+
jarvis/jarvis_platform_manager/main.py,sha256=cpnqYWjb2fU2uhrTtYyyrKpe6rta2NniYjZE6BjLG8k,25675
|
|
60
59
|
jarvis/jarvis_smart_shell/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
|
-
jarvis/jarvis_smart_shell/main.py,sha256=
|
|
60
|
+
jarvis/jarvis_smart_shell/main.py,sha256=v3DXutU-lBYABxB1tURHPcdTJuoT3gthdXl8O5tOGJw,5208
|
|
62
61
|
jarvis/jarvis_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
|
-
jarvis/jarvis_tools/ask_codebase.py,sha256=
|
|
62
|
+
jarvis/jarvis_tools/ask_codebase.py,sha256=bdYZlEdKGFQjYL90Qo3ybgxicFPU8g3mQtLH8exmliU,10063
|
|
64
63
|
jarvis/jarvis_tools/ask_user.py,sha256=cWSLG33b79IbIZEWsSNV5RHvGX6eo3nTM8TUhOMnGh8,2167
|
|
65
64
|
jarvis/jarvis_tools/base.py,sha256=SR4dmrgYj3lNmtVDhHtItPvptTqCfw5SGRhgPT3I6ss,1189
|
|
66
65
|
jarvis/jarvis_tools/chdir.py,sha256=wYVBqWF5kaUkKqH3cUAOKUsACzYsFtCCJJyd8UJsp4o,2706
|
|
67
66
|
jarvis/jarvis_tools/code_plan.py,sha256=EzLdbJnVCkJ7lL8XIQyuDJdxU1i3CFiBpqyNG-GdJw8,7753
|
|
68
67
|
jarvis/jarvis_tools/create_code_agent.py,sha256=cxYkjr4rhI2EWpK78psZSRB9mxiP1IUT0SEfFIqCJzY,3411
|
|
69
68
|
jarvis/jarvis_tools/create_sub_agent.py,sha256=ppTOFRd0ygSJUFr3oQ8IrCLOqbZ7vwnbdadfTDjpDgs,3025
|
|
70
|
-
jarvis/jarvis_tools/edit_file.py,sha256=
|
|
69
|
+
jarvis/jarvis_tools/edit_file.py,sha256=EqyLcnLNqFAhIn3g_wZs78qeGFPJh4Rieldbt5l4FHY,16226
|
|
71
70
|
jarvis/jarvis_tools/execute_script.py,sha256=cc0NlPwhkZinEexqT63d1ofEkzQddVWGsZOCVL1v_60,5739
|
|
72
71
|
jarvis/jarvis_tools/file_analyzer.py,sha256=tzU1cPKyDa54hVZewP0bDzdsjvdjGQ1BRt5k8N4li3s,4868
|
|
73
72
|
jarvis/jarvis_tools/file_operation.py,sha256=lP8EpsnSdA3FW8ofSAdoA8qPGMAG3UhYd6LFEzOFUVY,9044
|
|
@@ -75,29 +74,29 @@ jarvis/jarvis_tools/find_methodology.py,sha256=FwGKSV4fHNkiAnaVUwP8GkqXl8PEqMPZB
|
|
|
75
74
|
jarvis/jarvis_tools/generate_new_tool.py,sha256=ctpkHBihsHhO6sLpF5lJue244EFJtdEQMuxR-_oV9r4,10282
|
|
76
75
|
jarvis/jarvis_tools/lsp_get_diagnostics.py,sha256=paz1CVZ2Y8nk0U74n1QiG01oDINiZqpVlPc2f4_B150,5346
|
|
77
76
|
jarvis/jarvis_tools/methodology.py,sha256=Md8W2et0xUiuTjUSRCdnlwEPYqah2dCAAkxW_95BXBY,5238
|
|
78
|
-
jarvis/jarvis_tools/read_code.py,sha256=
|
|
77
|
+
jarvis/jarvis_tools/read_code.py,sha256=dOG7bafutOhjLiU7NH-o7E_o6pJrXH98SAGRJ36Yj9Q,5897
|
|
79
78
|
jarvis/jarvis_tools/read_webpage.py,sha256=LLvAOvaQJodaeNJKQ6dU9MYEE227NMdHyLs7esluUQ4,2217
|
|
80
|
-
jarvis/jarvis_tools/registry.py,sha256=
|
|
79
|
+
jarvis/jarvis_tools/registry.py,sha256=ISgelm0E1mNj0bikJxN9fA1VGzm23pVkWv-j7E3gWHY,23792
|
|
81
80
|
jarvis/jarvis_tools/rewrite_file.py,sha256=rEPPSNU7uF1iKfEW9npEpZJ2LSoQXjt2OC-_troBToE,7003
|
|
82
81
|
jarvis/jarvis_tools/search_web.py,sha256=-h1WYOqTcYC_8fdkm-4RfwKpbtLTVxOfRROul51NgO0,951
|
|
83
82
|
jarvis/jarvis_tools/virtual_tty.py,sha256=AKAaKY5KcPxifNQoXjzHaL4U6EUVA7irHLwVvz2wLVs,16396
|
|
84
83
|
jarvis/jarvis_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
85
|
-
jarvis/jarvis_tools/cli/main.py,sha256=
|
|
84
|
+
jarvis/jarvis_tools/cli/main.py,sha256=FkBUh7TgvZu6CZfQAKdu0zYm27fSfA6OK4H_m8h_4Mw,6354
|
|
86
85
|
jarvis/jarvis_utils/__init__.py,sha256=l-fsyQ-KzyqAhrJYur8eZAqsgaifGzSm24R2qtRGJ0g,849
|
|
87
86
|
jarvis/jarvis_utils/builtin_replace_map.py,sha256=A-cJ8deht2vDl2iKRhoZ7qECyJ6sboVH5Zx-L9vIBUs,4314
|
|
88
|
-
jarvis/jarvis_utils/config.py,sha256=
|
|
89
|
-
jarvis/jarvis_utils/embedding.py,sha256=
|
|
87
|
+
jarvis/jarvis_utils/config.py,sha256=CuumaSrwSaSdt_bJVqjuH3u45ZKafm7MQANqO5NZDXk,4756
|
|
88
|
+
jarvis/jarvis_utils/embedding.py,sha256=s7ze8-talEED9VXZm1QK5tPdfyj6sXJLP031tDkXeI4,3831
|
|
90
89
|
jarvis/jarvis_utils/file_processors.py,sha256=tSZSMJ4qCJ_lXI0dyLgJ0j5qEh6CDXDSVI7vQiFmcuQ,2976
|
|
91
90
|
jarvis/jarvis_utils/git_utils.py,sha256=MxhUcQ_gFUFyBxBiorEJ1wUk9a2TerFdq3-Z11FB-AE,11324
|
|
92
91
|
jarvis/jarvis_utils/globals.py,sha256=Zs0chxA_giYiolYvawFFpcnTWgCUnn6GEusAh42jbz8,2275
|
|
93
92
|
jarvis/jarvis_utils/input.py,sha256=qGf2q-yWhgT-OX-j_WYi7aZ11jYmuFNiMz2_W1nUOiM,7432
|
|
94
93
|
jarvis/jarvis_utils/methodology.py,sha256=9dmtj6Ei2CRUdQP9TA_xToqZPYcm5_DQovwnRkEShsA,8626
|
|
95
|
-
jarvis/jarvis_utils/output.py,sha256=
|
|
94
|
+
jarvis/jarvis_utils/output.py,sha256=jrZMPl4RGaw8i-IFN4JwkH3wB9QDl002Car5eENDE9c,9657
|
|
96
95
|
jarvis/jarvis_utils/tag.py,sha256=YJHmuedLb7_AiqvKQetHr4R1FxyzIh7HN0RRkWMmYbU,429
|
|
97
|
-
jarvis/jarvis_utils/utils.py,sha256=
|
|
98
|
-
jarvis_ai_assistant-0.1.
|
|
99
|
-
jarvis_ai_assistant-0.1.
|
|
100
|
-
jarvis_ai_assistant-0.1.
|
|
101
|
-
jarvis_ai_assistant-0.1.
|
|
102
|
-
jarvis_ai_assistant-0.1.
|
|
103
|
-
jarvis_ai_assistant-0.1.
|
|
96
|
+
jarvis/jarvis_utils/utils.py,sha256=yXSSQwgwho3MpQWvJN1uRvRPsFvkKqhvQrbDz3ZyyxU,5390
|
|
97
|
+
jarvis_ai_assistant-0.1.177.dist-info/licenses/LICENSE,sha256=AGgVgQmTqFvaztRtCAXsAMryUymB18gZif7_l2e1XOg,1063
|
|
98
|
+
jarvis_ai_assistant-0.1.177.dist-info/METADATA,sha256=Yt6Tjk7wG7gh0nyyRhYtMPu0-_pg0mTvcIlDrqOuT2g,14629
|
|
99
|
+
jarvis_ai_assistant-0.1.177.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
100
|
+
jarvis_ai_assistant-0.1.177.dist-info/entry_points.txt,sha256=rjj61tZ7ahLi1R-JkJmX-IzIPPHD8mnwDZap1CnMe2s,973
|
|
101
|
+
jarvis_ai_assistant-0.1.177.dist-info/top_level.txt,sha256=1BOxyWfzOP_ZXj8rVTDnNCJ92bBGB0rwq8N1PCpoMIs,7
|
|
102
|
+
jarvis_ai_assistant-0.1.177.dist-info/RECORD,,
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import os
|
|
5
|
-
import re
|
|
6
|
-
from typing import Any, Tuple
|
|
7
|
-
|
|
8
|
-
from yaspin import yaspin
|
|
9
|
-
|
|
10
|
-
from jarvis.jarvis_tools.file_operation import FileOperationTool
|
|
11
|
-
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
12
|
-
from jarvis.jarvis_utils.utils import is_context_overflow
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def file_input_handler(user_input: str, agent: Any) -> Tuple[str, bool]:
|
|
16
|
-
"""Process user input containing file references and read file contents.
|
|
17
|
-
|
|
18
|
-
Args:
|
|
19
|
-
user_input: Input string that may contain file references in format:
|
|
20
|
-
- 'file_path' (whole file)
|
|
21
|
-
- 'file_path:start_line,end_line' (line range)
|
|
22
|
-
- 'file_path:start_line:end_line' (alternative range format)
|
|
23
|
-
agent: Agent object for further processing (currently unused)
|
|
24
|
-
|
|
25
|
-
Returns:
|
|
26
|
-
Tuple[str, bool]:
|
|
27
|
-
- Processed prompt string with file contents prepended
|
|
28
|
-
- Boolean indicating if context overflow occurred
|
|
29
|
-
"""
|
|
30
|
-
prompt = user_input
|
|
31
|
-
files = []
|
|
32
|
-
|
|
33
|
-
file_refs = re.findall(r"'([^']+)'", user_input)
|
|
34
|
-
for ref in file_refs:
|
|
35
|
-
# Handle file:start,end or file:start:end format
|
|
36
|
-
if ':' in ref:
|
|
37
|
-
file_path, line_range = ref.split(':', 1)
|
|
38
|
-
# Initialize with default values
|
|
39
|
-
start_line = 1 # 1-based
|
|
40
|
-
end_line = -1
|
|
41
|
-
|
|
42
|
-
# Process line range if specified
|
|
43
|
-
if ',' in line_range or ':' in line_range:
|
|
44
|
-
try:
|
|
45
|
-
raw_start, raw_end = map(int, re.split(r'[,:]', line_range))
|
|
46
|
-
|
|
47
|
-
# Handle special values and Python-style negative indices
|
|
48
|
-
try:
|
|
49
|
-
with open(file_path, 'r', encoding='utf-8', errors="ignore") as f:
|
|
50
|
-
total_lines = len(f.readlines())
|
|
51
|
-
except FileNotFoundError:
|
|
52
|
-
PrettyOutput.print(f"文件不存在: {file_path}", OutputType.WARNING)
|
|
53
|
-
continue
|
|
54
|
-
# Process start line (0 means whole file, negative means from end)
|
|
55
|
-
if raw_start == 0: # 0表示整个文件
|
|
56
|
-
start_line = 1
|
|
57
|
-
end_line = total_lines
|
|
58
|
-
else:
|
|
59
|
-
start_line = raw_start if raw_start > 0 else total_lines + raw_start + 1
|
|
60
|
-
|
|
61
|
-
# Process end line
|
|
62
|
-
if raw_end == 0: # 0表示整个文件(如果start也是0)
|
|
63
|
-
end_line = total_lines
|
|
64
|
-
else:
|
|
65
|
-
end_line = raw_end if raw_end > 0 else total_lines + raw_end + 1
|
|
66
|
-
|
|
67
|
-
# Auto-correct ranges
|
|
68
|
-
start_line = max(1, min(start_line, total_lines))
|
|
69
|
-
end_line = max(start_line, min(end_line, total_lines))
|
|
70
|
-
|
|
71
|
-
# Final validation
|
|
72
|
-
if start_line < 1 or end_line > total_lines or start_line > end_line:
|
|
73
|
-
raise ValueError
|
|
74
|
-
|
|
75
|
-
except:
|
|
76
|
-
continue
|
|
77
|
-
|
|
78
|
-
# Add file if it exists
|
|
79
|
-
if os.path.isfile(file_path):
|
|
80
|
-
files.append({
|
|
81
|
-
"path": file_path,
|
|
82
|
-
"start_line": start_line,
|
|
83
|
-
"end_line": end_line
|
|
84
|
-
})
|
|
85
|
-
else:
|
|
86
|
-
# Handle simple file path
|
|
87
|
-
if os.path.isfile(ref):
|
|
88
|
-
files.append({
|
|
89
|
-
"path": ref,
|
|
90
|
-
"start_line": 1, # 1-based
|
|
91
|
-
"end_line": -1
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
# Read and process files if any were found
|
|
95
|
-
if files:
|
|
96
|
-
with yaspin(text="正在读取文件...", color="cyan") as spinner:
|
|
97
|
-
old_prompt = prompt
|
|
98
|
-
result = FileOperationTool().execute({"operation":"read","files": files})
|
|
99
|
-
if result["success"]:
|
|
100
|
-
spinner.text = "文件读取完成"
|
|
101
|
-
spinner.ok("✅")
|
|
102
|
-
# Prepend file contents to prompt and check for overflow
|
|
103
|
-
prompt = result["stdout"] + "\n" + prompt
|
|
104
|
-
if is_context_overflow(prompt):
|
|
105
|
-
return old_prompt, False
|
|
106
|
-
|
|
107
|
-
return prompt, False
|
|
108
|
-
|
{jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{jarvis_ai_assistant-0.1.175.dist-info → jarvis_ai_assistant-0.1.177.dist-info}/top_level.txt
RENAMED
|
File without changes
|