auto-coder 0.1.232__py3-none-any.whl → 0.1.235__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.232.dist-info → auto_coder-0.1.235.dist-info}/METADATA +1 -2
- {auto_coder-0.1.232.dist-info → auto_coder-0.1.235.dist-info}/RECORD +21 -15
- autocoder/auto_coder.py +92 -37
- autocoder/chat_auto_coder.py +41 -1
- autocoder/common/__init__.py +4 -0
- autocoder/common/auto_coder_lang.py +90 -0
- autocoder/common/printer.py +36 -0
- autocoder/dispacher/actions/action.py +18 -2
- autocoder/dispacher/actions/copilot.py +1 -1
- autocoder/dispacher/actions/plugins/action_regex_project.py +6 -1
- autocoder/index/entry.py +316 -0
- autocoder/index/filter/__init__.py +0 -0
- autocoder/index/filter/normal_filter.py +168 -0
- autocoder/index/filter/quick_filter.py +99 -0
- autocoder/index/index.py +61 -410
- autocoder/index/types.py +4 -1
- autocoder/version.py +1 -1
- {auto_coder-0.1.232.dist-info → auto_coder-0.1.235.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.232.dist-info → auto_coder-0.1.235.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.232.dist-info → auto_coder-0.1.235.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.232.dist-info → auto_coder-0.1.235.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: auto-coder
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.235
|
|
4
4
|
Summary: AutoCoder: AutoCoder
|
|
5
5
|
Author: allwefantasy
|
|
6
6
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
@@ -39,7 +39,6 @@ Requires-Dist: real-agent
|
|
|
39
39
|
Requires-Dist: python-docx
|
|
40
40
|
Requires-Dist: docx2txt
|
|
41
41
|
Requires-Dist: pdf2image
|
|
42
|
-
Requires-Dist: Spire.Doc
|
|
43
42
|
Requires-Dist: docx2pdf
|
|
44
43
|
Requires-Dist: pyperclip
|
|
45
44
|
Requires-Dist: colorama
|
|
@@ -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=XOZGAJiy6CWnn7dfbGAmZwVI8KnIaSJ-FgZm8t4d0YE,61069
|
|
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=
|
|
9
|
+
autocoder/chat_auto_coder.py,sha256=US-HXJtBkj_7QifJxQNcWgUTYe-ZB2sf0aZI8gbLN9w,102931
|
|
10
10
|
autocoder/chat_auto_coder_lang.py,sha256=YJsFi8an0Kjbo9X7xKZfpdbHS3rbhrvChZNjWqEQ5Sw,11032
|
|
11
11
|
autocoder/command_args.py,sha256=9aYJ-AmPxP1sQh6ciw04FWHjSn31f2W9afXFwo8wgx4,30441
|
|
12
12
|
autocoder/lang.py,sha256=U6AjVV8Rs1uLyjFCZ8sT6WWuNUxMBqkXXIOs4S120uk,14511
|
|
13
13
|
autocoder/models.py,sha256=FlBrF6HhGao_RiCSgYhCmP7vs0KlG4hI_BI6dyZiL9s,5292
|
|
14
|
-
autocoder/version.py,sha256=
|
|
14
|
+
autocoder/version.py,sha256=Ha3i0TzVJUOaC3CSX9IQT4bWoilQPZfSI4LPVJpLuuQ,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
|
|
@@ -24,10 +24,11 @@ autocoder/agent/project_reader.py,sha256=tWLaPoLw1gI6kO_NzivQj28KbobU2ceOLuppHMb
|
|
|
24
24
|
autocoder/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
autocoder/common/JupyterClient.py,sha256=O-wi6pXeAEYhAY24kDa0BINrLYvKS6rKyWe98pDClS0,2816
|
|
26
26
|
autocoder/common/ShellClient.py,sha256=fM1q8t_XMSbLBl2zkCNC2J9xuyKN3eXzGm6hHhqL2WY,2286
|
|
27
|
-
autocoder/common/__init__.py,sha256
|
|
27
|
+
autocoder/common/__init__.py,sha256=vpfo3RctksezDoraVSpHtfnxpspVNiYh8OmQhqQvcfE,11729
|
|
28
28
|
autocoder/common/anything2images.py,sha256=0ILBbWzY02M-CiWB-vzuomb_J1hVdxRcenAfIrAXq9M,25283
|
|
29
29
|
autocoder/common/anything2img.py,sha256=4TREa-sOA-iargieUy7MpyCYVUE-9Mmq0wJtwomPqnE,7662
|
|
30
30
|
autocoder/common/audio.py,sha256=Kn9nWKQddWnUrAz0a_ZUgjcu4VUU_IcZBigT7n3N3qc,7439
|
|
31
|
+
autocoder/common/auto_coder_lang.py,sha256=2xyc_qqClEiqtkwccH5gs3MquYwMM16DMq-kIx7Hwcc,5834
|
|
31
32
|
autocoder/common/buildin_tokenizer.py,sha256=L7d5t39ZFvUd6EoMPXUhYK1toD0FHlRH1jtjKRGokWU,1236
|
|
32
33
|
autocoder/common/chunk_validation.py,sha256=BrR_ZWavW8IANuueEE7hS8NFAwEvm8TX34WnPx_1hs8,3030
|
|
33
34
|
autocoder/common/cleaner.py,sha256=NU72i8C6o9m0vXExab7nao5bstBUsfJFcj11cXa9l4U,1089
|
|
@@ -54,6 +55,7 @@ autocoder/common/mcp_hub.py,sha256=2ZyJv3Aiv4Y97UHut49oYhIFcu7ICR-mptDEBSgT3uE,1
|
|
|
54
55
|
autocoder/common/mcp_server.py,sha256=QCFa-15kx7rbNsinwdGFFX2y47pww0fVdI-ldKFSSWI,12267
|
|
55
56
|
autocoder/common/mcp_tools.py,sha256=KsLvRrB6pvmebqd-lDaSH6IBJR0AIxWRE-dtCEG_w9k,12485
|
|
56
57
|
autocoder/common/memory_manager.py,sha256=2ZjYG7BPyvbYalZBF6AM_G5e10Qkw_zrqtD4Zd7GSsQ,3663
|
|
58
|
+
autocoder/common/printer.py,sha256=dZQ5JXLy1OxA9uoLE7dNGuiOH0xbt5xN_fsMkEJ6syw,1304
|
|
57
59
|
autocoder/common/recall_validation.py,sha256=Avt9Q9dX3kG6Pf2zsdlOHmsjd-OeSj7U1PFBDp_Cve0,1700
|
|
58
60
|
autocoder/common/screenshots.py,sha256=_gA-z1HxGjPShBrtgkdideq58MG6rqFB2qMUJKjrycs,3769
|
|
59
61
|
autocoder/common/search.py,sha256=245iPFgWhMldoUK3CqCP89ltaxZiNPK73evoG6Fp1h8,16518
|
|
@@ -69,16 +71,20 @@ autocoder/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
69
71
|
autocoder/db/store.py,sha256=tFT66bP2ZKIqZip-uhLkHRSLaaOAUUDZfozJwcqix3c,1908
|
|
70
72
|
autocoder/dispacher/__init__.py,sha256=YoA64dIxnx4jcE1pwSfg81sjkQtjDkhddkfac1-cMWo,1230
|
|
71
73
|
autocoder/dispacher/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
|
-
autocoder/dispacher/actions/action.py,sha256=
|
|
73
|
-
autocoder/dispacher/actions/copilot.py,sha256=
|
|
74
|
+
autocoder/dispacher/actions/action.py,sha256=KUTpbkIQaIOhdnAaGbUj2ltj12IbzssxqEVoT9YM11U,19972
|
|
75
|
+
autocoder/dispacher/actions/copilot.py,sha256=iMh4ckj9hO5Q-iemF3CStXd7DatWai7Eci5zOlKxK9c,13072
|
|
74
76
|
autocoder/dispacher/actions/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
75
|
-
autocoder/dispacher/actions/plugins/action_regex_project.py,sha256=
|
|
77
|
+
autocoder/dispacher/actions/plugins/action_regex_project.py,sha256=ht_HWzZt84IEogoFMggnXI6aFFerrsuksVflAkcodfU,5545
|
|
76
78
|
autocoder/dispacher/actions/plugins/action_translate.py,sha256=nVAtRSQpdGNmZxg1R_9zXG3AuTv3CHf2v7ODgj8u65c,7727
|
|
77
79
|
autocoder/index/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
|
+
autocoder/index/entry.py,sha256=f6_lrJLAfYslzAUY7JUCsJMhoMCIKy9ZHGBWHhmCtr8,11310
|
|
78
81
|
autocoder/index/for_command.py,sha256=LGnz-OWogT8rd24m4Zcan7doLaijxqorAuiMk7WuRq0,3125
|
|
79
|
-
autocoder/index/index.py,sha256=
|
|
82
|
+
autocoder/index/index.py,sha256=HfWN0Mbk22S81-fnm9wrYNJO9Bcnws4G_PxJ8IQuH5A,20175
|
|
80
83
|
autocoder/index/symbols_utils.py,sha256=CjcjUVajmJZB75Ty3a7kMv1BZphrm-tIBAdOJv6uo-0,2037
|
|
81
|
-
autocoder/index/types.py,sha256=
|
|
84
|
+
autocoder/index/types.py,sha256=a2s_KV5FJlq7jqA2ELSo9E1sjuLwDB-JJYMhSpzBAhU,596
|
|
85
|
+
autocoder/index/filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
|
+
autocoder/index/filter/normal_filter.py,sha256=pE5QwcBq6NYHFtYhwhfMJmYQYJwErNs-Q7iZmVBAh-k,7964
|
|
87
|
+
autocoder/index/filter/quick_filter.py,sha256=1cRPAd8uUFkbPg4JlLaYCd3a8CMifVYEIpqBBaJ9GXo,3874
|
|
82
88
|
autocoder/pyproject/__init__.py,sha256=dQ2_7YZ7guybT9BhfxSGn43eLQJGQN2zgeKa6--JlaQ,14403
|
|
83
89
|
autocoder/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
90
|
autocoder/rag/api_server.py,sha256=dRbhAZVRAOlZ64Cnxf4_rKb4iJwHnrWS9Zr67IVORw0,7288
|
|
@@ -133,9 +139,9 @@ autocoder/utils/tests.py,sha256=BqphrwyycGAvs-5mhH8pKtMZdObwhFtJ5MC_ZAOiLq8,1340
|
|
|
133
139
|
autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
134
140
|
autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=6D_SIa5hHSwIHC1poO_ztK7IVugAqNHu-jQySd7EnfQ,4181
|
|
135
141
|
autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
136
|
-
auto_coder-0.1.
|
|
137
|
-
auto_coder-0.1.
|
|
138
|
-
auto_coder-0.1.
|
|
139
|
-
auto_coder-0.1.
|
|
140
|
-
auto_coder-0.1.
|
|
141
|
-
auto_coder-0.1.
|
|
142
|
+
auto_coder-0.1.235.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
143
|
+
auto_coder-0.1.235.dist-info/METADATA,sha256=JiMGcJmUn-bzkT0jg8tVMxu-D04DnaXV4On1qBk3iDc,2616
|
|
144
|
+
auto_coder-0.1.235.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
145
|
+
auto_coder-0.1.235.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
|
|
146
|
+
auto_coder-0.1.235.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
|
|
147
|
+
auto_coder-0.1.235.dist-info/RECORD,,
|
autocoder/auto_coder.py
CHANGED
|
@@ -39,9 +39,10 @@ from rich.console import Console
|
|
|
39
39
|
from rich.panel import Panel
|
|
40
40
|
from rich.markdown import Markdown
|
|
41
41
|
from rich.live import Live
|
|
42
|
-
from autocoder.auto_coder_lang import get_message
|
|
42
|
+
from autocoder.common.auto_coder_lang import get_message
|
|
43
43
|
from autocoder.common.memory_manager import save_to_memory_file
|
|
44
44
|
from autocoder import models as models_module
|
|
45
|
+
from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
|
|
45
46
|
from autocoder.utils.auto_coder_utils.chat_stream_out import stream_out
|
|
46
47
|
|
|
47
48
|
console = Console()
|
|
@@ -68,8 +69,7 @@ def load_include_files(config, base_path, max_depth=10, current_depth=0):
|
|
|
68
69
|
include_files = [include_files]
|
|
69
70
|
|
|
70
71
|
for include_file in include_files:
|
|
71
|
-
abs_include_path = resolve_include_path(base_path, include_file)
|
|
72
|
-
logger.info(f"Loading include file: {abs_include_path}")
|
|
72
|
+
abs_include_path = resolve_include_path(base_path, include_file)
|
|
73
73
|
with open(abs_include_path, "r") as f:
|
|
74
74
|
include_config = yaml.safe_load(f)
|
|
75
75
|
if not include_config:
|
|
@@ -130,15 +130,15 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
130
130
|
if not os.path.isabs(args.source_dir):
|
|
131
131
|
args.source_dir = os.path.abspath(args.source_dir)
|
|
132
132
|
|
|
133
|
-
if not args.silence:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
# if not args.silence:
|
|
134
|
+
# print("Command Line Arguments:")
|
|
135
|
+
# print("-" * 50)
|
|
136
|
+
# for arg, value in vars(args).items():
|
|
137
|
+
# if arg == "context" and value:
|
|
138
|
+
# print(f"{arg:20}: {value[:30]}...")
|
|
139
|
+
# else:
|
|
140
|
+
# print(f"{arg:20}: {value}")
|
|
141
|
+
# print("-" * 50)
|
|
142
142
|
|
|
143
143
|
# init store
|
|
144
144
|
store = Store(os.path.join(args.source_dir, ".auto-coder", "metadata.db"))
|
|
@@ -243,10 +243,7 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
243
243
|
new_file = os.path.join(
|
|
244
244
|
actions_dir, f"{new_seq}_{raw_args.name}.yml")
|
|
245
245
|
with open(new_file, "w") as f:
|
|
246
|
-
f.write(content)
|
|
247
|
-
|
|
248
|
-
print(f"Successfully created new action file: {new_file}")
|
|
249
|
-
|
|
246
|
+
f.write(content)
|
|
250
247
|
# open_yaml_file_in_editor(new_file)
|
|
251
248
|
return
|
|
252
249
|
|
|
@@ -280,6 +277,22 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
280
277
|
byzerllm.connect_cluster(address=args.ray_address)
|
|
281
278
|
|
|
282
279
|
llm = byzerllm.ByzerLLM(verbose=args.print_request)
|
|
280
|
+
|
|
281
|
+
code_model = byzerllm.ByzerLLM()
|
|
282
|
+
code_model.setup_default_model_name("deepseek_chat")
|
|
283
|
+
llm.setup_sub_client("code_model", code_model)
|
|
284
|
+
|
|
285
|
+
index_filter_model = byzerllm.ByzerLLM()
|
|
286
|
+
index_filter_model.setup_default_model_name("deepseek_r1_chat")
|
|
287
|
+
llm.setup_sub_client("index_filter_model", index_filter_model)
|
|
288
|
+
|
|
289
|
+
generate_rerank_model = byzerllm.ByzerLLM()
|
|
290
|
+
generate_rerank_model.setup_default_model_name("deepseek_r1_chat")
|
|
291
|
+
llm.setup_sub_client("generate_rerank_model", generate_rerank_model)
|
|
292
|
+
|
|
293
|
+
chat_model = byzerllm.ByzerLLM()
|
|
294
|
+
chat_model.setup_default_model_name("deepseek_r1_chat")
|
|
295
|
+
llm.setup_sub_client("chat_model", chat_model)
|
|
283
296
|
|
|
284
297
|
if args.product_mode == "lite":
|
|
285
298
|
llm = byzerllm.SimpleByzerLLM(default_model_name="deepseek_chat")
|
|
@@ -343,9 +356,23 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
343
356
|
}
|
|
344
357
|
)
|
|
345
358
|
|
|
359
|
+
index_filter_llm = byzerllm.SimpleByzerLLM(default_model_name="deepseek_r1_chat")
|
|
360
|
+
index_filter_llm.deploy(
|
|
361
|
+
model_path="",
|
|
362
|
+
pretrained_model_type="saas/openai",
|
|
363
|
+
udf_name="deepseek_r1_chat",
|
|
364
|
+
infer_params={
|
|
365
|
+
"saas.base_url": "https://api.deepseek.com/v1",
|
|
366
|
+
"saas.api_key": api_key,
|
|
367
|
+
"saas.model": "deepseek-reasoner",
|
|
368
|
+
"saas.is_reasoning": True
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
|
|
346
372
|
llm.setup_sub_client("code_model", code_llm)
|
|
347
373
|
llm.setup_sub_client("chat_model", chat_llm)
|
|
348
374
|
llm.setup_sub_client("generate_rerank_model", generate_rerank_llm)
|
|
375
|
+
llm.setup_sub_client("index_filter_model", index_filter_llm)
|
|
349
376
|
|
|
350
377
|
if args.product_mode == "lite":
|
|
351
378
|
# Set up default models based on configuration
|
|
@@ -443,7 +470,24 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
443
470
|
"saas.is_reasoning": model_info["is_reasoning"]
|
|
444
471
|
}
|
|
445
472
|
)
|
|
446
|
-
llm.setup_sub_client("inference_model", inference_model)
|
|
473
|
+
llm.setup_sub_client("inference_model", inference_model)
|
|
474
|
+
|
|
475
|
+
if args.index_filter_model:
|
|
476
|
+
model_info = models_module.get_model_by_name(args.index_filter_model)
|
|
477
|
+
model_name = args.index_filter_model
|
|
478
|
+
index_filter_model = byzerllm.SimpleByzerLLM(default_model_name=model_name)
|
|
479
|
+
index_filter_model.deploy(
|
|
480
|
+
model_path="",
|
|
481
|
+
pretrained_model_type=model_info["model_type"],
|
|
482
|
+
udf_name=model_name,
|
|
483
|
+
infer_params={
|
|
484
|
+
"saas.base_url": model_info["base_url"],
|
|
485
|
+
"saas.api_key": model_info["api_key"],
|
|
486
|
+
"saas.model": model_info["model_name"],
|
|
487
|
+
"saas.is_reasoning": model_info["is_reasoning"]
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
llm.setup_sub_client("index_filter_model", index_filter_model)
|
|
447
491
|
|
|
448
492
|
|
|
449
493
|
if args.product_mode == "pro":
|
|
@@ -482,7 +526,12 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
482
526
|
if args.inference_model:
|
|
483
527
|
inference_model = byzerllm.ByzerLLM()
|
|
484
528
|
inference_model.setup_default_model_name(args.inference_model)
|
|
485
|
-
llm.setup_sub_client("inference_model", inference_model)
|
|
529
|
+
llm.setup_sub_client("inference_model", inference_model)
|
|
530
|
+
|
|
531
|
+
if args.index_filter_model:
|
|
532
|
+
index_filter_model = byzerllm.ByzerLLM()
|
|
533
|
+
index_filter_model.setup_default_model_name(args.index_filter_model)
|
|
534
|
+
llm.setup_sub_client("index_filter_model", index_filter_model)
|
|
486
535
|
|
|
487
536
|
|
|
488
537
|
if args.human_as_model:
|
|
@@ -1091,22 +1140,28 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1091
1140
|
chat_llm = llm
|
|
1092
1141
|
|
|
1093
1142
|
source_count = 0
|
|
1094
|
-
pre_conversations = []
|
|
1095
|
-
if args.context
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
},
|
|
1104
|
-
)
|
|
1105
|
-
pre_conversations.append(
|
|
1106
|
-
{"role": "assistant", "content": "read"})
|
|
1107
|
-
source_count += 1
|
|
1143
|
+
pre_conversations = []
|
|
1144
|
+
context_content = args.context if args.context else ""
|
|
1145
|
+
if args.context:
|
|
1146
|
+
try:
|
|
1147
|
+
context = json.loads(args.context)
|
|
1148
|
+
if "file_content" in context:
|
|
1149
|
+
context_content = context["file_content"]
|
|
1150
|
+
except:
|
|
1151
|
+
pass
|
|
1108
1152
|
|
|
1109
|
-
|
|
1153
|
+
pre_conversations.append(
|
|
1154
|
+
{
|
|
1155
|
+
"role": "user",
|
|
1156
|
+
"content": f"请阅读下面的代码和文档:\n\n <files>\n{context_content}\n</files>",
|
|
1157
|
+
},
|
|
1158
|
+
)
|
|
1159
|
+
pre_conversations.append(
|
|
1160
|
+
{"role": "assistant", "content": "read"})
|
|
1161
|
+
source_count += 1
|
|
1162
|
+
|
|
1163
|
+
from autocoder.index.index import IndexManager
|
|
1164
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
1110
1165
|
from autocoder.pyproject import PyProject
|
|
1111
1166
|
from autocoder.tsproject import TSProject
|
|
1112
1167
|
from autocoder.suffixproject import SuffixProject
|
|
@@ -1118,10 +1173,11 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1118
1173
|
else:
|
|
1119
1174
|
pp = SuffixProject(args=args, llm=llm, file_filter=None)
|
|
1120
1175
|
pp.run()
|
|
1121
|
-
sources = pp.sources
|
|
1176
|
+
sources = pp.sources
|
|
1122
1177
|
|
|
1123
1178
|
s = build_index_and_filter_files(
|
|
1124
|
-
llm=llm, args=args, sources=sources)
|
|
1179
|
+
llm=llm, args=args, sources=sources)
|
|
1180
|
+
|
|
1125
1181
|
if s:
|
|
1126
1182
|
pre_conversations.append(
|
|
1127
1183
|
{
|
|
@@ -1272,8 +1328,7 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1272
1328
|
)
|
|
1273
1329
|
)
|
|
1274
1330
|
v = [[response.result,None]]
|
|
1275
|
-
else:
|
|
1276
|
-
from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
|
|
1331
|
+
else:
|
|
1277
1332
|
v = stream_chat_with_continue(
|
|
1278
1333
|
llm=chat_llm,
|
|
1279
1334
|
conversations=loaded_conversations,
|
autocoder/chat_auto_coder.py
CHANGED
|
@@ -52,6 +52,7 @@ from autocoder.common.memory_manager import get_global_memory_file_paths
|
|
|
52
52
|
from autocoder import models
|
|
53
53
|
import shlex
|
|
54
54
|
from autocoder.utils.llms import get_single_llm
|
|
55
|
+
import pkg_resources
|
|
55
56
|
|
|
56
57
|
class SymbolItem(BaseModel):
|
|
57
58
|
symbol_name: str
|
|
@@ -369,6 +370,33 @@ def initialize_system(args):
|
|
|
369
370
|
"deepseek_chat",
|
|
370
371
|
]
|
|
371
372
|
|
|
373
|
+
try:
|
|
374
|
+
subprocess.run(deploy_cmd, check=True)
|
|
375
|
+
print_status(get_message("deploy_complete"), "success")
|
|
376
|
+
except subprocess.CalledProcessError:
|
|
377
|
+
print_status(get_message("deploy_fail"), "error")
|
|
378
|
+
return
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
deploy_cmd = [
|
|
382
|
+
"byzerllm",
|
|
383
|
+
"deploy",
|
|
384
|
+
"--pretrained_model_type",
|
|
385
|
+
"saas/reasoning_openai",
|
|
386
|
+
"--cpus_per_worker",
|
|
387
|
+
"0.001",
|
|
388
|
+
"--gpus_per_worker",
|
|
389
|
+
"0",
|
|
390
|
+
"--worker_concurrency",
|
|
391
|
+
"1000",
|
|
392
|
+
"--num_workers",
|
|
393
|
+
"1",
|
|
394
|
+
"--infer_params",
|
|
395
|
+
f"saas.base_url=https://api.deepseek.com/v1 saas.api_key={api_key} saas.model=deepseek-reasoner",
|
|
396
|
+
"--model",
|
|
397
|
+
"deepseek_r1_chat",
|
|
398
|
+
]
|
|
399
|
+
|
|
372
400
|
try:
|
|
373
401
|
subprocess.run(deploy_cmd, check=True)
|
|
374
402
|
print_status(get_message("deploy_complete"), "success")
|
|
@@ -1714,7 +1742,8 @@ def coding(query: str):
|
|
|
1714
1742
|
== "true",
|
|
1715
1743
|
}
|
|
1716
1744
|
|
|
1717
|
-
yaml_config["context"] = ""
|
|
1745
|
+
yaml_config["context"] = ""
|
|
1746
|
+
yaml_config["in_code_apply"] = is_apply
|
|
1718
1747
|
|
|
1719
1748
|
for key, value in conf.items():
|
|
1720
1749
|
converted_value = convert_config_value(key, value)
|
|
@@ -2478,6 +2507,17 @@ def lib_command(args: List[str]):
|
|
|
2478
2507
|
|
|
2479
2508
|
|
|
2480
2509
|
def main():
|
|
2510
|
+
from autocoder.rag.variable_holder import VariableHolder
|
|
2511
|
+
from tokenizers import Tokenizer
|
|
2512
|
+
try:
|
|
2513
|
+
tokenizer_path = pkg_resources.resource_filename(
|
|
2514
|
+
"autocoder", "data/tokenizer.json"
|
|
2515
|
+
)
|
|
2516
|
+
VariableHolder.TOKENIZER_PATH = tokenizer_path
|
|
2517
|
+
VariableHolder.TOKENIZER_MODEL = Tokenizer.from_file(tokenizer_path)
|
|
2518
|
+
except FileNotFoundError:
|
|
2519
|
+
tokenizer_path = None
|
|
2520
|
+
|
|
2481
2521
|
ARGS = parse_arguments()
|
|
2482
2522
|
|
|
2483
2523
|
if ARGS.lite:
|
autocoder/common/__init__.py
CHANGED
|
@@ -259,6 +259,7 @@ class AutoCoderArgs(pydantic.BaseModel):
|
|
|
259
259
|
skip_filter_index: Optional[bool] = False
|
|
260
260
|
|
|
261
261
|
index_model: Optional[str] = ""
|
|
262
|
+
index_filter_model: Optional[str] = ""
|
|
262
263
|
index_model_max_length: Optional[int] = 0
|
|
263
264
|
index_model_max_input_length: Optional[int] = 0
|
|
264
265
|
index_model_anti_quota_limit: Optional[int] = 0
|
|
@@ -354,5 +355,8 @@ class AutoCoderArgs(pydantic.BaseModel):
|
|
|
354
355
|
enable_global_memory: Optional[bool] = True
|
|
355
356
|
product_mode: Optional[str] = "lite"
|
|
356
357
|
|
|
358
|
+
in_code_apply: bool = False
|
|
359
|
+
|
|
357
360
|
class Config:
|
|
358
361
|
protected_namespaces = ()
|
|
362
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import locale
|
|
2
|
+
|
|
3
|
+
MESSAGES = {
|
|
4
|
+
"en": {
|
|
5
|
+
"index_file_too_large": "⚠️ File {{ file_path }} is too large ({{ file_size }} > {{ max_length }}), splitting into chunks...",
|
|
6
|
+
"index_update_success": "✅ Successfully updated index for {{ file_path }} (md5: {{ md5 }}) in {{ duration }}s",
|
|
7
|
+
"index_build_error": "❌ Error building index for {{ file_path }}: {{ error }}",
|
|
8
|
+
"index_build_summary": "📊 Total Files: {{ total_files }}, Need to Build Index: {{ num_files }}",
|
|
9
|
+
"building_index_progress": "⏳ Building Index: {{ counter }}/{{ num_files }}...",
|
|
10
|
+
"index_source_dir_mismatch": "⚠️ Source directory mismatch (file_path: {{ file_path }}, source_dir: {{ source_dir }})",
|
|
11
|
+
"index_related_files_fail": "⚠️ Failed to find related files for chunk {{ chunk_count }}",
|
|
12
|
+
"index_threads_completed": "✅ Completed {{ completed_threads }}/{{ total_threads }} threads",
|
|
13
|
+
"index_related_files_fail": "⚠️ Failed to find related files for chunk {{ chunk_count }}",
|
|
14
|
+
"human_as_model_instructions": (
|
|
15
|
+
"You are now in Human as Model mode. The content has been copied to your clipboard.\n"
|
|
16
|
+
"The system is waiting for your input. When finished, enter 'EOF' on a new line to submit.\n"
|
|
17
|
+
"Use '/break' to exit this mode. If you have issues with copy-paste, use '/clear' to clean and paste again."
|
|
18
|
+
),
|
|
19
|
+
"clipboard_not_supported": (
|
|
20
|
+
"pyperclip not installed or clipboard is not supported, instruction will not be copied to clipboard."
|
|
21
|
+
),
|
|
22
|
+
"human_as_model_instructions_no_clipboard": (
|
|
23
|
+
"You are now in Human as Model mode. [bold red]The content could not be copied to your clipboard.[/bold red]\n"
|
|
24
|
+
"but you can copy prompt from output.txt file.\n"
|
|
25
|
+
"The system is waiting for your input. When finished, enter 'EOF' on a new line to submit.\n"
|
|
26
|
+
"Use '/break' to exit this mode. If you have issues with copy-paste, use '/clear' to clean and paste again."
|
|
27
|
+
),
|
|
28
|
+
"phase1_processing_sources": "Phase 1: Processing REST/RAG/Search sources...",
|
|
29
|
+
"phase2_building_index": "Phase 2: Building index for all files...",
|
|
30
|
+
"phase6_file_selection": "Phase 6: Processing file selection and limits...",
|
|
31
|
+
"phase7_preparing_output": "Phase 7: Preparing final output...",
|
|
32
|
+
"chat_human_as_model_instructions": (
|
|
33
|
+
"Chat is now in Human as Model mode.\n"
|
|
34
|
+
"The question has been copied to your clipboard.\n"
|
|
35
|
+
"Please use Web version model to get the answer.\n"
|
|
36
|
+
"Or use /conf human_as_model:false to close this mode and get the answer in terminal directly."
|
|
37
|
+
"Paste the answer to the input box below, use '/break' to exit, '/clear' to clear the screen, '/eof' to submit."
|
|
38
|
+
)
|
|
39
|
+
},
|
|
40
|
+
"zh": {
|
|
41
|
+
"index_file_too_large": "⚠️ 文件 {{ file_path }} 过大 ({{ file_size }} > {{ max_length }}), 正在分块处理...",
|
|
42
|
+
"index_update_success": "✅ 成功更新 {{ file_path }} 的索引 (md5: {{ md5 }}), 耗时 {{ duration }} 秒",
|
|
43
|
+
"index_build_error": "❌ 构建 {{ file_path }} 索引时出错: {{ error }}",
|
|
44
|
+
"index_build_summary": "📊 总文件数: {{ total_files }}, 需要构建索引: {{ num_files }}",
|
|
45
|
+
"building_index_progress": "⏳ 正在构建索引: {{ counter }}/{{ num_files }}...",
|
|
46
|
+
"index_source_dir_mismatch": "⚠️ 源目录不匹配 (文件路径: {{ file_path }}, 源目录: {{ source_dir }})",
|
|
47
|
+
"index_related_files_fail": "⚠️ 无法为块 {{ chunk_count }} 找到相关文件",
|
|
48
|
+
"index_threads_completed": "✅ 已完成 {{ completed_threads }}/{{ total_threads }} 个线程",
|
|
49
|
+
"index_related_files_fail": "⚠️ 无法为块 {{ chunk_count }} 找到相关文件",
|
|
50
|
+
"human_as_model_instructions": (
|
|
51
|
+
"您现在处于人类作为模型模式。内容已复制到您的剪贴板。\n"
|
|
52
|
+
"系统正在等待您的输入。完成后,在新行输入'EOF'提交。\n"
|
|
53
|
+
"使用'/break'退出此模式。如果复制粘贴有问题,使用'/clear'清理并重新粘贴。"
|
|
54
|
+
),
|
|
55
|
+
"clipboard_not_supported": (
|
|
56
|
+
"未安装pyperclip或不支持剪贴板,指令将不会被复制到剪贴板。"
|
|
57
|
+
),
|
|
58
|
+
"human_as_model_instructions_no_clipboard": (
|
|
59
|
+
"您现在处于人类作为模型模式。[bold red]内容无法复制到您的剪贴板。[/bold red]\n"
|
|
60
|
+
"但您可以从output.txt文件复制提示。\n"
|
|
61
|
+
"系统正在等待您的输入。完成后,在新行输入'EOF'提交。\n"
|
|
62
|
+
"使用'/break'退出此模式。如果复制粘贴有问题,使用'/clear'清理并重新粘贴。"
|
|
63
|
+
),
|
|
64
|
+
|
|
65
|
+
"phase1_processing_sources": "阶段 1: 正在处理 REST/RAG/Search 源...",
|
|
66
|
+
"phase2_building_index": "阶段 2: 正在为所有文件构建索引...",
|
|
67
|
+
"phase6_file_selection": "阶段 6: 正在处理文件选择和限制...",
|
|
68
|
+
"phase7_preparing_output": "阶段 7: 正在准备最终输出...",
|
|
69
|
+
|
|
70
|
+
"chat_human_as_model_instructions": (
|
|
71
|
+
"\n============= Chat 处于 Human as Model 模式 =============\n"
|
|
72
|
+
"问题已复制到剪贴板\n"
|
|
73
|
+
"请使用Web版本模型获取答案\n"
|
|
74
|
+
"或者使用 /conf human_as_model:false 关闭该模式直接在终端获得答案。"
|
|
75
|
+
"将获得答案黏贴到下面的输入框,换行后,使用 '/break' 退出,'/clear' 清屏,'/eof' 提交。"
|
|
76
|
+
),
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def get_system_language():
|
|
82
|
+
try:
|
|
83
|
+
return locale.getdefaultlocale()[0][:2]
|
|
84
|
+
except:
|
|
85
|
+
return 'en'
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def get_message(key):
|
|
89
|
+
lang = get_system_language()
|
|
90
|
+
return MESSAGES.get(lang, MESSAGES['en']).get(key, MESSAGES['en'][key])
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from rich.console import Console
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from byzerllm.utils import format_str_jinja2
|
|
4
|
+
from autocoder.common.auto_coder_lang import get_message
|
|
5
|
+
from autocoder.chat_auto_coder_lang import get_message as get_chat_message
|
|
6
|
+
class Printer:
|
|
7
|
+
def __init__(self,console:Optional[Console]=None):
|
|
8
|
+
if console is None:
|
|
9
|
+
self.console = Console()
|
|
10
|
+
else:
|
|
11
|
+
self.console = console
|
|
12
|
+
|
|
13
|
+
def get_message_from_key(self, key: str):
|
|
14
|
+
try:
|
|
15
|
+
return get_message(key)
|
|
16
|
+
except Exception as e:
|
|
17
|
+
return get_chat_message(key)
|
|
18
|
+
|
|
19
|
+
def print_in_terminal(self, key: str, style: str = None,**kwargs):
|
|
20
|
+
try:
|
|
21
|
+
if style:
|
|
22
|
+
self.console.print(format_str_jinja2(self.get_message_from_key(key),**kwargs), style=style)
|
|
23
|
+
else:
|
|
24
|
+
self.console.print(format_str_jinja2(self.get_message_from_key(key),**kwargs))
|
|
25
|
+
except Exception as e:
|
|
26
|
+
print(self.get_message_from_key(key))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def print_str_in_terminal(self, content: str, style: str = None):
|
|
30
|
+
try:
|
|
31
|
+
if style:
|
|
32
|
+
self.console.print(content, style=style)
|
|
33
|
+
else:
|
|
34
|
+
self.console.print(content)
|
|
35
|
+
except Exception as e:
|
|
36
|
+
print(content)
|
|
@@ -9,7 +9,7 @@ from autocoder.common.buildin_tokenizer import BuildinTokenizer
|
|
|
9
9
|
from autocoder.pyproject import PyProject, Level1PyProject
|
|
10
10
|
from autocoder.tsproject import TSProject
|
|
11
11
|
from autocoder.suffixproject import SuffixProject
|
|
12
|
-
from autocoder.index.
|
|
12
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
13
13
|
from autocoder.common.code_auto_merge import CodeAutoMerge
|
|
14
14
|
from autocoder.common.code_auto_merge_diff import CodeAutoMergeDiff
|
|
15
15
|
from autocoder.common.code_auto_merge_strict_diff import CodeAutoMergeStrictDiff
|
|
@@ -54,9 +54,14 @@ class ActionTSProject(BaseAction):
|
|
|
54
54
|
|
|
55
55
|
source_code = pp.output()
|
|
56
56
|
if self.llm:
|
|
57
|
+
if args.in_code_apply:
|
|
58
|
+
old_query = args.query
|
|
59
|
+
args.query = (args.context or "") + "\n\n" + args.query
|
|
57
60
|
source_code = build_index_and_filter_files(
|
|
58
61
|
llm=self.llm, args=args, sources=pp.sources
|
|
59
62
|
)
|
|
63
|
+
if args.in_code_apply:
|
|
64
|
+
args.query = old_query
|
|
60
65
|
|
|
61
66
|
if args.image_file:
|
|
62
67
|
if args.image_mode == "iterative":
|
|
@@ -256,11 +261,17 @@ class ActionPyProject(BaseAction):
|
|
|
256
261
|
pp = PyProject(args=self.args, llm=self.llm)
|
|
257
262
|
self.pp = pp
|
|
258
263
|
pp.run(packages=args.py_packages.split(",") if args.py_packages else [])
|
|
259
|
-
source_code = pp.output()
|
|
264
|
+
source_code = pp.output()
|
|
265
|
+
|
|
260
266
|
if self.llm:
|
|
267
|
+
old_query = args.query
|
|
268
|
+
if args.in_code_apply:
|
|
269
|
+
args.query = (args.context or "") + "\n\n" + args.query
|
|
261
270
|
source_code = build_index_and_filter_files(
|
|
262
271
|
llm=self.llm, args=args, sources=pp.sources
|
|
263
272
|
)
|
|
273
|
+
if args.in_code_apply:
|
|
274
|
+
args.query = old_query
|
|
264
275
|
|
|
265
276
|
self.process_content(source_code)
|
|
266
277
|
return True
|
|
@@ -355,9 +366,14 @@ class ActionSuffixProject(BaseAction):
|
|
|
355
366
|
pp.run()
|
|
356
367
|
source_code = pp.output()
|
|
357
368
|
if self.llm:
|
|
369
|
+
if args.in_code_apply:
|
|
370
|
+
old_query = args.query
|
|
371
|
+
args.query = (args.context or "") + "\n\n" + args.query
|
|
358
372
|
source_code = build_index_and_filter_files(
|
|
359
373
|
llm=self.llm, args=args, sources=pp.sources
|
|
360
374
|
)
|
|
375
|
+
if args.in_code_apply:
|
|
376
|
+
args.query = old_query
|
|
361
377
|
self.process_content(source_code)
|
|
362
378
|
|
|
363
379
|
def process_content(self, content: str):
|
|
@@ -9,7 +9,7 @@ from autocoder.common.JupyterClient import JupyterNotebook
|
|
|
9
9
|
from autocoder.common.ShellClient import ShellClient
|
|
10
10
|
from autocoder.suffixproject import SuffixProject
|
|
11
11
|
from autocoder.common.search import Search, SearchEngine
|
|
12
|
-
from autocoder.index.
|
|
12
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
13
13
|
from autocoder.common.image_to_page import ImageToPage, ImageToPageDirectly
|
|
14
14
|
from typing import Optional, Dict, Any, List
|
|
15
15
|
import byzerllm
|
|
@@ -9,7 +9,7 @@ from autocoder.common.code_auto_generate import CodeAutoGenerate
|
|
|
9
9
|
from autocoder.common.code_auto_generate_diff import CodeAutoGenerateDiff
|
|
10
10
|
from autocoder.common.code_auto_generate_strict_diff import CodeAutoGenerateStrictDiff
|
|
11
11
|
from autocoder.common.code_auto_generate_editblock import CodeAutoGenerateEditBlock
|
|
12
|
-
from autocoder.index.
|
|
12
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
13
13
|
from autocoder.regexproject import RegexProject
|
|
14
14
|
from autocoder.utils.conversation_store import store_code_model_conversation
|
|
15
15
|
from loguru import logger
|
|
@@ -36,9 +36,14 @@ class ActionRegexProject:
|
|
|
36
36
|
pp.run()
|
|
37
37
|
source_code = pp.output()
|
|
38
38
|
if self.llm:
|
|
39
|
+
if args.in_code_apply:
|
|
40
|
+
old_query = args.query
|
|
41
|
+
args.query = (args.context or "") + "\n\n" + args.query
|
|
39
42
|
source_code = build_index_and_filter_files(
|
|
40
43
|
llm=self.llm, args=args, sources=pp.sources
|
|
41
44
|
)
|
|
45
|
+
if args.in_code_apply:
|
|
46
|
+
args.query = old_query
|
|
42
47
|
self.process_content(source_code)
|
|
43
48
|
|
|
44
49
|
def process_content(self, content: str):
|