auto-coder 0.1.305__py3-none-any.whl → 0.1.307__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.305.dist-info → auto_coder-0.1.307.dist-info}/METADATA +1 -1
- {auto_coder-0.1.305.dist-info → auto_coder-0.1.307.dist-info}/RECORD +43 -38
- autocoder/agent/auto_demand_organizer.py +13 -20
- autocoder/agent/auto_filegroup.py +10 -16
- autocoder/agent/auto_learn_from_commit.py +25 -33
- autocoder/agent/auto_review_commit.py +15 -64
- autocoder/auto_coder.py +6 -8
- autocoder/auto_coder_runner.py +153 -8
- autocoder/chat_auto_coder.py +9 -1
- autocoder/chat_auto_coder_lang.py +552 -278
- autocoder/commands/auto_command.py +31 -7
- autocoder/common/__init__.py +6 -0
- autocoder/common/action_yml_file_manager.py +75 -37
- autocoder/common/auto_coder_lang.py +737 -401
- autocoder/common/code_auto_generate.py +104 -16
- autocoder/common/code_auto_generate_diff.py +101 -10
- autocoder/common/code_auto_generate_editblock.py +103 -9
- autocoder/common/code_auto_generate_strict_diff.py +99 -9
- autocoder/common/code_auto_merge.py +8 -0
- autocoder/common/code_auto_merge_diff.py +8 -0
- autocoder/common/code_auto_merge_editblock.py +7 -0
- autocoder/common/code_auto_merge_strict_diff.py +5 -0
- autocoder/common/code_modification_ranker.py +9 -3
- autocoder/common/command_completer.py +12 -0
- autocoder/common/command_generator.py +5 -4
- autocoder/common/git_utils.py +86 -63
- autocoder/common/stream_out_type.py +8 -1
- autocoder/common/utils_code_auto_generate.py +29 -3
- autocoder/dispacher/__init__.py +18 -19
- autocoder/dispacher/actions/action.py +0 -132
- autocoder/index/filter/quick_filter.py +6 -3
- autocoder/memory/__init__.py +7 -0
- autocoder/memory/active_context_manager.py +649 -0
- autocoder/memory/active_package.py +469 -0
- autocoder/memory/async_processor.py +161 -0
- autocoder/memory/directory_mapper.py +67 -0
- autocoder/utils/auto_coder_utils/chat_stream_out.py +5 -0
- autocoder/utils/project_structure.py +35 -1
- autocoder/version.py +1 -1
- {auto_coder-0.1.305.dist-info → auto_coder-0.1.307.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.305.dist-info → auto_coder-0.1.307.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.305.dist-info → auto_coder-0.1.307.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.305.dist-info → auto_coder-0.1.307.dist-info}/top_level.txt +0 -0
autocoder/dispacher/__init__.py
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
|
|
2
1
|
from autocoder.common import AutoCoderArgs
|
|
3
2
|
from autocoder.dispacher.actions.copilot import ActionCopilot
|
|
4
|
-
from autocoder.dispacher.actions.action import
|
|
5
|
-
|
|
3
|
+
from autocoder.dispacher.actions.action import (
|
|
4
|
+
ActionTSProject,
|
|
5
|
+
ActionPyProject,
|
|
6
|
+
ActionSuffixProject,
|
|
7
|
+
)
|
|
6
8
|
from autocoder.dispacher.actions.plugins.action_regex_project import ActionRegexProject
|
|
7
9
|
from typing import Optional
|
|
8
10
|
import byzerllm
|
|
9
|
-
import re
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
class Dispacher:
|
|
14
|
+
def __init__(self, args: AutoCoderArgs, llm: Optional[byzerllm.ByzerLLM] = None):
|
|
13
15
|
self.args = args
|
|
14
|
-
self.llm = llm
|
|
16
|
+
self.llm = llm
|
|
15
17
|
|
|
16
18
|
def dispach(self):
|
|
17
|
-
args = self.args
|
|
18
|
-
actions = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
]
|
|
19
|
+
args = self.args
|
|
20
|
+
actions = [
|
|
21
|
+
ActionTSProject(args=args, llm=self.llm),
|
|
22
|
+
ActionPyProject(args=args, llm=self.llm),
|
|
23
|
+
ActionCopilot(args=args, llm=self.llm),
|
|
24
|
+
ActionRegexProject(args=args, llm=self.llm),
|
|
25
|
+
ActionSuffixProject(args=args, llm=self.llm),
|
|
26
|
+
]
|
|
26
27
|
for action in actions:
|
|
27
28
|
if action.run():
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
return
|
|
@@ -221,138 +221,6 @@ class ActionTSProject(BaseAction):
|
|
|
221
221
|
)
|
|
222
222
|
|
|
223
223
|
|
|
224
|
-
class ActionPyScriptProject(BaseAction):
|
|
225
|
-
def __init__(
|
|
226
|
-
self, args: AutoCoderArgs, llm: Optional[byzerllm.ByzerLLM] = None
|
|
227
|
-
) -> None:
|
|
228
|
-
self.args = args
|
|
229
|
-
self.llm = llm
|
|
230
|
-
self.printer = Printer()
|
|
231
|
-
|
|
232
|
-
def run(self) -> bool:
|
|
233
|
-
args = self.args
|
|
234
|
-
if args.project_type != "py-script":
|
|
235
|
-
return False
|
|
236
|
-
pp = Level1PyProject(
|
|
237
|
-
script_path=args.script_path, package_name=args.package_name
|
|
238
|
-
)
|
|
239
|
-
pp.run()
|
|
240
|
-
source_code_list = SourceCodeList(pp.sources)
|
|
241
|
-
self.process_content(source_code_list)
|
|
242
|
-
return True
|
|
243
|
-
|
|
244
|
-
def process_content(self, source_code_list: SourceCodeList):
|
|
245
|
-
args = self.args
|
|
246
|
-
global_cancel.check_and_raise()
|
|
247
|
-
|
|
248
|
-
if args.execute:
|
|
249
|
-
self.printer.print_in_terminal("code_generation_start")
|
|
250
|
-
start_time = time.time()
|
|
251
|
-
if args.auto_merge == "diff":
|
|
252
|
-
generate = CodeAutoGenerateDiff(
|
|
253
|
-
llm=self.llm, args=self.args, action=self
|
|
254
|
-
)
|
|
255
|
-
elif args.auto_merge == "strict_diff":
|
|
256
|
-
generate = CodeAutoGenerateStrictDiff(
|
|
257
|
-
llm=self.llm, args=self.args, action=self
|
|
258
|
-
)
|
|
259
|
-
elif args.auto_merge == "editblock":
|
|
260
|
-
generate = CodeAutoGenerateEditBlock(
|
|
261
|
-
llm=self.llm, args=self.args, action=self
|
|
262
|
-
)
|
|
263
|
-
else:
|
|
264
|
-
generate = CodeAutoGenerate(
|
|
265
|
-
llm=self.llm, args=self.args, action=self)
|
|
266
|
-
if self.args.enable_multi_round_generate:
|
|
267
|
-
generate_result = generate.multi_round_run(
|
|
268
|
-
query=args.query, source_code_list=source_code_list
|
|
269
|
-
)
|
|
270
|
-
else:
|
|
271
|
-
generate_result = generate.single_round_run(
|
|
272
|
-
query=args.query, source_code_list=source_code_list
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
elapsed_time = time.time() - start_time
|
|
276
|
-
speed = generate_result.metadata.get(
|
|
277
|
-
'generated_tokens_count', 0) / elapsed_time if elapsed_time > 0 else 0
|
|
278
|
-
model_names = ",".join(get_llm_names(generate.llms))
|
|
279
|
-
input_tokens_cost = generate_result.metadata.get(
|
|
280
|
-
'input_tokens_cost', 0)
|
|
281
|
-
generated_tokens_cost = generate_result.metadata.get(
|
|
282
|
-
'generated_tokens_cost', 0)
|
|
283
|
-
self.printer.print_in_terminal(
|
|
284
|
-
"code_generation_complete",
|
|
285
|
-
duration=elapsed_time,
|
|
286
|
-
input_tokens=generate_result.metadata.get(
|
|
287
|
-
'input_tokens_count', 0),
|
|
288
|
-
output_tokens=generate_result.metadata.get(
|
|
289
|
-
'generated_tokens_count', 0),
|
|
290
|
-
input_cost=input_tokens_cost,
|
|
291
|
-
output_cost=generated_tokens_cost,
|
|
292
|
-
speed=round(speed, 2),
|
|
293
|
-
model_names=model_names,
|
|
294
|
-
sampling_count=len(generate_result.contents)
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
get_event_manager(self.args.event_file).write_result(
|
|
298
|
-
EventContentCreator.create_result(content=EventContentCreator.ResultTokenStatContent(
|
|
299
|
-
model_name=model_names,
|
|
300
|
-
elapsed_time=elapsed_time,
|
|
301
|
-
input_tokens=generate_result.metadata.get(
|
|
302
|
-
'input_tokens_count', 0),
|
|
303
|
-
output_tokens=generate_result.metadata.get(
|
|
304
|
-
'generated_tokens_count', 0),
|
|
305
|
-
input_cost=input_tokens_cost,
|
|
306
|
-
output_cost=generated_tokens_cost,
|
|
307
|
-
speed=round(speed, 2)
|
|
308
|
-
)).to_dict(),metadata=EventMetadata(
|
|
309
|
-
action_file=self.args.file
|
|
310
|
-
).to_dict())
|
|
311
|
-
|
|
312
|
-
global_cancel.check_and_raise()
|
|
313
|
-
|
|
314
|
-
merge_result = None
|
|
315
|
-
if args.execute and args.auto_merge:
|
|
316
|
-
self.printer.print_in_terminal("code_merge_start")
|
|
317
|
-
if args.auto_merge == "diff":
|
|
318
|
-
code_merge = CodeAutoMergeDiff(
|
|
319
|
-
llm=self.llm, args=self.args)
|
|
320
|
-
merge_result = code_merge.merge_code(
|
|
321
|
-
generate_result=generate_result)
|
|
322
|
-
elif args.auto_merge == "strict_diff":
|
|
323
|
-
code_merge = CodeAutoMergeStrictDiff(
|
|
324
|
-
llm=self.llm, args=self.args)
|
|
325
|
-
merge_result = code_merge.merge_code(
|
|
326
|
-
generate_result=generate_result)
|
|
327
|
-
elif args.auto_merge == "editblock":
|
|
328
|
-
code_merge = CodeAutoMergeEditBlock(
|
|
329
|
-
llm=self.llm, args=self.args)
|
|
330
|
-
merge_result = code_merge.merge_code(
|
|
331
|
-
generate_result=generate_result)
|
|
332
|
-
else:
|
|
333
|
-
code_merge = CodeAutoMerge(llm=self.llm, args=self.args)
|
|
334
|
-
merge_result = code_merge.merge_code(
|
|
335
|
-
generate_result=generate_result)
|
|
336
|
-
|
|
337
|
-
content = merge_result.contents[0]
|
|
338
|
-
|
|
339
|
-
store_code_model_conversation(
|
|
340
|
-
args=self.args,
|
|
341
|
-
instruction=self.args.query,
|
|
342
|
-
conversations=merge_result.conversations[0],
|
|
343
|
-
model=self.llm.default_model_name,
|
|
344
|
-
)
|
|
345
|
-
else:
|
|
346
|
-
content = generate_result.contents[0]
|
|
347
|
-
|
|
348
|
-
store_code_model_conversation(
|
|
349
|
-
args=self.args,
|
|
350
|
-
instruction=self.args.query,
|
|
351
|
-
conversations=generate_result.conversations[0],
|
|
352
|
-
model=self.llm.default_model_name,
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
|
|
356
224
|
class ActionPyProject(BaseAction):
|
|
357
225
|
def __init__(
|
|
358
226
|
self, args: AutoCoderArgs, llm: Optional[byzerllm.ByzerLLM] = None
|
|
@@ -120,7 +120,8 @@ class QuickFilter():
|
|
|
120
120
|
self.index_manager.index_filter_llm,
|
|
121
121
|
[{"role": "user", "content": self.quick_filter_files.prompt(
|
|
122
122
|
chunk, self.args.query)}],
|
|
123
|
-
{}
|
|
123
|
+
{},
|
|
124
|
+
self.args
|
|
124
125
|
)
|
|
125
126
|
full_response, last_meta = stream_out(
|
|
126
127
|
stream_generator,
|
|
@@ -485,7 +486,8 @@ class QuickFilter():
|
|
|
485
486
|
stream_generator = stream_chat_with_continue(
|
|
486
487
|
self.index_manager.index_filter_llm,
|
|
487
488
|
[{"role": "user", "content": query}],
|
|
488
|
-
{}
|
|
489
|
+
{},
|
|
490
|
+
self.args
|
|
489
491
|
)
|
|
490
492
|
|
|
491
493
|
def extract_file_number_list(content: str) -> str:
|
|
@@ -760,7 +762,8 @@ class QuickFilter():
|
|
|
760
762
|
stream_generator = stream_chat_with_continue(
|
|
761
763
|
self.index_manager.index_filter_llm,
|
|
762
764
|
[{"role": "user", "content": prompt}],
|
|
763
|
-
{}
|
|
765
|
+
{},
|
|
766
|
+
self.args
|
|
764
767
|
)
|
|
765
768
|
|
|
766
769
|
def extract_file_number_list(content: str) -> str:
|