auto-coder 0.1.235__py3-none-any.whl → 0.1.237__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.235.dist-info → auto_coder-0.1.237.dist-info}/METADATA +2 -2
- {auto_coder-0.1.235.dist-info → auto_coder-0.1.237.dist-info}/RECORD +21 -20
- autocoder/auto_coder.py +3 -2
- autocoder/chat_auto_coder.py +78 -83
- autocoder/chat_auto_coder_lang.py +69 -17
- autocoder/common/auto_coder_lang.py +55 -4
- autocoder/common/code_auto_merge.py +12 -9
- autocoder/common/code_auto_merge_diff.py +5 -4
- autocoder/common/code_auto_merge_editblock.py +35 -33
- autocoder/common/code_auto_merge_strict_diff.py +5 -4
- autocoder/common/code_modification_ranker.py +74 -44
- autocoder/common/printer.py +22 -9
- autocoder/dispacher/actions/action.py +51 -18
- autocoder/index/entry.py +19 -6
- autocoder/index/filter/quick_filter.py +1 -1
- autocoder/utils/types.py +0 -0
- autocoder/version.py +1 -1
- {auto_coder-0.1.235.dist-info → auto_coder-0.1.237.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.235.dist-info → auto_coder-0.1.237.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.235.dist-info → auto_coder-0.1.237.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.235.dist-info → auto_coder-0.1.237.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.237
|
|
4
4
|
Summary: AutoCoder: AutoCoder
|
|
5
5
|
Author: allwefantasy
|
|
6
6
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
@@ -26,7 +26,7 @@ Requires-Dist: tabulate
|
|
|
26
26
|
Requires-Dist: jupyter-client
|
|
27
27
|
Requires-Dist: prompt-toolkit
|
|
28
28
|
Requires-Dist: tokenizers
|
|
29
|
-
Requires-Dist: byzerllm[saas] >=0.1.
|
|
29
|
+
Requires-Dist: byzerllm[saas] >=0.1.153
|
|
30
30
|
Requires-Dist: patch
|
|
31
31
|
Requires-Dist: diff-match-patch
|
|
32
32
|
Requires-Dist: GitPython
|
|
@@ -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=u2SzAIpYXwhFfcyZyI-td6M3-JFWC9fCS2wyrytNE8s,61172
|
|
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=DrTJcp0VeGFhNqepMZ26aWbOdiqWnaKEqIs5cA3Uk1s,103175
|
|
10
|
+
autocoder/chat_auto_coder_lang.py,sha256=rS6hD5ZiNLaQZx36WO4LohRBEN8uZfsgv3QEM7ax03A,14540
|
|
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=wmhLaqzrzkDSM5sEXBMgkNybjluYD_F5D7T5b5AEQR0,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
|
|
@@ -28,7 +28,7 @@ autocoder/common/__init__.py,sha256=vpfo3RctksezDoraVSpHtfnxpspVNiYh8OmQhqQvcfE,
|
|
|
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=
|
|
31
|
+
autocoder/common/auto_coder_lang.py,sha256=TzS9SXzq3n-cwCKvDgic7RJe0_cyiKMeL5yzxbqvM5s,10868
|
|
32
32
|
autocoder/common/buildin_tokenizer.py,sha256=L7d5t39ZFvUd6EoMPXUhYK1toD0FHlRH1jtjKRGokWU,1236
|
|
33
33
|
autocoder/common/chunk_validation.py,sha256=BrR_ZWavW8IANuueEE7hS8NFAwEvm8TX34WnPx_1hs8,3030
|
|
34
34
|
autocoder/common/cleaner.py,sha256=NU72i8C6o9m0vXExab7nao5bstBUsfJFcj11cXa9l4U,1089
|
|
@@ -37,11 +37,11 @@ autocoder/common/code_auto_generate.py,sha256=5lEW9iudGYQIcd_QjrGyGaEmrWuyZ625PN
|
|
|
37
37
|
autocoder/common/code_auto_generate_diff.py,sha256=o5yeqpc3WXSRWlcLzhlwJNosKo7dcj0CeIsFh6Aibus,16248
|
|
38
38
|
autocoder/common/code_auto_generate_editblock.py,sha256=QdUHUkGaervvQNCY8T2vQ_tfnQX_2kxxu4qq_QW_Nn8,17828
|
|
39
39
|
autocoder/common/code_auto_generate_strict_diff.py,sha256=uteWDEHfIbrnVgwKgqC7qwrIeW0enJCXcHzZGa48yY8,14774
|
|
40
|
-
autocoder/common/code_auto_merge.py,sha256=
|
|
41
|
-
autocoder/common/code_auto_merge_diff.py,sha256=
|
|
42
|
-
autocoder/common/code_auto_merge_editblock.py,sha256=
|
|
43
|
-
autocoder/common/code_auto_merge_strict_diff.py,sha256=
|
|
44
|
-
autocoder/common/code_modification_ranker.py,sha256=
|
|
40
|
+
autocoder/common/code_auto_merge.py,sha256=8dtnz61l0B5gNbQmx26TZ4_jD825dsnnWtAFD_zs6es,7335
|
|
41
|
+
autocoder/common/code_auto_merge_diff.py,sha256=yocfe8s3Pz6hTGDUl9wRIewY3NcTize_gEla64lsGT0,15331
|
|
42
|
+
autocoder/common/code_auto_merge_editblock.py,sha256=B-zDKGEJ7uRFPLIasnX7w2I2DXe5UAj1T-rDSjL4xes,17477
|
|
43
|
+
autocoder/common/code_auto_merge_strict_diff.py,sha256=9rm0NJ_n6M3LohEX7xl1Jym0xmm8UEYqj_ZTSO3oSlM,9519
|
|
44
|
+
autocoder/common/code_modification_ranker.py,sha256=E3TuI2_KuX3PiR-V3atB2wmXkZUzhNFhuWz3ztg2QDc,6198
|
|
45
45
|
autocoder/common/command_completer.py,sha256=SSeb8MDH0JPvfdyW-S2uaHnui4VBDfSQvQPLbv3ORPA,9314
|
|
46
46
|
autocoder/common/command_generator.py,sha256=v4LmU7sO-P7jEZIXCWHUC6P-vT7AvBi_x_PTwCqBAE8,1323
|
|
47
47
|
autocoder/common/command_templates.py,sha256=mnB3n8i0yjH1mqzyClEg8Wpr9VbZV44kxky66Zu6OJY,8557
|
|
@@ -55,7 +55,7 @@ autocoder/common/mcp_hub.py,sha256=2ZyJv3Aiv4Y97UHut49oYhIFcu7ICR-mptDEBSgT3uE,1
|
|
|
55
55
|
autocoder/common/mcp_server.py,sha256=QCFa-15kx7rbNsinwdGFFX2y47pww0fVdI-ldKFSSWI,12267
|
|
56
56
|
autocoder/common/mcp_tools.py,sha256=KsLvRrB6pvmebqd-lDaSH6IBJR0AIxWRE-dtCEG_w9k,12485
|
|
57
57
|
autocoder/common/memory_manager.py,sha256=2ZjYG7BPyvbYalZBF6AM_G5e10Qkw_zrqtD4Zd7GSsQ,3663
|
|
58
|
-
autocoder/common/printer.py,sha256=
|
|
58
|
+
autocoder/common/printer.py,sha256=heFhcI_Qdc3lfHquL-9ys66N7drGBxRDF6QXbBmh76o,1905
|
|
59
59
|
autocoder/common/recall_validation.py,sha256=Avt9Q9dX3kG6Pf2zsdlOHmsjd-OeSj7U1PFBDp_Cve0,1700
|
|
60
60
|
autocoder/common/screenshots.py,sha256=_gA-z1HxGjPShBrtgkdideq58MG6rqFB2qMUJKjrycs,3769
|
|
61
61
|
autocoder/common/search.py,sha256=245iPFgWhMldoUK3CqCP89ltaxZiNPK73evoG6Fp1h8,16518
|
|
@@ -71,20 +71,20 @@ autocoder/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
71
71
|
autocoder/db/store.py,sha256=tFT66bP2ZKIqZip-uhLkHRSLaaOAUUDZfozJwcqix3c,1908
|
|
72
72
|
autocoder/dispacher/__init__.py,sha256=YoA64dIxnx4jcE1pwSfg81sjkQtjDkhddkfac1-cMWo,1230
|
|
73
73
|
autocoder/dispacher/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
-
autocoder/dispacher/actions/action.py,sha256=
|
|
74
|
+
autocoder/dispacher/actions/action.py,sha256=2i9xPgbw6Jn0g3TFIa0JW6FJ21HoOV13J_dYNi9nCEc,20732
|
|
75
75
|
autocoder/dispacher/actions/copilot.py,sha256=iMh4ckj9hO5Q-iemF3CStXd7DatWai7Eci5zOlKxK9c,13072
|
|
76
76
|
autocoder/dispacher/actions/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
77
|
autocoder/dispacher/actions/plugins/action_regex_project.py,sha256=ht_HWzZt84IEogoFMggnXI6aFFerrsuksVflAkcodfU,5545
|
|
78
78
|
autocoder/dispacher/actions/plugins/action_translate.py,sha256=nVAtRSQpdGNmZxg1R_9zXG3AuTv3CHf2v7ODgj8u65c,7727
|
|
79
79
|
autocoder/index/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
|
-
autocoder/index/entry.py,sha256=
|
|
80
|
+
autocoder/index/entry.py,sha256=KJaxqtaKgL27w8-j7OiAqI0anPpmrJSl7PkfeVF2ipE,11713
|
|
81
81
|
autocoder/index/for_command.py,sha256=LGnz-OWogT8rd24m4Zcan7doLaijxqorAuiMk7WuRq0,3125
|
|
82
82
|
autocoder/index/index.py,sha256=HfWN0Mbk22S81-fnm9wrYNJO9Bcnws4G_PxJ8IQuH5A,20175
|
|
83
83
|
autocoder/index/symbols_utils.py,sha256=CjcjUVajmJZB75Ty3a7kMv1BZphrm-tIBAdOJv6uo-0,2037
|
|
84
84
|
autocoder/index/types.py,sha256=a2s_KV5FJlq7jqA2ELSo9E1sjuLwDB-JJYMhSpzBAhU,596
|
|
85
85
|
autocoder/index/filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
86
|
autocoder/index/filter/normal_filter.py,sha256=pE5QwcBq6NYHFtYhwhfMJmYQYJwErNs-Q7iZmVBAh-k,7964
|
|
87
|
-
autocoder/index/filter/quick_filter.py,sha256=
|
|
87
|
+
autocoder/index/filter/quick_filter.py,sha256=Po32nJFAbAwb7kMaNkCrL5-ZjVE-Pobm5wzXyw9Y8iE,3882
|
|
88
88
|
autocoder/pyproject/__init__.py,sha256=dQ2_7YZ7guybT9BhfxSGn43eLQJGQN2zgeKa6--JlaQ,14403
|
|
89
89
|
autocoder/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
90
90
|
autocoder/rag/api_server.py,sha256=dRbhAZVRAOlZ64Cnxf4_rKb4iJwHnrWS9Zr67IVORw0,7288
|
|
@@ -136,12 +136,13 @@ autocoder/utils/request_event_queue.py,sha256=r3lo5qGsB1dIjzVQ05dnr0z_9Z3zOkBdP1
|
|
|
136
136
|
autocoder/utils/request_queue.py,sha256=nwp6PMtgTCiuwJI24p8OLNZjUiprC-TsefQrhMI-yPE,3889
|
|
137
137
|
autocoder/utils/rest.py,sha256=opE_kBEdNQdxh350M5lUTMk5TViRfpuKP_qWc0B1lks,8861
|
|
138
138
|
autocoder/utils/tests.py,sha256=BqphrwyycGAvs-5mhH8pKtMZdObwhFtJ5MC_ZAOiLq8,1340
|
|
139
|
+
autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
139
140
|
autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
140
141
|
autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=6D_SIa5hHSwIHC1poO_ztK7IVugAqNHu-jQySd7EnfQ,4181
|
|
141
142
|
autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
142
|
-
auto_coder-0.1.
|
|
143
|
-
auto_coder-0.1.
|
|
144
|
-
auto_coder-0.1.
|
|
145
|
-
auto_coder-0.1.
|
|
146
|
-
auto_coder-0.1.
|
|
147
|
-
auto_coder-0.1.
|
|
143
|
+
auto_coder-0.1.237.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
144
|
+
auto_coder-0.1.237.dist-info/METADATA,sha256=iwXDoHyiKp014_5DEJ8XHf6pl6d6JdejBxaKbNOtEIA,2616
|
|
145
|
+
auto_coder-0.1.237.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
146
|
+
auto_coder-0.1.237.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
|
|
147
|
+
auto_coder-0.1.237.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
|
|
148
|
+
auto_coder-0.1.237.dist-info/RECORD,,
|
autocoder/auto_coder.py
CHANGED
|
@@ -44,7 +44,7 @@ from autocoder.common.memory_manager import save_to_memory_file
|
|
|
44
44
|
from autocoder import models as models_module
|
|
45
45
|
from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
|
|
46
46
|
from autocoder.utils.auto_coder_utils.chat_stream_out import stream_out
|
|
47
|
-
|
|
47
|
+
from autocoder.common.printer import Printer
|
|
48
48
|
console = Console()
|
|
49
49
|
|
|
50
50
|
|
|
@@ -1307,7 +1307,8 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1307
1307
|
save_to_memory_file(ask_conversation=chat_history["ask_conversation"],
|
|
1308
1308
|
query=args.query,
|
|
1309
1309
|
response=result)
|
|
1310
|
-
|
|
1310
|
+
printer = Printer()
|
|
1311
|
+
printer.print_in_terminal("memory_save_success")
|
|
1311
1312
|
return {}
|
|
1312
1313
|
|
|
1313
1314
|
if "rag" in args.action:
|
autocoder/chat_auto_coder.py
CHANGED
|
@@ -53,6 +53,7 @@ from autocoder import models
|
|
|
53
53
|
import shlex
|
|
54
54
|
from autocoder.utils.llms import get_single_llm
|
|
55
55
|
import pkg_resources
|
|
56
|
+
from autocoder.common.printer import Printer
|
|
56
57
|
|
|
57
58
|
class SymbolItem(BaseModel):
|
|
58
59
|
symbol_name: str
|
|
@@ -537,32 +538,31 @@ def redirect_stdout():
|
|
|
537
538
|
|
|
538
539
|
|
|
539
540
|
def configure(conf: str, skip_print=False):
|
|
541
|
+
printer = Printer()
|
|
540
542
|
parts = conf.split(None, 1)
|
|
541
543
|
if len(parts) == 2 and parts[0] in ["/drop", "/unset", "/remove"]:
|
|
542
544
|
key = parts[1].strip()
|
|
543
545
|
if key in memory["conf"]:
|
|
544
546
|
del memory["conf"][key]
|
|
545
547
|
save_memory()
|
|
546
|
-
|
|
548
|
+
printer.print_in_terminal("config_delete_success", style="green", key=key)
|
|
547
549
|
else:
|
|
548
|
-
|
|
550
|
+
printer.print_in_terminal("config_not_found", style="yellow", key=key)
|
|
549
551
|
else:
|
|
550
552
|
parts = conf.split(":", 1)
|
|
551
553
|
if len(parts) != 2:
|
|
552
|
-
|
|
553
|
-
"\033[91mError: Invalid configuration format. Use 'key:value' or '/drop key'.\033[0m"
|
|
554
|
-
)
|
|
554
|
+
printer.print_in_terminal("config_invalid_format", style="red")
|
|
555
555
|
return
|
|
556
556
|
key, value = parts
|
|
557
557
|
key = key.strip()
|
|
558
558
|
value = value.strip()
|
|
559
559
|
if not value:
|
|
560
|
-
|
|
560
|
+
printer.print_in_terminal("config_value_empty", style="red")
|
|
561
561
|
return
|
|
562
562
|
memory["conf"][key] = value
|
|
563
563
|
save_memory()
|
|
564
564
|
if not skip_print:
|
|
565
|
-
|
|
565
|
+
printer.print_in_terminal("config_set_success", style="green", key=key, value=value)
|
|
566
566
|
|
|
567
567
|
# word_completer = WordCompleter(commands)
|
|
568
568
|
|
|
@@ -1031,15 +1031,10 @@ def add_files(args: List[str]):
|
|
|
1031
1031
|
groups_info = memory["current_files"]["groups_info"]
|
|
1032
1032
|
|
|
1033
1033
|
console = Console()
|
|
1034
|
+
printer = Printer()
|
|
1034
1035
|
|
|
1035
1036
|
if not args:
|
|
1036
|
-
|
|
1037
|
-
Panel(
|
|
1038
|
-
"Please provide arguments for the /add_files command.",
|
|
1039
|
-
title="Error",
|
|
1040
|
-
border_style="red",
|
|
1041
|
-
)
|
|
1042
|
-
)
|
|
1037
|
+
printer.print_in_terminal("add_files_no_args", style="red")
|
|
1043
1038
|
return
|
|
1044
1039
|
|
|
1045
1040
|
if args[0] == "/refresh":
|
|
@@ -1253,7 +1248,7 @@ def add_files(args: List[str]):
|
|
|
1253
1248
|
if files_to_add:
|
|
1254
1249
|
memory["current_files"]["files"].extend(files_to_add)
|
|
1255
1250
|
table = Table(
|
|
1256
|
-
title="
|
|
1251
|
+
title=get_message("add_files_added_files"),
|
|
1257
1252
|
show_header=True,
|
|
1258
1253
|
header_style="bold magenta",
|
|
1259
1254
|
show_lines=True, # 这会在每行之间添加分割线
|
|
@@ -1268,29 +1263,20 @@ def add_files(args: List[str]):
|
|
|
1268
1263
|
)
|
|
1269
1264
|
console.print(Panel(table, border_style="green"))
|
|
1270
1265
|
else:
|
|
1271
|
-
|
|
1272
|
-
Panel(
|
|
1273
|
-
"All specified files are already in the current session or no matches found.",
|
|
1274
|
-
title="No Files Added",
|
|
1275
|
-
border_style="yellow",
|
|
1276
|
-
)
|
|
1277
|
-
)
|
|
1266
|
+
printer.print_in_terminal("add_files_matched", style="yellow")
|
|
1278
1267
|
|
|
1279
1268
|
completer.update_current_files(memory["current_files"]["files"])
|
|
1280
1269
|
save_memory()
|
|
1281
1270
|
|
|
1282
1271
|
|
|
1283
1272
|
def remove_files(file_names: List[str]):
|
|
1284
|
-
console = Console()
|
|
1285
1273
|
project_root = os.getcwd()
|
|
1274
|
+
printer = Printer()
|
|
1286
1275
|
|
|
1287
1276
|
if "/all" in file_names:
|
|
1288
1277
|
memory["current_files"]["files"] = []
|
|
1289
1278
|
memory["current_files"]["current_groups"] = []
|
|
1290
|
-
|
|
1291
|
-
Panel("Removed all files.",
|
|
1292
|
-
title="Files Removed", border_style="green")
|
|
1293
|
-
)
|
|
1279
|
+
printer.print_in_terminal("remove_files_all", style="green")
|
|
1294
1280
|
else:
|
|
1295
1281
|
removed_files = []
|
|
1296
1282
|
for file in memory["current_files"]["files"]:
|
|
@@ -1302,21 +1288,20 @@ def remove_files(file_names: List[str]):
|
|
|
1302
1288
|
memory["current_files"]["files"].remove(file)
|
|
1303
1289
|
|
|
1304
1290
|
if removed_files:
|
|
1305
|
-
table = Table(
|
|
1306
|
-
|
|
1291
|
+
table = Table(
|
|
1292
|
+
show_header=True,
|
|
1293
|
+
header_style="bold magenta"
|
|
1307
1294
|
)
|
|
1308
1295
|
table.add_column("File", style="green")
|
|
1309
1296
|
for f in removed_files:
|
|
1310
1297
|
table.add_row(os.path.relpath(f, project_root))
|
|
1311
|
-
|
|
1312
|
-
|
|
1298
|
+
|
|
1299
|
+
console = Console()
|
|
1313
1300
|
console.print(
|
|
1314
|
-
Panel(
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
)
|
|
1319
|
-
)
|
|
1301
|
+
Panel(table, border_style="green",
|
|
1302
|
+
title=printer.get_message_from_key("files_removed")))
|
|
1303
|
+
else:
|
|
1304
|
+
printer.print_in_terminal("remove_files_none", style="yellow")
|
|
1320
1305
|
|
|
1321
1306
|
completer.update_current_files(memory["current_files"]["files"])
|
|
1322
1307
|
save_memory()
|
|
@@ -1426,6 +1411,7 @@ def convert_yaml_to_config(yaml_file: str):
|
|
|
1426
1411
|
def mcp(query: str):
|
|
1427
1412
|
query = query.strip()
|
|
1428
1413
|
mcp_server = get_mcp_server()
|
|
1414
|
+
printer = Printer()
|
|
1429
1415
|
|
|
1430
1416
|
# Handle remove command
|
|
1431
1417
|
if query.startswith("/remove"):
|
|
@@ -1433,29 +1419,29 @@ def mcp(query: str):
|
|
|
1433
1419
|
response = mcp_server.send_request(
|
|
1434
1420
|
McpRemoveRequest(server_name=server_name))
|
|
1435
1421
|
if response.error:
|
|
1436
|
-
|
|
1422
|
+
printer.print_in_terminal("mcp_remove_error", style="red", error=response.error)
|
|
1437
1423
|
else:
|
|
1438
|
-
|
|
1424
|
+
printer.print_in_terminal("mcp_remove_success", style="green", result=response.result)
|
|
1439
1425
|
return
|
|
1440
1426
|
|
|
1441
1427
|
# Handle list command
|
|
1442
1428
|
if query.startswith("/list_running"):
|
|
1443
1429
|
response = mcp_server.send_request(McpListRunningRequest())
|
|
1444
1430
|
if response.error:
|
|
1445
|
-
|
|
1431
|
+
printer.print_in_terminal("mcp_list_running_error", style="red", error=response.error)
|
|
1446
1432
|
else:
|
|
1447
|
-
|
|
1448
|
-
|
|
1433
|
+
printer.print_in_terminal("mcp_list_running_title")
|
|
1434
|
+
printer.print_str_in_terminal(response.result)
|
|
1449
1435
|
return
|
|
1450
1436
|
|
|
1451
1437
|
# Handle list command
|
|
1452
1438
|
if query.startswith("/list"):
|
|
1453
1439
|
response = mcp_server.send_request(McpListRequest())
|
|
1454
1440
|
if response.error:
|
|
1455
|
-
|
|
1441
|
+
printer.print_in_terminal("mcp_list_builtin_error", style="red", error=response.error)
|
|
1456
1442
|
else:
|
|
1457
|
-
|
|
1458
|
-
|
|
1443
|
+
printer.print_in_terminal("mcp_list_builtin_title")
|
|
1444
|
+
printer.print_str_in_terminal(response.result)
|
|
1459
1445
|
return
|
|
1460
1446
|
|
|
1461
1447
|
# Handle refresh command
|
|
@@ -1463,9 +1449,9 @@ def mcp(query: str):
|
|
|
1463
1449
|
server_name = query.replace("/refresh", "", 1).strip()
|
|
1464
1450
|
response = mcp_server.send_request(McpRefreshRequest(name=server_name or None))
|
|
1465
1451
|
if response.error:
|
|
1466
|
-
|
|
1452
|
+
printer.print_in_terminal("mcp_refresh_error", style="red", error=response.error)
|
|
1467
1453
|
else:
|
|
1468
|
-
|
|
1454
|
+
printer.print_in_terminal("mcp_refresh_success", style="green")
|
|
1469
1455
|
return
|
|
1470
1456
|
|
|
1471
1457
|
# Handle add command
|
|
@@ -1475,9 +1461,9 @@ def mcp(query: str):
|
|
|
1475
1461
|
response = mcp_server.send_request(request)
|
|
1476
1462
|
|
|
1477
1463
|
if response.error:
|
|
1478
|
-
|
|
1464
|
+
printer.print_in_terminal("mcp_install_error", style="red", error=response.error)
|
|
1479
1465
|
else:
|
|
1480
|
-
|
|
1466
|
+
printer.print_in_terminal("mcp_install_success", style="green", result=response.result)
|
|
1481
1467
|
return
|
|
1482
1468
|
|
|
1483
1469
|
# Handle default query
|
|
@@ -1513,13 +1499,16 @@ def mcp(query: str):
|
|
|
1513
1499
|
model=args.inference_model or args.model
|
|
1514
1500
|
)
|
|
1515
1501
|
)
|
|
1516
|
-
|
|
1502
|
+
|
|
1517
1503
|
if response.error:
|
|
1518
|
-
|
|
1504
|
+
printer.print_panel(
|
|
1519
1505
|
f"Error from MCP server: {response.error}",
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1506
|
+
text_options={"justify": "left"},
|
|
1507
|
+
panel_options={
|
|
1508
|
+
"title": printer.get_message_from_key("mcp_error_title"),
|
|
1509
|
+
"border_style": "red"
|
|
1510
|
+
}
|
|
1511
|
+
)
|
|
1523
1512
|
else:
|
|
1524
1513
|
# Save conversation
|
|
1525
1514
|
mcp_dir = os.path.join(".auto-coder", "mcp", "conversations")
|
|
@@ -1528,17 +1517,20 @@ def mcp(query: str):
|
|
|
1528
1517
|
file_path = os.path.join(mcp_dir, f"{timestamp}.md")
|
|
1529
1518
|
|
|
1530
1519
|
# Format response as markdown
|
|
1531
|
-
markdown_content = f"#
|
|
1520
|
+
markdown_content = f"# {printer.get_message_from_key('mcp_response_title')}\n\n{response.result}"
|
|
1532
1521
|
|
|
1533
1522
|
# Save to file
|
|
1534
1523
|
with open(file_path, "w", encoding="utf-8") as f:
|
|
1535
1524
|
f.write(markdown_content)
|
|
1536
1525
|
|
|
1537
1526
|
# Print with markdown formatting
|
|
1538
|
-
|
|
1539
|
-
Markdown(markdown_content),
|
|
1540
|
-
|
|
1541
|
-
|
|
1527
|
+
printer.print_panel(
|
|
1528
|
+
Markdown(markdown_content),
|
|
1529
|
+
text_options={"justify": "left"},
|
|
1530
|
+
panel_options={
|
|
1531
|
+
"border_style": "green"
|
|
1532
|
+
}
|
|
1533
|
+
)
|
|
1542
1534
|
|
|
1543
1535
|
|
|
1544
1536
|
def code_next(query: str):
|
|
@@ -2104,11 +2096,11 @@ def manage_models(params, query: str):
|
|
|
2104
2096
|
/models /add_model name=xxx base_url=xxx ... - Add model with custom params
|
|
2105
2097
|
/models /remove <name> - Remove model by name
|
|
2106
2098
|
"""
|
|
2107
|
-
|
|
2099
|
+
printer = Printer()
|
|
2108
2100
|
console = Console()
|
|
2109
2101
|
|
|
2110
2102
|
if params.product_mode != "lite":
|
|
2111
|
-
|
|
2103
|
+
printer.print_in_terminal("models_lite_only", style="red")
|
|
2112
2104
|
return
|
|
2113
2105
|
|
|
2114
2106
|
models_data = models.load_models()
|
|
@@ -2128,17 +2120,21 @@ def manage_models(params, query: str):
|
|
|
2128
2120
|
if "/remove" in query:
|
|
2129
2121
|
subcmd = "/remove"
|
|
2130
2122
|
query = query.replace("/remove", "", 1).strip()
|
|
2123
|
+
|
|
2131
2124
|
if not subcmd:
|
|
2132
|
-
|
|
2125
|
+
printer.print_in_terminal("models_usage")
|
|
2133
2126
|
return
|
|
2134
2127
|
|
|
2135
2128
|
if subcmd == "/list":
|
|
2136
2129
|
if models_data:
|
|
2137
|
-
table = Table(
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2130
|
+
table = Table(
|
|
2131
|
+
title=printer.get_message_from_key("models_title"),
|
|
2132
|
+
expand=True,
|
|
2133
|
+
show_lines=True
|
|
2134
|
+
)
|
|
2135
|
+
table.add_column("Name", style="cyan", width=40, no_wrap=False)
|
|
2136
|
+
table.add_column("Model Name", style="magenta", width=30, overflow="fold")
|
|
2137
|
+
table.add_column("Description", style="white", width=50, overflow="fold")
|
|
2142
2138
|
for m in models_data:
|
|
2143
2139
|
# Check if api_key_path exists and file exists
|
|
2144
2140
|
api_key_path = m.get("api_key_path", "")
|
|
@@ -2146,17 +2142,16 @@ def manage_models(params, query: str):
|
|
|
2146
2142
|
if api_key_path:
|
|
2147
2143
|
api_key_file = os.path.expanduser(f"~/.auto-coder/keys/{api_key_path}")
|
|
2148
2144
|
if os.path.exists(api_key_file):
|
|
2149
|
-
name = f"{name}*"
|
|
2150
|
-
|
|
2145
|
+
name = f"{name}*"
|
|
2146
|
+
|
|
2151
2147
|
table.add_row(
|
|
2152
|
-
name,
|
|
2153
|
-
m.get("model_type", ""),
|
|
2148
|
+
name,
|
|
2154
2149
|
m.get("model_name", ""),
|
|
2155
2150
|
m.get("description", "")
|
|
2156
2151
|
)
|
|
2157
2152
|
console.print(table)
|
|
2158
2153
|
else:
|
|
2159
|
-
|
|
2154
|
+
printer.print_in_terminal("models_no_models", style="yellow")
|
|
2160
2155
|
|
|
2161
2156
|
elif subcmd == "/add":
|
|
2162
2157
|
# Support both simplified and legacy formats
|
|
@@ -2166,11 +2161,11 @@ def manage_models(params, query: str):
|
|
|
2166
2161
|
name, api_key = args[0], args[1]
|
|
2167
2162
|
result = models.update_model_with_api_key(name, api_key)
|
|
2168
2163
|
if result:
|
|
2169
|
-
|
|
2164
|
+
printer.print_in_terminal("models_added", style="green", name=name)
|
|
2170
2165
|
else:
|
|
2171
|
-
|
|
2166
|
+
printer.print_in_terminal("models_add_failed", style="red", name=name)
|
|
2172
2167
|
else:
|
|
2173
|
-
|
|
2168
|
+
printer.print_in_terminal("models_add_usage", style="red")
|
|
2174
2169
|
|
|
2175
2170
|
elif subcmd == "/add_model":
|
|
2176
2171
|
# Parse key=value pairs: /models /add_model name=abc base_url=http://xx ...
|
|
@@ -2179,19 +2174,19 @@ def manage_models(params, query: str):
|
|
|
2179
2174
|
data_dict = {}
|
|
2180
2175
|
for pair in kv_pairs:
|
|
2181
2176
|
if '=' not in pair:
|
|
2182
|
-
|
|
2177
|
+
printer.print_in_terminal("models_add_model_params", style="red")
|
|
2183
2178
|
continue
|
|
2184
2179
|
k, v = pair.split('=', 1)
|
|
2185
2180
|
data_dict[k.strip()] = v.strip()
|
|
2186
2181
|
|
|
2187
2182
|
# Name is required
|
|
2188
2183
|
if "name" not in data_dict:
|
|
2189
|
-
|
|
2184
|
+
printer.print_in_terminal("models_add_model_name_required", style="red")
|
|
2190
2185
|
return
|
|
2191
2186
|
|
|
2192
2187
|
# Check duplication
|
|
2193
2188
|
if any(m["name"] == data_dict["name"] for m in models_data):
|
|
2194
|
-
|
|
2189
|
+
printer.print_in_terminal("models_add_model_exists", style="yellow", name=data_dict["name"])
|
|
2195
2190
|
return
|
|
2196
2191
|
|
|
2197
2192
|
# Create model with defaults
|
|
@@ -2207,23 +2202,23 @@ def manage_models(params, query: str):
|
|
|
2207
2202
|
|
|
2208
2203
|
models_data.append(final_model)
|
|
2209
2204
|
models.save_models(models_data)
|
|
2210
|
-
|
|
2205
|
+
printer.print_in_terminal("models_add_model_success", style="green", name=data_dict["name"])
|
|
2211
2206
|
|
|
2212
2207
|
elif subcmd == "/remove":
|
|
2213
2208
|
args = query.strip().split(" ")
|
|
2214
2209
|
if len(args) < 1:
|
|
2215
|
-
|
|
2210
|
+
printer.print_in_terminal("models_add_usage", style="red")
|
|
2216
2211
|
return
|
|
2217
2212
|
name = args[0]
|
|
2218
2213
|
filtered_models = [m for m in models_data if m["name"] != name]
|
|
2219
2214
|
if len(filtered_models) == len(models_data):
|
|
2220
|
-
|
|
2215
|
+
printer.print_in_terminal("models_add_model_remove", style="yellow", name=name)
|
|
2221
2216
|
return
|
|
2222
2217
|
models.save_models(filtered_models)
|
|
2223
|
-
|
|
2218
|
+
printer.print_in_terminal("models_add_model_removed", style="green", name=name)
|
|
2224
2219
|
|
|
2225
2220
|
else:
|
|
2226
|
-
|
|
2221
|
+
printer.print_in_terminal("models_unknown_subcmd", style="yellow", subcmd=subcmd)
|
|
2227
2222
|
|
|
2228
2223
|
def exclude_dirs(dir_names: List[str]):
|
|
2229
2224
|
new_dirs = dir_names
|