auto-coder 0.1.246__py3-none-any.whl → 0.1.247__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 auto-coder might be problematic. Click here for more details.
- {auto_coder-0.1.246.dist-info → auto_coder-0.1.247.dist-info}/METADATA +1 -1
- {auto_coder-0.1.246.dist-info → auto_coder-0.1.247.dist-info}/RECORD +16 -16
- autocoder/auto_coder.py +2 -2
- autocoder/chat_auto_coder.py +22 -10
- autocoder/chat_auto_coder_lang.py +7 -1
- autocoder/common/auto_coder_lang.py +16 -8
- autocoder/common/code_auto_generate.py +1 -0
- autocoder/common/code_modification_ranker.py +8 -1
- autocoder/common/git_utils.py +4 -2
- autocoder/index/filter/quick_filter.py +41 -5
- autocoder/utils/auto_coder_utils/chat_stream_out.py +12 -9
- autocoder/version.py +1 -1
- {auto_coder-0.1.246.dist-info → auto_coder-0.1.247.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.246.dist-info → auto_coder-0.1.247.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.246.dist-info → auto_coder-0.1.247.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.246.dist-info → auto_coder-0.1.247.dist-info}/top_level.txt +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
autocoder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
autocoder/auto_coder.py,sha256=
|
|
2
|
+
autocoder/auto_coder.py,sha256=tElv9VAvv1hfb9qt8R9EFbXqhYs6pm89cy4mPIFFUQE,63127
|
|
3
3
|
autocoder/auto_coder_lang.py,sha256=Rtupq6N3_HT7JRhDKdgCBcwRaiAnyCOR_Gsp4jUomrI,3229
|
|
4
4
|
autocoder/auto_coder_rag.py,sha256=illKgzP2bv-Tq50ujsofJnOHdI4pzr0ALtfR8NHHWdQ,22351
|
|
5
5
|
autocoder/auto_coder_rag_client_mcp.py,sha256=WV7j5JUiQge0x4-B7Hp5-pSAFXLbvLpzQMcCovbauIM,6276
|
|
6
6
|
autocoder/auto_coder_rag_mcp.py,sha256=-RrjNwFaS2e5v8XDIrKR-zlUNUE8UBaeOtojffBrvJo,8521
|
|
7
7
|
autocoder/auto_coder_server.py,sha256=XU9b4SBH7zjPPXaTWWHV4_zJm-XYa6njuLQaplYJH_c,20290
|
|
8
8
|
autocoder/benchmark.py,sha256=Ypomkdzd1T3GE6dRICY3Hj547dZ6_inqJbBJIp5QMco,4423
|
|
9
|
-
autocoder/chat_auto_coder.py,sha256=
|
|
10
|
-
autocoder/chat_auto_coder_lang.py,sha256=
|
|
9
|
+
autocoder/chat_auto_coder.py,sha256=OUpoT-kUNoDS5VlO-Tui9zztd2ACyVa_kYQueBhb294,106724
|
|
10
|
+
autocoder/chat_auto_coder_lang.py,sha256=C0QJkyIhW-9aksHznrcATf0JdI1uKqOr46zW4RZ2ljA,15759
|
|
11
11
|
autocoder/command_args.py,sha256=9aYJ-AmPxP1sQh6ciw04FWHjSn31f2W9afXFwo8wgx4,30441
|
|
12
12
|
autocoder/lang.py,sha256=U6AjVV8Rs1uLyjFCZ8sT6WWuNUxMBqkXXIOs4S120uk,14511
|
|
13
13
|
autocoder/models.py,sha256=_9Kc8oS_tnnqKzRGnybgOfn1NOey7OXZ8y9qhBmgiB4,5517
|
|
14
|
-
autocoder/version.py,sha256=
|
|
14
|
+
autocoder/version.py,sha256=rZZLAPZf903zmHSN4JzYQtRLpVsQe-LUkE0nelZEb6g,23
|
|
15
15
|
autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
autocoder/agent/auto_demand_organizer.py,sha256=NWSAEsEk94vT3lGjfo25kKLMwYdPcpy9e-i21txPasQ,6942
|
|
17
17
|
autocoder/agent/auto_filegroup.py,sha256=CW7bqp0FW1GIEMnl-blyAc2UGT7O9Mom0q66ITz1ckM,6635
|
|
@@ -29,12 +29,12 @@ autocoder/common/__init__.py,sha256=2isE_u4VgfogwmcUCnFcussVFlzeNOLHDMFm5z_axbU,
|
|
|
29
29
|
autocoder/common/anything2images.py,sha256=0ILBbWzY02M-CiWB-vzuomb_J1hVdxRcenAfIrAXq9M,25283
|
|
30
30
|
autocoder/common/anything2img.py,sha256=4TREa-sOA-iargieUy7MpyCYVUE-9Mmq0wJtwomPqnE,7662
|
|
31
31
|
autocoder/common/audio.py,sha256=Kn9nWKQddWnUrAz0a_ZUgjcu4VUU_IcZBigT7n3N3qc,7439
|
|
32
|
-
autocoder/common/auto_coder_lang.py,sha256=
|
|
32
|
+
autocoder/common/auto_coder_lang.py,sha256=EBX8EVxoV6MxVFLYd_4kB7ZZyZN5akqBuG6A2jHeiX8,14912
|
|
33
33
|
autocoder/common/buildin_tokenizer.py,sha256=L7d5t39ZFvUd6EoMPXUhYK1toD0FHlRH1jtjKRGokWU,1236
|
|
34
34
|
autocoder/common/chunk_validation.py,sha256=BrR_ZWavW8IANuueEE7hS8NFAwEvm8TX34WnPx_1hs8,3030
|
|
35
35
|
autocoder/common/cleaner.py,sha256=NU72i8C6o9m0vXExab7nao5bstBUsfJFcj11cXa9l4U,1089
|
|
36
36
|
autocoder/common/code_auto_execute.py,sha256=4KXGmiGObr_B1d6tzV9dwS6MifCSc3Gm4j2d6ildBXQ,6867
|
|
37
|
-
autocoder/common/code_auto_generate.py,sha256=
|
|
37
|
+
autocoder/common/code_auto_generate.py,sha256=6rrtdEz8JhlKNutEqlWbgKUlACk90Lcm0UebtuAKEQ0,10320
|
|
38
38
|
autocoder/common/code_auto_generate_diff.py,sha256=o5yeqpc3WXSRWlcLzhlwJNosKo7dcj0CeIsFh6Aibus,16248
|
|
39
39
|
autocoder/common/code_auto_generate_editblock.py,sha256=QdUHUkGaervvQNCY8T2vQ_tfnQX_2kxxu4qq_QW_Nn8,17828
|
|
40
40
|
autocoder/common/code_auto_generate_strict_diff.py,sha256=uteWDEHfIbrnVgwKgqC7qwrIeW0enJCXcHzZGa48yY8,14774
|
|
@@ -42,13 +42,13 @@ autocoder/common/code_auto_merge.py,sha256=8dtnz61l0B5gNbQmx26TZ4_jD825dsnnWtAFD
|
|
|
42
42
|
autocoder/common/code_auto_merge_diff.py,sha256=yocfe8s3Pz6hTGDUl9wRIewY3NcTize_gEla64lsGT0,15331
|
|
43
43
|
autocoder/common/code_auto_merge_editblock.py,sha256=sp7C0fZJMVcNgI8uWy43CKDk7gGXFTkMB9kbP2VdY8k,17485
|
|
44
44
|
autocoder/common/code_auto_merge_strict_diff.py,sha256=9rm0NJ_n6M3LohEX7xl1Jym0xmm8UEYqj_ZTSO3oSlM,9519
|
|
45
|
-
autocoder/common/code_modification_ranker.py,sha256=
|
|
45
|
+
autocoder/common/code_modification_ranker.py,sha256=TycYdtxfNfde2N9-9jEB-9IL2Q3PoHS-k-r9JqZYD6s,6545
|
|
46
46
|
autocoder/common/command_completer.py,sha256=SSeb8MDH0JPvfdyW-S2uaHnui4VBDfSQvQPLbv3ORPA,9314
|
|
47
47
|
autocoder/common/command_generator.py,sha256=v4LmU7sO-P7jEZIXCWHUC6P-vT7AvBi_x_PTwCqBAE8,1323
|
|
48
48
|
autocoder/common/command_templates.py,sha256=mnB3n8i0yjH1mqzyClEg8Wpr9VbZV44kxky66Zu6OJY,8557
|
|
49
49
|
autocoder/common/const.py,sha256=eTjhjh4Aj4CUzviJ81jaf3Y5cwqsLATySn2wJxaS6RQ,2911
|
|
50
50
|
autocoder/common/files.py,sha256=CguxG9digkWBJpRaILErZmL_G5ryPRahPmPFWGB7X18,1973
|
|
51
|
-
autocoder/common/git_utils.py,sha256=
|
|
51
|
+
autocoder/common/git_utils.py,sha256=zxgQt2PukabV_21podylAUzTY7Xk60bsQ7MQYw4s-Tg,23234
|
|
52
52
|
autocoder/common/image_to_page.py,sha256=O0cNO_vHHUP-fP4GXiVojShmNqkPnZXeIyiY1MRLpKg,13936
|
|
53
53
|
autocoder/common/interpreter.py,sha256=62-dIakOunYB4yjmX8SHC0Gdy2h8NtxdgbpdqRZJ5vk,2833
|
|
54
54
|
autocoder/common/llm_rerank.py,sha256=FbvtCzaR661Mt2wn0qsuiEL1Y3puD6jeIJS4zg_e7Bs,3260
|
|
@@ -85,7 +85,7 @@ autocoder/index/symbols_utils.py,sha256=CjcjUVajmJZB75Ty3a7kMv1BZphrm-tIBAdOJv6u
|
|
|
85
85
|
autocoder/index/types.py,sha256=a2s_KV5FJlq7jqA2ELSo9E1sjuLwDB-JJYMhSpzBAhU,596
|
|
86
86
|
autocoder/index/filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
87
|
autocoder/index/filter/normal_filter.py,sha256=APu34iSvWhtlLtWgkj8N3Vo4oW1TegtZQq2bwDX_cs4,8031
|
|
88
|
-
autocoder/index/filter/quick_filter.py,sha256=
|
|
88
|
+
autocoder/index/filter/quick_filter.py,sha256=k0c3liMC6M7tP2rGorZU1DJu2mqQlc_URf3BAsSWqcY,5490
|
|
89
89
|
autocoder/pyproject/__init__.py,sha256=dQ2_7YZ7guybT9BhfxSGn43eLQJGQN2zgeKa6--JlaQ,14403
|
|
90
90
|
autocoder/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
91
|
autocoder/rag/api_server.py,sha256=dRbhAZVRAOlZ64Cnxf4_rKb4iJwHnrWS9Zr67IVORw0,7288
|
|
@@ -139,11 +139,11 @@ autocoder/utils/rest.py,sha256=hLBhr78y-WVnV0oQf9Rxc22EwqF78KINkScvYa1MuYA,6435
|
|
|
139
139
|
autocoder/utils/tests.py,sha256=BqphrwyycGAvs-5mhH8pKtMZdObwhFtJ5MC_ZAOiLq8,1340
|
|
140
140
|
autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
141
141
|
autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
142
|
-
autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=
|
|
142
|
+
autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=5MCtQwQDttvr0pRcYlYERFQpQAdi1Yvyf5Hm6F-_jvQ,9433
|
|
143
143
|
autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
144
|
-
auto_coder-0.1.
|
|
145
|
-
auto_coder-0.1.
|
|
146
|
-
auto_coder-0.1.
|
|
147
|
-
auto_coder-0.1.
|
|
148
|
-
auto_coder-0.1.
|
|
149
|
-
auto_coder-0.1.
|
|
144
|
+
auto_coder-0.1.247.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
145
|
+
auto_coder-0.1.247.dist-info/METADATA,sha256=hS2KU58cmjBGHdqYM4e--IBprziX3RJUeLDBZnZEySA,2616
|
|
146
|
+
auto_coder-0.1.247.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
147
|
+
auto_coder-0.1.247.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
|
|
148
|
+
auto_coder-0.1.247.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
|
|
149
|
+
auto_coder-0.1.247.dist-info/RECORD,,
|
autocoder/auto_coder.py
CHANGED
|
@@ -276,7 +276,7 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
276
276
|
)
|
|
277
277
|
byzerllm.connect_cluster(address=args.ray_address)
|
|
278
278
|
|
|
279
|
-
llm = byzerllm.ByzerLLM(verbose=args.print_request)
|
|
279
|
+
llm = byzerllm.ByzerLLM(verbose=args.print_request)
|
|
280
280
|
|
|
281
281
|
# code_model,index_filter_model,generate_rerank_model,chat_model
|
|
282
282
|
# 这四个模型如果用户没有设置,就会使用默认的
|
|
@@ -1339,7 +1339,7 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1339
1339
|
elif "review_commit" in args.action:
|
|
1340
1340
|
from autocoder.agent.auto_review_commit import AutoReviewCommit
|
|
1341
1341
|
reviewer = AutoReviewCommit(llm=chat_llm, args=args)
|
|
1342
|
-
v = reviewer.review_commit(args.query)
|
|
1342
|
+
v = reviewer.review_commit(query=args.query,conversations=loaded_conversations)
|
|
1343
1343
|
else:
|
|
1344
1344
|
v = stream_chat_with_continue(
|
|
1345
1345
|
llm=chat_llm,
|
autocoder/chat_auto_coder.py
CHANGED
|
@@ -1712,14 +1712,24 @@ def commit(query: str):
|
|
|
1712
1712
|
finally:
|
|
1713
1713
|
if os.path.exists(temp_yaml):
|
|
1714
1714
|
os.remove(temp_yaml)
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1715
|
+
|
|
1716
|
+
target_model = args.code_model or args.model
|
|
1717
|
+
llm = get_single_llm(target_model, product_mode)
|
|
1718
|
+
printer = Printer()
|
|
1719
|
+
printer.print_in_terminal("commit_generating", style="yellow", model_name=target_model)
|
|
1720
|
+
commit_message = ""
|
|
1721
|
+
|
|
1722
|
+
try:
|
|
1723
|
+
uncommitted_changes = git_utils.get_uncommitted_changes(".")
|
|
1724
|
+
commit_message = git_utils.generate_commit_message.with_llm(llm).run(
|
|
1725
|
+
uncommitted_changes
|
|
1726
|
+
)
|
|
1727
|
+
memory["conversation"].append(
|
|
1728
|
+
{"role": "user", "content": commit_message})
|
|
1729
|
+
except Exception as e:
|
|
1730
|
+
printer.print_in_terminal("commit_failed", style="red", error=str(e), model_name=target_model)
|
|
1731
|
+
return
|
|
1732
|
+
|
|
1723
1733
|
yaml_config["query"] = commit_message
|
|
1724
1734
|
yaml_content = convert_yaml_config_to_str(yaml_config=yaml_config)
|
|
1725
1735
|
with open(os.path.join(execute_file), "w") as f:
|
|
@@ -1732,6 +1742,8 @@ def commit(query: str):
|
|
|
1732
1742
|
".", f"auto_coder_{file_name}_{md5}"
|
|
1733
1743
|
)
|
|
1734
1744
|
git_utils.print_commit_info(commit_result=commit_result)
|
|
1745
|
+
if commit_message:
|
|
1746
|
+
printer.print_in_terminal("commit_message", style="green", model_name=target_model, message=commit_message)
|
|
1735
1747
|
except Exception as e:
|
|
1736
1748
|
import traceback
|
|
1737
1749
|
traceback.print_exc()
|
|
@@ -1875,8 +1887,8 @@ def coding(query: str):
|
|
|
1875
1887
|
@byzerllm.prompt()
|
|
1876
1888
|
def code_review(query: str) -> str:
|
|
1877
1889
|
"""
|
|
1878
|
-
|
|
1879
|
-
1.
|
|
1890
|
+
掐面提供了上下文,对代码进行review,参考如下检查点。
|
|
1891
|
+
1. 有没有调用不符合方法,类的签名的调用,包括对第三方类,模块,方法的检查(如果上下文提供了这些信息)
|
|
1880
1892
|
2. 有没有未声明直接使用的变量,方法,类
|
|
1881
1893
|
3. 有没有明显的语法错误
|
|
1882
1894
|
4. 如果是python代码,检查有没有缩进方面的错误
|
|
@@ -113,9 +113,15 @@ MESSAGES = {
|
|
|
113
113
|
"remove_files_none": "No files were removed.",
|
|
114
114
|
"files_removed": "Files Removed",
|
|
115
115
|
"models_api_key_empty": "Warning : {{name}} API key is empty. Please set a valid API key.",
|
|
116
|
+
"commit_generating": "{{ model_name }} Generating commit message...",
|
|
117
|
+
"commit_message": "{{ model_name }} Generated commit message: {{ message }}",
|
|
118
|
+
"commit_failed": "{{ model_name }} Failed to generate commit message: {{ error }}",
|
|
116
119
|
},
|
|
117
120
|
"zh": {
|
|
118
|
-
"
|
|
121
|
+
"commit_generating": "{{ model_name }} 正在生成提交信息...",
|
|
122
|
+
"commit_message": "{{ model_name }} 生成的提交信息: {{ message }}",
|
|
123
|
+
"commit_failed": "{{ model_name }} 生成提交信息失败: {{ error }}",
|
|
124
|
+
"mcp_remove_error": "移除 MCP 服务器时出错:{error}",
|
|
119
125
|
"mcp_remove_success": "成功移除 MCP 服务器:{result}",
|
|
120
126
|
"mcp_list_running_error": "列出运行中的 MCP 服务器时出错:{error}",
|
|
121
127
|
"mcp_list_running_title": "正在运行的 MCP 服务器:",
|
|
@@ -53,7 +53,7 @@ MESSAGES = {
|
|
|
53
53
|
"code_generation_complete": "Code generation completed in {{ duration }} seconds, input_tokens_count: {{ input_tokens }}, generated_tokens_count: {{ output_tokens }}",
|
|
54
54
|
"code_merge_start": "Auto merge the code...",
|
|
55
55
|
"code_execution_warning": "Content(send to model) is {{ content_length }} tokens (you may collect too much files), which is larger than the maximum input length {{ max_length }}",
|
|
56
|
-
"quick_filter_start": "Starting filter context(quick_filter)...",
|
|
56
|
+
"quick_filter_start": "{{ model_name }} Starting filter context(quick_filter)...",
|
|
57
57
|
"normal_filter_start": "{{ model_name }} Starting filter context(normal_filter)...",
|
|
58
58
|
"pylint_check_failed": "⚠️ Pylint check failed: {{ error_message }}",
|
|
59
59
|
"pylint_error": "❌ Error running pylint: {{ error_message }}",
|
|
@@ -65,7 +65,7 @@ MESSAGES = {
|
|
|
65
65
|
"merge_failed": "❌ Merge file {{ path }} failed: {{ error }}",
|
|
66
66
|
"files_merged_total": "✅ Merged {{ total }} files into the project.",
|
|
67
67
|
"ranking_skip": "Only 1 candidate, skip ranking",
|
|
68
|
-
"ranking_start": "Start ranking {{ count }} candidates",
|
|
68
|
+
"ranking_start": "Start ranking {{ count }} candidates using model {{ model_name }}",
|
|
69
69
|
"ranking_failed_request": "Ranking request failed: {{ error }}",
|
|
70
70
|
"ranking_all_failed": "All ranking requests failed",
|
|
71
71
|
"ranking_complete": "Ranking completed in {{ elapsed }}s, total voters: {{ total_tasks }}, best candidate index: {{ best_candidate }}, scores: {{ scores }}, input_tokens: {{ input_tokens }}, output_tokens: {{ output_tokens }}",
|
|
@@ -73,13 +73,17 @@ MESSAGES = {
|
|
|
73
73
|
"ranking_failed": "Ranking failed in {{ elapsed }}s, using original order",
|
|
74
74
|
"begin_index_source_code": "🚀 Begin to index source code in {{ source_dir }}",
|
|
75
75
|
"stream_out_stats": "Elapsed time {{ elapsed_time }} seconds, input tokens: {{ input_tokens }}, output tokens: {{ output_tokens }}",
|
|
76
|
+
"quick_filter_stats": "快速过滤器完成,耗时 {{ elapsed_time }} 秒,输入token数: {{ input_tokens }}, 输出token数: {{ output_tokens }}",
|
|
76
77
|
"upsert_file": "✅ Updated file: {{ file_path }}",
|
|
77
|
-
"unmerged_blocks_title": "Unmerged Blocks",
|
|
78
|
+
"unmerged_blocks_title": "Unmerged Blocks",
|
|
79
|
+
"quick_filter_title": "{{ model_name }} is analyzing how to filter context...",
|
|
80
|
+
"quick_filter_failed": "❌ Quick filter failed: {{ error }}. ",
|
|
78
81
|
"unmerged_file_path": "File: {{file_path}}",
|
|
79
82
|
"unmerged_search_block": "Search Block({{similarity}}):",
|
|
80
83
|
"unmerged_replace_block": "Replace Block:",
|
|
81
84
|
"unmerged_blocks_total": "Total unmerged blocks: {{num_blocks}}",
|
|
82
|
-
"git_init_required": "⚠️ auto_merge only applies to git repositories.\n\nPlease try using git init in the source directory:\n\n```shell\ncd {{ source_dir }}\ngit init.\n```\n\nThen run auto - coder again.\nError: {{ error }}"
|
|
85
|
+
"git_init_required": "⚠️ auto_merge only applies to git repositories.\n\nPlease try using git init in the source directory:\n\n```shell\ncd {{ source_dir }}\ngit init.\n```\n\nThen run auto - coder again.\nError: {{ error }}",
|
|
86
|
+
"quick_filter_reason": "Auto get(quick_filter mode)"
|
|
83
87
|
},
|
|
84
88
|
"zh": {
|
|
85
89
|
"model_not_found": "未找到模型: {{model_name}}",
|
|
@@ -132,7 +136,7 @@ MESSAGES = {
|
|
|
132
136
|
"code_generation_complete": "代码生成完成,耗时 {{ duration }} 秒,输入token数: {{ input_tokens }}, 输出token数: {{ output_tokens }}",
|
|
133
137
|
"code_merge_start": "正在自动合并代码...",
|
|
134
138
|
"code_execution_warning": "发送给模型的内容长度为 {{ content_length }} tokens(您可能收集了太多文件),超过了最大输入长度 {{ max_length }}",
|
|
135
|
-
"quick_filter_start": "开始查找上下文(quick_filter)...",
|
|
139
|
+
"quick_filter_start": "{{ model_name }} 开始查找上下文(quick_filter)...",
|
|
136
140
|
"normal_filter_start": "{{ model_name }} 开始查找上下文(normal_filter)...",
|
|
137
141
|
"pylint_check_failed": "⚠️ Pylint 检查失败: {{ error_message }}",
|
|
138
142
|
"pylint_error": "❌ 运行 Pylint 时出错: {{ error_message }}",
|
|
@@ -146,19 +150,23 @@ MESSAGES = {
|
|
|
146
150
|
"unmerged_search_block": "Search Block({{similarity}}):",
|
|
147
151
|
"unmerged_replace_block": "Replace Block:",
|
|
148
152
|
"unmerged_blocks_total": "未合并代码块数量: {{num_blocks}}",
|
|
149
|
-
"git_init_required": "⚠️ auto_merge 仅适用于 git 仓库。\n\n请尝试在源目录中使用 git init
|
|
153
|
+
"git_init_required": "⚠️ auto_merge 仅适用于 git 仓库。\n\n请尝试在源目录中使用 git init:\n\n```shell\ncd {{ source_dir }}\ngit init.\n```\n\n然后再次运行 auto-coder。\n错误: {{ error }}",
|
|
154
|
+
"quick_filter_reason": "自动获取(quick_filter模式)",
|
|
150
155
|
"upsert_file": "✅ 更新文件: {{ file_path }}",
|
|
151
156
|
"files_merged": "✅ 成功合并了 {{ total }} 个文件到项目中。",
|
|
152
157
|
"merge_failed": "❌ 合并文件 {{ path }} 失败: {{ error }}",
|
|
153
158
|
"files_merged_total": "✅ 合并了 {{ total }} 个文件到项目中。",
|
|
154
159
|
"ranking_skip": "只有1个候选项,跳过排序",
|
|
155
|
-
"ranking_start": "开始对 {{ count }}
|
|
160
|
+
"ranking_start": "开始对 {{ count }} 个候选项进行排序,使用模型 {{ model_name }} 打分",
|
|
156
161
|
"ranking_failed_request": "排序请求失败: {{ error }}",
|
|
157
162
|
"ranking_all_failed": "所有排序请求都失败",
|
|
158
163
|
"ranking_complete": "排序完成,耗时 {{ elapsed }} 秒,总投票数: {{ total_tasks }},最佳候选索引: {{ best_candidate }},得分: {{ scores }},输入token数: {{ input_tokens }},输出token数: {{ output_tokens }}",
|
|
159
164
|
"ranking_process_failed": "排序过程失败: {{ error }}",
|
|
160
165
|
"ranking_failed": "排序失败,耗时 {{ elapsed }} 秒,使用原始顺序",
|
|
161
|
-
"stream_out_stats": "耗时 {{ elapsed_time }} 秒,输入token数: {{ input_tokens }}, 输出token数: {{ output_tokens }}"
|
|
166
|
+
"stream_out_stats": "耗时 {{ elapsed_time }} 秒,输入token数: {{ input_tokens }}, 输出token数: {{ output_tokens }}",
|
|
167
|
+
"quick_filter_stats": "Quick filter completed in {{ elapsed_time }} seconds, input tokens: {{ input_tokens }}, output tokens: {{ output_tokens }}",
|
|
168
|
+
"quick_filter_title": "{{ model_name }} 正在分析如何筛选上下文...",
|
|
169
|
+
"quick_filter_failed": "❌ 快速过滤器失败: {{ error }}. ",
|
|
162
170
|
},
|
|
163
171
|
}
|
|
164
172
|
|
|
@@ -7,6 +7,7 @@ from autocoder.common import sys_prompt
|
|
|
7
7
|
from concurrent.futures import ThreadPoolExecutor
|
|
8
8
|
from autocoder.common.types import CodeGenerateResult
|
|
9
9
|
from autocoder.common.utils_code_auto_generate import chat_with_continue
|
|
10
|
+
import json
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class CodeAutoGenerate:
|
|
@@ -77,8 +77,15 @@ class CodeModificationRanker:
|
|
|
77
77
|
with ThreadPoolExecutor(max_workers=total_tasks) as executor:
|
|
78
78
|
# Submit tasks for each model and generate_times
|
|
79
79
|
futures = []
|
|
80
|
-
for llm in self.llms:
|
|
80
|
+
for llm in self.llms:
|
|
81
|
+
model_name = getattr(llm, 'default_model_name', None)
|
|
82
|
+
if not model_name:
|
|
83
|
+
model_name = "unknown(without default model name)"
|
|
84
|
+
self.printer.print_in_terminal(
|
|
85
|
+
"ranking_start", style="blue", count=len(generate_result.contents), model_name=model_name)
|
|
86
|
+
|
|
81
87
|
for _ in range(rank_times):
|
|
88
|
+
|
|
82
89
|
futures.append(
|
|
83
90
|
executor.submit(
|
|
84
91
|
chat_with_continue,
|
autocoder/common/git_utils.py
CHANGED
|
@@ -262,7 +262,9 @@ def get_uncommitted_changes(repo_path: str) -> str:
|
|
|
262
262
|
def generate_commit_message(changes_report: str) -> str:
|
|
263
263
|
'''
|
|
264
264
|
我是一个Git提交信息生成助手。我们的目标是通过一些变更报告,倒推用户的需求,将需求作为commit message。
|
|
265
|
-
commit message
|
|
265
|
+
commit message 需要简洁,包含两部分:
|
|
266
|
+
1. 这个commit 背后的需求是什么
|
|
267
|
+
2. 为了完成这个需求做了哪些事情
|
|
266
268
|
|
|
267
269
|
下面是一些示例:
|
|
268
270
|
<examples>
|
|
@@ -613,7 +615,7 @@ def print_commit_info(commit_result: CommitResult):
|
|
|
613
615
|
|
|
614
616
|
table.add_row("Commit Hash", commit_result.commit_hash)
|
|
615
617
|
table.add_row("Commit Message", commit_result.commit_message)
|
|
616
|
-
table.add_row("Changed Files", "\n".join(commit_result.changed_files))
|
|
618
|
+
table.add_row("Changed Files", "\n".join(commit_result.changed_files) if commit_result.changed_files else "No files changed")
|
|
617
619
|
|
|
618
620
|
console.print(
|
|
619
621
|
Panel(table, expand=False, border_style="green", title="Git Commit Summary")
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
from typing import List, Union,Dict,Any
|
|
1
|
+
from typing import List, Union, Dict, Any
|
|
2
|
+
from autocoder.utils.auto_coder_utils.chat_stream_out import stream_out
|
|
3
|
+
from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
|
|
4
|
+
from byzerllm.utils.str2model import to_model
|
|
2
5
|
from autocoder.index.types import IndexItem
|
|
3
6
|
from autocoder.common import AutoCoderArgs,SourceCode
|
|
4
7
|
import byzerllm
|
|
@@ -11,6 +14,7 @@ from autocoder.index.types import (
|
|
|
11
14
|
)
|
|
12
15
|
from autocoder.rag.token_counter import count_tokens
|
|
13
16
|
from loguru import logger
|
|
17
|
+
from autocoder.common.printer import Printer
|
|
14
18
|
|
|
15
19
|
|
|
16
20
|
def get_file_path(file_path):
|
|
@@ -25,6 +29,7 @@ class QuickFilter():
|
|
|
25
29
|
self.args = index_manager.args
|
|
26
30
|
self.stats = stats
|
|
27
31
|
self.sources = sources
|
|
32
|
+
self.printer = Printer()
|
|
28
33
|
|
|
29
34
|
@byzerllm.prompt()
|
|
30
35
|
def quick_filter_files(self,file_meta_list:List[IndexItem],query:str) -> str:
|
|
@@ -69,6 +74,7 @@ class QuickFilter():
|
|
|
69
74
|
|
|
70
75
|
def filter(self, index_items: List[IndexItem], query: str) -> Dict[str, TargetFile]:
|
|
71
76
|
final_files: Dict[str, TargetFile] = {}
|
|
77
|
+
|
|
72
78
|
if not self.args.skip_filter_index and self.args.index_filter_model:
|
|
73
79
|
start_time = time.monotonic()
|
|
74
80
|
index_items = self.index_manager.read_index()
|
|
@@ -82,17 +88,47 @@ class QuickFilter():
|
|
|
82
88
|
return final_files
|
|
83
89
|
|
|
84
90
|
try:
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
model_name = getattr(self.index_manager.index_filter_llm, 'default_model_name', None)
|
|
92
|
+
if not model_name:
|
|
93
|
+
model_name = "unknown(without default model name)"
|
|
94
|
+
|
|
95
|
+
# 渲染 Prompt 模板
|
|
96
|
+
query = self.quick_filter_files.prompt(index_items, self.args.query)
|
|
97
|
+
|
|
98
|
+
# 使用流式输出处理
|
|
99
|
+
stream_generator = stream_chat_with_continue(
|
|
100
|
+
self.index_manager.index_filter_llm,
|
|
101
|
+
[{"role": "user", "content": query}],
|
|
102
|
+
{}
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# 获取完整响应
|
|
106
|
+
full_response, last_meta = stream_out(
|
|
107
|
+
stream_generator,
|
|
108
|
+
model_name=model_name,
|
|
109
|
+
title=self.printer.get_message_from_key_with_format("quick_filter_title", model_name=model_name)
|
|
110
|
+
)
|
|
111
|
+
# 解析结果
|
|
112
|
+
file_number_list = to_model(full_response, FileNumberList)
|
|
113
|
+
|
|
114
|
+
# 打印 token 统计信息
|
|
115
|
+
self.printer.print_in_terminal(
|
|
116
|
+
"quick_filter_stats",
|
|
117
|
+
style="blue",
|
|
118
|
+
elapsed_time=f"{end_time - start_time:.2f}",
|
|
119
|
+
input_tokens=last_meta.input_tokens_count,
|
|
120
|
+
output_tokens=last_meta.generated_tokens_count
|
|
121
|
+
)
|
|
122
|
+
|
|
87
123
|
except Exception as e:
|
|
88
|
-
|
|
124
|
+
self.printer.print_error(self.printer.get_message_from_key_with_format("quick_filter_failed", error=str(e)))
|
|
89
125
|
return final_files
|
|
90
126
|
|
|
91
127
|
if file_number_list:
|
|
92
128
|
for file_number in file_number_list.file_list:
|
|
93
129
|
final_files[get_file_path(index_items[file_number].module_name)] = TargetFile(
|
|
94
130
|
file_path=index_items[file_number].module_name,
|
|
95
|
-
reason="
|
|
131
|
+
reason=self.printer.get_message_from_key("quick_filter_reason")
|
|
96
132
|
)
|
|
97
133
|
end_time = time.monotonic()
|
|
98
134
|
self.stats["timings"]["quick_filter"] = end_time - start_time
|
|
@@ -9,6 +9,7 @@ from typing import Generator, List, Dict, Any, Optional, Tuple, Literal
|
|
|
9
9
|
from autocoder.utils.request_queue import RequestValue, RequestOption, StreamValue
|
|
10
10
|
from autocoder.utils.request_queue import request_queue
|
|
11
11
|
import time
|
|
12
|
+
from byzerllm.utils.types import SingleOutputMeta
|
|
12
13
|
|
|
13
14
|
MAX_HISTORY_LINES = 40 # 最大保留历史行数
|
|
14
15
|
|
|
@@ -142,8 +143,9 @@ def stream_out(
|
|
|
142
143
|
stream_generator: Generator[Tuple[str, Dict[str, Any]], None, None],
|
|
143
144
|
request_id: Optional[str] = None,
|
|
144
145
|
console: Optional[Console] = None,
|
|
145
|
-
model_name: Optional[str] = None
|
|
146
|
-
|
|
146
|
+
model_name: Optional[str] = None,
|
|
147
|
+
title: Optional[str] = None
|
|
148
|
+
) -> Tuple[str, Optional[SingleOutputMeta]]:
|
|
147
149
|
"""
|
|
148
150
|
处理流式输出事件并在终端中展示
|
|
149
151
|
|
|
@@ -151,7 +153,8 @@ def stream_out(
|
|
|
151
153
|
stream_generator: 生成流式输出的生成器
|
|
152
154
|
request_id: 请求ID,用于更新请求队列
|
|
153
155
|
console: Rich Console对象
|
|
154
|
-
|
|
156
|
+
model_name: 模型名称
|
|
157
|
+
title: 面板标题,如果没有提供则使用默认值
|
|
155
158
|
Returns:
|
|
156
159
|
Tuple[str, Dict[str, Any]]: 返回完整的响应内容和最后的元数据
|
|
157
160
|
"""
|
|
@@ -162,10 +165,10 @@ def stream_out(
|
|
|
162
165
|
current_line = "" # 当前行
|
|
163
166
|
assistant_response = ""
|
|
164
167
|
last_meta = None
|
|
165
|
-
|
|
166
|
-
try:
|
|
168
|
+
panel_title = title if title is not None else f"Response[ {model_name} ]"
|
|
169
|
+
try:
|
|
167
170
|
with Live(
|
|
168
|
-
Panel("", title=
|
|
171
|
+
Panel("", title=panel_title, border_style="green"),
|
|
169
172
|
refresh_per_second=4,
|
|
170
173
|
console=console
|
|
171
174
|
) as live:
|
|
@@ -210,7 +213,7 @@ def stream_out(
|
|
|
210
213
|
live.update(
|
|
211
214
|
Panel(
|
|
212
215
|
Markdown(display_content),
|
|
213
|
-
title=
|
|
216
|
+
title=panel_title,
|
|
214
217
|
border_style="green",
|
|
215
218
|
height=min(50, live.console.height - 4)
|
|
216
219
|
)
|
|
@@ -224,7 +227,7 @@ def stream_out(
|
|
|
224
227
|
live.update(
|
|
225
228
|
Panel(
|
|
226
229
|
Markdown(assistant_response),
|
|
227
|
-
title=f"Final
|
|
230
|
+
title=f"Final {panel_title}",
|
|
228
231
|
border_style="blue"
|
|
229
232
|
)
|
|
230
233
|
)
|
|
@@ -232,7 +235,7 @@ def stream_out(
|
|
|
232
235
|
except Exception as e:
|
|
233
236
|
console.print(Panel(
|
|
234
237
|
f"Error: {str(e)}",
|
|
235
|
-
title=f"Error[ {
|
|
238
|
+
title=f"Error[ {panel_title} ]",
|
|
236
239
|
border_style="red"
|
|
237
240
|
))
|
|
238
241
|
# import traceback
|
autocoder/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.247"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|