auto-coder 0.1.260__tar.gz → 0.1.262__tar.gz
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.260 → auto_coder-0.1.262}/PKG-INFO +2 -2
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/auto_coder.egg-info/PKG-INFO +2 -2
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/auto_coder.egg-info/SOURCES.txt +4 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/auto_coder.egg-info/requires.txt +1 -1
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/auto_review_commit.py +52 -25
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/chat_auto_coder.py +56 -6
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/chat_auto_coder_lang.py +18 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/commands/auto_command.py +42 -13
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/__init__.py +8 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/auto_coder_lang.py +29 -4
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_merge.py +2 -2
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_merge_diff.py +2 -2
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_merge_editblock.py +2 -2
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_merge_strict_diff.py +2 -2
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/command_completer.py +1 -10
- auto_coder-0.1.262/src/autocoder/common/conf_validator.py +245 -0
- auto_coder-0.1.262/src/autocoder/common/conversation_pruner.py +131 -0
- auto_coder-0.1.262/src/autocoder/common/index_import_export.py +101 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/shells.py +22 -6
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/dispacher/actions/action.py +37 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +11 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/entry.py +10 -10
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/filter/quick_filter.py +9 -5
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/symbols_utils.py +5 -2
- auto_coder-0.1.262/src/autocoder/utils/project_structure.py +15 -0
- auto_coder-0.1.262/src/autocoder/version.py +1 -0
- auto_coder-0.1.260/src/autocoder/version.py +0 -1
- {auto_coder-0.1.260 → auto_coder-0.1.262}/LICENSE +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/README.md +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/setup.cfg +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/setup.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/auto_coder.egg-info/dependency_links.txt +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/auto_coder.egg-info/entry_points.txt +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/auto_coder.egg-info/top_level.txt +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/auto_demand_organizer.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/auto_filegroup.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/auto_guess_query.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/auto_tool.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/coder.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/designer.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/planner.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/agent/project_reader.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/auto_coder.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/auto_coder_rag.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/auto_coder_rag_client_mcp.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/auto_coder_rag_mcp.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/auto_coder_server.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/benchmark.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/chat/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/command_args.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/commands/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/commands/tools.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/JupyterClient.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/ShellClient.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/anything2images.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/anything2img.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/audio.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/auto_configure.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/buildin_tokenizer.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/chunk_validation.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/cleaner.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_execute.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_generate.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_generate_diff.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/code_modification_ranker.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/command_generator.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/command_templates.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/const.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/files.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/git_utils.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/global_cancel.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/image_to_page.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/interpreter.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/llm_rerank.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/mcp_hub.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/mcp_server.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/mcp_servers/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/mcp_servers/mcp_server_perplexity.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/mcp_tools.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/memory_manager.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/model_speed_test.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/printer.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/recall_validation.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/result_manager.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/screenshots.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/search.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/search_replace.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/sys_prompt.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/text.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/types.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/common/utils_code_auto_generate.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/data/byzerllm.md +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/data/tokenizer.json +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/db/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/db/store.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/dispacher/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/dispacher/actions/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/dispacher/actions/copilot.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/filter/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/filter/normal_filter.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/for_command.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/index.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/index/types.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/lang.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/models.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/privacy/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/privacy/model_filter.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/pyproject/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/api_server.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/cache/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/cache/base_cache.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/cache/byzer_storage_cache.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/cache/simple_cache.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/doc_filter.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/document_retriever.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/llm_wrapper.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/loaders/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/loaders/docx_loader.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/loaders/excel_loader.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/long_context_rag.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/rag_config.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/rag_entry.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/raw_rag.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/relevant_utils.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/simple_directory_reader.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/simple_rag.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/stream_event/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/stream_event/event_writer.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/stream_event/types.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/token_checker.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/token_counter.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/token_limiter.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/types.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/utils.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/rag/variable_holder.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/regexproject/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/suffixproject/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/tsproject/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/_markitdown.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/auto_coder_utils/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/auto_coder_utils/chat_stream_out.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/chat_auto_coder_utils/__init__.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/conversation_store.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/llm_client_interceptors.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/llms.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/log_capture.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/model_provider_selector.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/multi_turn.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/operate_config_api.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/print_table.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/queue_communicate.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/request_event_queue.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/request_queue.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/rest.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/tests.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/thread_utils.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/src/autocoder/utils/types.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_action_regex_project.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_chat_auto_coder.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_command_completer.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_planner.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_privacy.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_queue_communicate.py +0 -0
- {auto_coder-0.1.260 → auto_coder-0.1.262}/tests/test_symbols_utils.py +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.262
|
|
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.167
|
|
30
30
|
Requires-Dist: patch
|
|
31
31
|
Requires-Dist: diff_match_patch
|
|
32
32
|
Requires-Dist: GitPython
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: auto-coder
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.262
|
|
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.167
|
|
30
30
|
Requires-Dist: patch
|
|
31
31
|
Requires-Dist: diff_match_patch
|
|
32
32
|
Requires-Dist: GitPython
|
|
@@ -58,11 +58,14 @@ src/autocoder/common/code_modification_ranker.py
|
|
|
58
58
|
src/autocoder/common/command_completer.py
|
|
59
59
|
src/autocoder/common/command_generator.py
|
|
60
60
|
src/autocoder/common/command_templates.py
|
|
61
|
+
src/autocoder/common/conf_validator.py
|
|
61
62
|
src/autocoder/common/const.py
|
|
63
|
+
src/autocoder/common/conversation_pruner.py
|
|
62
64
|
src/autocoder/common/files.py
|
|
63
65
|
src/autocoder/common/git_utils.py
|
|
64
66
|
src/autocoder/common/global_cancel.py
|
|
65
67
|
src/autocoder/common/image_to_page.py
|
|
68
|
+
src/autocoder/common/index_import_export.py
|
|
66
69
|
src/autocoder/common/interpreter.py
|
|
67
70
|
src/autocoder/common/llm_rerank.py
|
|
68
71
|
src/autocoder/common/mcp_hub.py
|
|
@@ -150,6 +153,7 @@ src/autocoder/utils/model_provider_selector.py
|
|
|
150
153
|
src/autocoder/utils/multi_turn.py
|
|
151
154
|
src/autocoder/utils/operate_config_api.py
|
|
152
155
|
src/autocoder/utils/print_table.py
|
|
156
|
+
src/autocoder/utils/project_structure.py
|
|
153
157
|
src/autocoder/utils/queue_communicate.py
|
|
154
158
|
src/autocoder/utils/request_event_queue.py
|
|
155
159
|
src/autocoder/utils/request_queue.py
|
|
@@ -8,6 +8,7 @@ from rich.console import Console
|
|
|
8
8
|
from autocoder.common.printer import Printer
|
|
9
9
|
from autocoder.common import AutoCoderArgs
|
|
10
10
|
from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
|
|
11
|
+
import hashlib
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
def load_yaml_config(yaml_file: str) -> Dict:
|
|
@@ -41,13 +42,13 @@ class AutoReviewCommit:
|
|
|
41
42
|
self.console = console or Console()
|
|
42
43
|
|
|
43
44
|
@byzerllm.prompt()
|
|
44
|
-
def review(self,
|
|
45
|
+
def review(self, querie_with_urls_and_changes: List[Tuple[str, List[str], Dict[str, Tuple[str, str]]]], query: str) -> Generator[str,None,None]:
|
|
45
46
|
"""
|
|
46
47
|
如果前面我们对话提供了文档,请参考上面的文档对提交的代码变更进行审查,提供改进建议。
|
|
47
48
|
|
|
48
49
|
下面包含最新一次提交的信息:
|
|
49
50
|
<commit>
|
|
50
|
-
{% for query,urls,
|
|
51
|
+
{% for query,urls,changes in querie_with_urls_and_changes %}
|
|
51
52
|
## 任务需求
|
|
52
53
|
{{ query }}
|
|
53
54
|
|
|
@@ -57,9 +58,18 @@ class AutoReviewCommit:
|
|
|
57
58
|
{% endfor %}
|
|
58
59
|
|
|
59
60
|
代码变更:
|
|
60
|
-
|
|
61
|
-
{{
|
|
62
|
-
|
|
61
|
+
{% for file_path, (before, after) in changes.items() %}
|
|
62
|
+
##File: {{ file_path }}
|
|
63
|
+
##修改前:
|
|
64
|
+
|
|
65
|
+
{{ before or "New file" }}
|
|
66
|
+
|
|
67
|
+
##File: {{ file_path }}
|
|
68
|
+
##修改后:
|
|
69
|
+
|
|
70
|
+
{{ after or "File deleted" }}
|
|
71
|
+
|
|
72
|
+
{% endfor %}
|
|
63
73
|
{% endfor %}
|
|
64
74
|
</commit>
|
|
65
75
|
|
|
@@ -70,7 +80,7 @@ class AutoReviewCommit:
|
|
|
70
80
|
- 实现逻辑:算法和数据结构的选择是否合适
|
|
71
81
|
|
|
72
82
|
2. 潜在问题检查
|
|
73
|
-
-
|
|
83
|
+
- 常见错误:缩进(比如python),闭合标签(前端vue,reactjs),是否存在空指针,数组越界,类型转换,未声明变量,typo等低级错误
|
|
74
84
|
- 安全性:是否存在安全隐患
|
|
75
85
|
- 性能:是否有性能问题
|
|
76
86
|
- 并发:是否有并发安全问题
|
|
@@ -83,8 +93,7 @@ class AutoReviewCommit:
|
|
|
83
93
|
- 依赖关系:组件耦合是否合理
|
|
84
94
|
- 复用性:是否有重复代码
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
返回 markdown 格式,包含以下内容:
|
|
96
|
+
评审结果包含以下内容:
|
|
88
97
|
1. issues: 发现的具体问题列表
|
|
89
98
|
2. suggestions: 对应的改进建议列表
|
|
90
99
|
3. severity: 问题的严重程度(low/medium/high)
|
|
@@ -130,10 +139,10 @@ class AutoReviewCommit:
|
|
|
130
139
|
|
|
131
140
|
action_file = action_files[0]
|
|
132
141
|
|
|
133
|
-
|
|
142
|
+
querie_with_urls_and_changes = []
|
|
134
143
|
repo = git.Repo(self.project_dir)
|
|
135
144
|
|
|
136
|
-
# 收集所有query、urls
|
|
145
|
+
# 收集所有query、urls和对应的文件变化
|
|
137
146
|
for yaml_file in [action_file]:
|
|
138
147
|
yaml_path = os.path.join(self.actions_dir, yaml_file)
|
|
139
148
|
config = load_yaml_config(yaml_path)
|
|
@@ -144,12 +153,13 @@ class AutoReviewCommit:
|
|
|
144
153
|
query = config.get('query', '')
|
|
145
154
|
urls = config.get('urls', [])
|
|
146
155
|
|
|
147
|
-
if query
|
|
148
|
-
|
|
156
|
+
if query:
|
|
157
|
+
changes = {}
|
|
149
158
|
if not self.skip_diff:
|
|
150
|
-
# 计算文件的MD5用于匹配commit
|
|
151
|
-
|
|
152
|
-
|
|
159
|
+
# 计算文件的MD5用于匹配commit
|
|
160
|
+
with open(yaml_path, 'r', encoding='utf-8') as f:
|
|
161
|
+
yaml_content = f.read()
|
|
162
|
+
file_md5 = hashlib.md5(yaml_content.encode("utf-8")).hexdigest()
|
|
153
163
|
response_id = f"auto_coder_{yaml_file}_{file_md5}"
|
|
154
164
|
# 查找对应的commit
|
|
155
165
|
try:
|
|
@@ -157,21 +167,38 @@ class AutoReviewCommit:
|
|
|
157
167
|
if response_id in commit.message:
|
|
158
168
|
if commit.parents:
|
|
159
169
|
parent = commit.parents[0]
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
# 获取所有文件的前后内容
|
|
171
|
+
for diff_item in parent.diff(commit):
|
|
172
|
+
file_path = diff_item.a_path if diff_item.a_path else diff_item.b_path
|
|
173
|
+
|
|
174
|
+
# 获取变更前内容
|
|
175
|
+
before_content = None
|
|
176
|
+
try:
|
|
177
|
+
if diff_item.a_blob:
|
|
178
|
+
before_content = repo.git.show(f"{parent.hexsha}:{file_path}")
|
|
179
|
+
except git.exc.GitCommandError:
|
|
180
|
+
pass # 文件可能是新增的
|
|
181
|
+
|
|
182
|
+
# 获取变更后内容
|
|
183
|
+
after_content = None
|
|
184
|
+
try:
|
|
185
|
+
if diff_item.b_blob:
|
|
186
|
+
after_content = repo.git.show(f"{commit.hexsha}:{file_path}")
|
|
187
|
+
except git.exc.GitCommandError:
|
|
188
|
+
pass # 文件可能被删除
|
|
189
|
+
|
|
190
|
+
changes[file_path] = (before_content, after_content)
|
|
164
191
|
break
|
|
165
192
|
except git.exc.GitCommandError as e:
|
|
166
193
|
printer = Printer()
|
|
167
194
|
printer.print_in_terminal("git_command_error", style="red", error=str(e))
|
|
168
195
|
except Exception as e:
|
|
169
196
|
printer = Printer()
|
|
170
|
-
printer.print_in_terminal("
|
|
197
|
+
printer.print_in_terminal("get_commit_changes_error", style="red", error=str(e))
|
|
171
198
|
|
|
172
|
-
|
|
199
|
+
querie_with_urls_and_changes.append((query, urls, changes))
|
|
173
200
|
|
|
174
|
-
return
|
|
201
|
+
return querie_with_urls_and_changes
|
|
175
202
|
|
|
176
203
|
|
|
177
204
|
def review_commit(self,query: str, conversations: List[Dict]) -> Generator[str,None,None]:
|
|
@@ -183,15 +210,15 @@ class AutoReviewCommit:
|
|
|
183
210
|
"""
|
|
184
211
|
printer = Printer()
|
|
185
212
|
# 获取最新的提交信息
|
|
186
|
-
|
|
187
|
-
if not
|
|
213
|
+
changes = self.parse_history_tasks()
|
|
214
|
+
if not changes:
|
|
188
215
|
printer.print_in_terminal("no_latest_commit", style="red")
|
|
189
216
|
return None
|
|
190
217
|
|
|
191
218
|
# 调用LLM进行代码审查
|
|
192
219
|
try:
|
|
193
220
|
# 获取 prompt 内容
|
|
194
|
-
query = self.review.prompt(
|
|
221
|
+
query = self.review.prompt(changes, query)
|
|
195
222
|
new_conversations = conversations.copy()[0:-1]
|
|
196
223
|
new_conversations.append({"role": "user", "content": query})
|
|
197
224
|
# 构造对话消息
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from itertools import product
|
|
1
2
|
from prompt_toolkit.formatted_text import HTML
|
|
2
3
|
from prompt_toolkit.shortcuts import radiolist_dialog
|
|
3
4
|
from prompt_toolkit import prompt
|
|
@@ -57,6 +58,7 @@ import pkg_resources
|
|
|
57
58
|
from autocoder.common.printer import Printer
|
|
58
59
|
from autocoder.utils.thread_utils import run_in_thread,run_in_raw_thread
|
|
59
60
|
from autocoder.common.command_completer import CommandCompleter,FileSystemModel as CCFileSystemModel,MemoryConfig as CCMemoryModel
|
|
61
|
+
from autocoder.common.conf_validator import ConfigValidator
|
|
60
62
|
|
|
61
63
|
class SymbolItem(BaseModel):
|
|
62
64
|
symbol_name: str
|
|
@@ -108,7 +110,7 @@ memory = {
|
|
|
108
110
|
"current_files": {"files": [], "groups": {}},
|
|
109
111
|
"conf": {},
|
|
110
112
|
"exclude_dirs": [],
|
|
111
|
-
"mode": "
|
|
113
|
+
"mode": "auto_detect", # 新增mode字段,默认为 auto_detect 模式
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
project_root = os.getcwd()
|
|
@@ -129,6 +131,8 @@ commands = [
|
|
|
129
131
|
"/revert",
|
|
130
132
|
"/index/query",
|
|
131
133
|
"/index/build",
|
|
134
|
+
"/index/export",
|
|
135
|
+
"/index/import",
|
|
132
136
|
"/exclude_dirs",
|
|
133
137
|
"/help",
|
|
134
138
|
"/shell",
|
|
@@ -584,6 +588,9 @@ def configure(conf: str, skip_print=False):
|
|
|
584
588
|
if not value:
|
|
585
589
|
printer.print_in_terminal("config_value_empty", style="red")
|
|
586
590
|
return
|
|
591
|
+
product_mode = memory["conf"].get("product_mode",None)
|
|
592
|
+
if product_mode:
|
|
593
|
+
ConfigValidator.validate(key, value, product_mode)
|
|
587
594
|
memory["conf"][key] = value
|
|
588
595
|
save_memory()
|
|
589
596
|
if not skip_print:
|
|
@@ -1863,6 +1870,13 @@ def generate_shell_command(input_text):
|
|
|
1863
1870
|
auto_coder_main(["agent", "generate_command", "--file", execute_file])
|
|
1864
1871
|
with open(os.path.join(".auto-coder", "exchange.txt"), "r") as f:
|
|
1865
1872
|
shell_script = f.read()
|
|
1873
|
+
result_manager = ResultManager()
|
|
1874
|
+
result_manager.add_result(content=shell_script,meta={
|
|
1875
|
+
"action": "generate_shell_command",
|
|
1876
|
+
"input": {
|
|
1877
|
+
"query": input_text
|
|
1878
|
+
}
|
|
1879
|
+
})
|
|
1866
1880
|
return shell_script
|
|
1867
1881
|
finally:
|
|
1868
1882
|
os.remove(execute_file)
|
|
@@ -2323,6 +2337,28 @@ def help(query: str):
|
|
|
2323
2337
|
auto_config_tuner = ConfigAutoTuner(llm=llm, memory_config=MemoryConfig(memory=memory, save_memory_func=save_memory))
|
|
2324
2338
|
auto_config_tuner.tune(AutoConfigRequest(query=query))
|
|
2325
2339
|
|
|
2340
|
+
@run_in_raw_thread()
|
|
2341
|
+
def index_export(export_path: str):
|
|
2342
|
+
from autocoder.common.index_import_export import export_index
|
|
2343
|
+
from autocoder.common.printer import Printer
|
|
2344
|
+
printer = Printer()
|
|
2345
|
+
project_root = os.getcwd()
|
|
2346
|
+
if export_index(project_root, export_path):
|
|
2347
|
+
printer.print_in_terminal("index_export_success", path=export_path)
|
|
2348
|
+
else:
|
|
2349
|
+
printer.print_in_terminal("index_export_fail", path=export_path)
|
|
2350
|
+
|
|
2351
|
+
@run_in_raw_thread()
|
|
2352
|
+
def index_import(import_path: str):
|
|
2353
|
+
from autocoder.common.index_import_export import import_index
|
|
2354
|
+
from autocoder.common.printer import Printer
|
|
2355
|
+
printer = Printer()
|
|
2356
|
+
project_root = os.getcwd()
|
|
2357
|
+
if import_index(project_root, import_path):
|
|
2358
|
+
printer.print_in_terminal("index_import_success", path=import_path)
|
|
2359
|
+
else:
|
|
2360
|
+
printer.print_in_terminal("index_import_fail", path=import_path)
|
|
2361
|
+
|
|
2326
2362
|
@run_in_raw_thread()
|
|
2327
2363
|
def index_query(query: str):
|
|
2328
2364
|
conf = memory.get("conf", {})
|
|
@@ -2547,15 +2583,15 @@ def auto_command(params,query: str):
|
|
|
2547
2583
|
|
|
2548
2584
|
# 生成建议
|
|
2549
2585
|
response = tuner.analyze(request)
|
|
2550
|
-
|
|
2586
|
+
printer = Printer()
|
|
2551
2587
|
# 显示建议
|
|
2552
|
-
console = Console()
|
|
2588
|
+
console = Console()
|
|
2553
2589
|
console.print(Panel(
|
|
2554
2590
|
Markdown(response.reasoning or ""),
|
|
2555
|
-
title="
|
|
2591
|
+
title=printer.get_message_from_key_with_format("auto_command_reasoning_title"),
|
|
2556
2592
|
border_style="blue",
|
|
2557
2593
|
padding=(1, 2)
|
|
2558
|
-
))
|
|
2594
|
+
))
|
|
2559
2595
|
|
|
2560
2596
|
|
|
2561
2597
|
def main():
|
|
@@ -2642,7 +2678,7 @@ def main():
|
|
|
2642
2678
|
mode = memory["mode"]
|
|
2643
2679
|
human_as_model = memory["conf"].get("human_as_model", "false")
|
|
2644
2680
|
if mode not in MODES:
|
|
2645
|
-
mode = "
|
|
2681
|
+
mode = "auto_detect"
|
|
2646
2682
|
return f" Mode: {MODES[mode]} (ctl+k) | Human as Model: {human_as_model} (ctl+n or /conf human_as_model:true/false)"
|
|
2647
2683
|
|
|
2648
2684
|
session = PromptSession(
|
|
@@ -2736,6 +2772,20 @@ def main():
|
|
|
2736
2772
|
|
|
2737
2773
|
elif user_input.startswith("/index/build"):
|
|
2738
2774
|
index_build()
|
|
2775
|
+
|
|
2776
|
+
elif user_input.startswith("/index/export"):
|
|
2777
|
+
export_path = user_input[len("/index/export"):].strip()
|
|
2778
|
+
if not export_path:
|
|
2779
|
+
print("Please specify the export path")
|
|
2780
|
+
else:
|
|
2781
|
+
index_export(export_path)
|
|
2782
|
+
|
|
2783
|
+
elif user_input.startswith("/index/import"):
|
|
2784
|
+
import_path = user_input[len("/index/import"):].strip()
|
|
2785
|
+
if not import_path:
|
|
2786
|
+
print("Please specify the import path")
|
|
2787
|
+
else:
|
|
2788
|
+
index_import(import_path)
|
|
2739
2789
|
|
|
2740
2790
|
elif user_input.startswith("/list_files"):
|
|
2741
2791
|
list_files()
|
|
@@ -75,6 +75,14 @@ MESSAGES = {
|
|
|
75
75
|
"help_desc": "Show this help message",
|
|
76
76
|
"exclude_dirs_desc": "Add directories to exclude from project",
|
|
77
77
|
"shell_desc": "Execute a shell command",
|
|
78
|
+
"index_export_success": "Successfully exported index to {{ path }}",
|
|
79
|
+
"index_export_fail": "Failed to export index to {{ path }}",
|
|
80
|
+
"index_import_success": "Successfully imported index from {{ path }}",
|
|
81
|
+
"index_import_fail": "Failed to import index from {{ path }}",
|
|
82
|
+
"index_not_found": "Index file not found at {{ path }}",
|
|
83
|
+
"index_backup_success": "Backed up existing index to {{ path }}",
|
|
84
|
+
"index_convert_path_fail": "Could not convert path {{ path }}",
|
|
85
|
+
"index_error": "Error in index operation: {{ error }}",
|
|
78
86
|
"voice_input_desc": "Convert voice input to text",
|
|
79
87
|
"mode_desc": "Switch input mode",
|
|
80
88
|
"conf_key": "Key",
|
|
@@ -123,6 +131,7 @@ MESSAGES = {
|
|
|
123
131
|
"files_removed": "Files Removed",
|
|
124
132
|
"models_api_key_empty": "Warning : {{name}} API key is empty. Please set a valid API key.",
|
|
125
133
|
"commit_generating": "{{ model_name }} Generating commit message...",
|
|
134
|
+
"auto_command_reasoning_title": "Reply",
|
|
126
135
|
"commit_message": "{{ model_name }} Generated commit message: {{ message }}",
|
|
127
136
|
"commit_failed": "{{ model_name }} Failed to generate commit message: {{ error }}",
|
|
128
137
|
"confirm_execute": "Do you want to execute this script?",
|
|
@@ -131,6 +140,7 @@ MESSAGES = {
|
|
|
131
140
|
"zh": {
|
|
132
141
|
"auto_command_analyzing": "正在分析命令请求",
|
|
133
142
|
"commit_generating": "{{ model_name }} 正在生成提交信息...",
|
|
143
|
+
"auto_command_reasoning_title": "回复",
|
|
134
144
|
"commit_message": "{{ model_name }} 生成的提交信息: {{ message }}",
|
|
135
145
|
"commit_failed": "{{ model_name }} 生成提交信息失败: {{ error }}",
|
|
136
146
|
"mcp_remove_error": "移除 MCP 服务器时出错:{error}",
|
|
@@ -204,6 +214,14 @@ MESSAGES = {
|
|
|
204
214
|
"help_desc": "显示此帮助消息",
|
|
205
215
|
"exclude_dirs_desc": "添加要从项目中排除的目录",
|
|
206
216
|
"shell_desc": "执行shell命令",
|
|
217
|
+
"index_export_success": "成功导出索引到 {{ path }}",
|
|
218
|
+
"index_export_fail": "导出索引到 {{ path }} 失败",
|
|
219
|
+
"index_import_success": "成功从 {{ path }} 导入索引",
|
|
220
|
+
"index_import_fail": "从 {{ path }} 导入索引失败",
|
|
221
|
+
"index_not_found": "在 {{ path }} 未找到索引文件",
|
|
222
|
+
"index_backup_success": "已备份现有索引到 {{ path }}",
|
|
223
|
+
"index_convert_path_fail": "无法转换路径 {{ path }}",
|
|
224
|
+
"index_error": "索引操作出错:{{ error }}",
|
|
207
225
|
"voice_input_desc": "将语音输入转换为文本",
|
|
208
226
|
"mode_desc": "切换输入模式",
|
|
209
227
|
"lib_desc": "管理库",
|
|
@@ -7,7 +7,6 @@ from typing import List, Dict, Any, Union, Callable, Optional
|
|
|
7
7
|
from autocoder.common.printer import Printer
|
|
8
8
|
from rich.console import Console
|
|
9
9
|
from rich.panel import Panel
|
|
10
|
-
from rich.markdown import Markdown
|
|
11
10
|
from pydantic import SkipValidation
|
|
12
11
|
|
|
13
12
|
from autocoder.common.result_manager import ResultManager
|
|
@@ -19,8 +18,9 @@ from autocoder.auto_coder import AutoCoderArgs
|
|
|
19
18
|
from autocoder.common import detect_env
|
|
20
19
|
from autocoder.common import shells
|
|
21
20
|
from loguru import logger
|
|
22
|
-
from autocoder.common import auto_coder_lang
|
|
23
21
|
from autocoder.utils import llms as llms_utils
|
|
22
|
+
from autocoder.rag.token_counter import count_tokens
|
|
23
|
+
from autocoder.common.global_cancel import global_cancel
|
|
24
24
|
|
|
25
25
|
class CommandMessage(BaseModel):
|
|
26
26
|
role: str
|
|
@@ -197,6 +197,7 @@ class CommandAutoTuner:
|
|
|
197
197
|
函数组合说明:
|
|
198
198
|
<function_combination_readme>
|
|
199
199
|
如果用户是一个编码需求,你可以先简单观察当前活跃区文件列表:
|
|
200
|
+
0. 关注下当前软件的配置,诸如索引开启关闭。如果有觉得不合理的可以通过 help 函数来修改。
|
|
200
201
|
1. 如果你觉得这些文件不够满足用户的需求,而当前的索引配置关闭的,那么你可以通过help("将skip_filter_index 和 skip_build_index 设置为 false") 让
|
|
201
202
|
chat,coding 函数来获取更多文件,或者你也可以自己通过调用 get_project_structure 函数来获取项目结构,然后通过 get_project_map 函数来获取某个文件的用途,符号列表,以及
|
|
202
203
|
文件大小(tokens数),最后再通过 read_files/read_file_with_keyword_ranges 函数来读取文件内容, 最后通过 add_files 函数来添加文件到活跃区。
|
|
@@ -207,6 +208,7 @@ class CommandAutoTuner:
|
|
|
207
208
|
通过 get_project_structure 来获取项目结构,然后通过 get_project_map 来获取你想看的某个文件的用途,符号列表,最后再通过 read_files/read_file_with_keyword_ranges 函数来读取文件内容,确认对应的功能是否在相关的文件里。
|
|
208
209
|
5. 调用 coding 函数的时候,尽可能多的 @文件和@@符号,让需求更加清晰明了,建议多描述具体怎么完成对应的需求。
|
|
209
210
|
6. 对于代码需求设计,尽可能使用 chat 函数。
|
|
211
|
+
7. 如果成功执行了 coding 函数,最好再调用一次 chat("/review /commit")
|
|
210
212
|
</function_combination_readme>
|
|
211
213
|
|
|
212
214
|
|
|
@@ -273,8 +275,11 @@ class CommandAutoTuner:
|
|
|
273
275
|
|
|
274
276
|
*** 非常非常重要的提示 ***
|
|
275
277
|
1. 如果已经满足要求,则不要返回任何函数,确保 suggestions 为空。
|
|
276
|
-
2. 你最多尝试
|
|
277
|
-
'''
|
|
278
|
+
2. 你最多尝试 {{ auto_command_max_iterations }} 次,如果 {{ auto_command_max_iterations }} 次都没有满足要求,则不要返回任何函数,确保 suggestions 为空。
|
|
279
|
+
'''
|
|
280
|
+
return {
|
|
281
|
+
"auto_command_max_iterations": self.args.auto_command_max_iterations
|
|
282
|
+
}
|
|
278
283
|
|
|
279
284
|
def analyze(self, request: AutoCommandRequest) -> AutoCommandResponse:
|
|
280
285
|
# 获取 prompt 内容
|
|
@@ -317,8 +322,7 @@ class CommandAutoTuner:
|
|
|
317
322
|
)
|
|
318
323
|
|
|
319
324
|
if last_meta:
|
|
320
|
-
elapsed_time = time.monotonic() - start_time
|
|
321
|
-
printer = Printer()
|
|
325
|
+
elapsed_time = time.monotonic() - start_time
|
|
322
326
|
speed = last_meta.generated_tokens_count / elapsed_time
|
|
323
327
|
|
|
324
328
|
# Get model info for pricing
|
|
@@ -355,6 +359,10 @@ class CommandAutoTuner:
|
|
|
355
359
|
result_manager = ResultManager()
|
|
356
360
|
|
|
357
361
|
while True:
|
|
362
|
+
if global_cancel.requested:
|
|
363
|
+
printer = Printer(console)
|
|
364
|
+
printer.print_in_terminal("generation_cancelled")
|
|
365
|
+
break
|
|
358
366
|
# 执行命令
|
|
359
367
|
command = response.suggestions[0].command
|
|
360
368
|
parameters = response.suggestions[0].parameters
|
|
@@ -376,8 +384,10 @@ class CommandAutoTuner:
|
|
|
376
384
|
changes = git_utils.get_changes_by_commit_message("", last_result.meta["commit_message"])
|
|
377
385
|
if changes.success:
|
|
378
386
|
for file_path, change in changes.changes.items():
|
|
379
|
-
if change
|
|
380
|
-
content += f"## File: {file_path}[更改前]\n{change.before}\n\nFile: {file_path}\n\n[更改后]\n{change.after}\n\n"
|
|
387
|
+
if change:
|
|
388
|
+
content += f"## File: {file_path}[更改前]\n{change.before or 'New File'}\n\nFile: {file_path}\n\n[更改后]\n{change.after or 'Deleted File'}\n\n"
|
|
389
|
+
else:
|
|
390
|
+
content = printer.get_message_from_key_with_format("no_changes_made")
|
|
381
391
|
else:
|
|
382
392
|
# 其他的直接获取执行结果
|
|
383
393
|
content = last_result.content
|
|
@@ -403,9 +413,26 @@ class CommandAutoTuner:
|
|
|
403
413
|
))
|
|
404
414
|
# 保持原content不变,继续后续处理
|
|
405
415
|
|
|
406
|
-
|
|
407
|
-
|
|
416
|
+
# 添加新的对话内容
|
|
417
|
+
new_content = self._execute_command_result.prompt(content)
|
|
418
|
+
conversations.append({"role": "user", "content": new_content})
|
|
419
|
+
|
|
420
|
+
# 统计 token 数量
|
|
421
|
+
total_tokens = count_tokens(json.dumps(conversations,ensure_ascii=False))
|
|
422
|
+
|
|
423
|
+
# 如果对话过长,使用默认策略进行修剪
|
|
424
|
+
if total_tokens > self.args.conversation_prune_safe_zone_tokens:
|
|
425
|
+
self.printer.print_in_terminal(
|
|
426
|
+
"conversation_pruning_start",
|
|
427
|
+
style="yellow",
|
|
428
|
+
total_tokens=total_tokens,
|
|
429
|
+
safe_zone=self.args.conversation_prune_safe_zone_tokens
|
|
430
|
+
)
|
|
431
|
+
from autocoder.common.conversation_pruner import ConversationPruner
|
|
432
|
+
pruner = ConversationPruner(self.llm)
|
|
433
|
+
conversations = pruner.prune_conversations(conversations)
|
|
408
434
|
|
|
435
|
+
title = printer.get_message_from_key("auto_command_analyzing")
|
|
409
436
|
model_name = ",".join(llms_utils.get_llm_names(self.llm))
|
|
410
437
|
|
|
411
438
|
start_time = time.monotonic()
|
|
@@ -453,7 +480,7 @@ class CommandAutoTuner:
|
|
|
453
480
|
response=response.model_dump_json(indent=2)
|
|
454
481
|
)
|
|
455
482
|
|
|
456
|
-
else:
|
|
483
|
+
else:
|
|
457
484
|
self.printer.print_in_terminal("auto_command_break", style="yellow", command=command)
|
|
458
485
|
break
|
|
459
486
|
|
|
@@ -555,7 +582,7 @@ class CommandAutoTuner:
|
|
|
555
582
|
<name>revert</name>
|
|
556
583
|
<description>
|
|
557
584
|
撤销最后一次代码修改,恢复到修改前的状态。同时会删除对应的操作记录文件,
|
|
558
|
-
如果很明显你对上一次coding
|
|
585
|
+
如果很明显你对上一次coding函数执行后的效果觉得不满意,可以使用该函数来撤销上一次的代码修改。
|
|
559
586
|
</description>
|
|
560
587
|
<usage>
|
|
561
588
|
该命令不需要任何参数,直接使用即可。会撤销最近一次的代码修改操作。
|
|
@@ -1107,6 +1134,7 @@ class CommandAutoTuner:
|
|
|
1107
1134
|
"lib": self.command_config.lib,
|
|
1108
1135
|
"models": self.command_config.models,
|
|
1109
1136
|
"execute_shell_command": self.command_config.execute_shell_command,
|
|
1137
|
+
"generate_shell_command": self.command_config.generate_shell_command,
|
|
1110
1138
|
|
|
1111
1139
|
"run_python": self.tools.run_python_code,
|
|
1112
1140
|
"get_related_files_by_symbols": self.tools.get_related_files_by_symbols,
|
|
@@ -1117,7 +1145,8 @@ class CommandAutoTuner:
|
|
|
1117
1145
|
"find_files_by_content": self.tools.find_files_by_content,
|
|
1118
1146
|
"get_project_related_files": self.tools.get_project_related_files,
|
|
1119
1147
|
"ask_user":self.tools.ask_user,
|
|
1120
|
-
"read_file_with_keyword_ranges": self.tools.read_file_with_keyword_ranges
|
|
1148
|
+
"read_file_with_keyword_ranges": self.tools.read_file_with_keyword_ranges,
|
|
1149
|
+
|
|
1121
1150
|
|
|
1122
1151
|
}
|
|
1123
1152
|
|
|
@@ -370,6 +370,14 @@ class AutoCoderArgs(pydantic.BaseModel):
|
|
|
370
370
|
in_code_apply: bool = False
|
|
371
371
|
model_filter_path: Optional[str] = None
|
|
372
372
|
|
|
373
|
+
conversation_prune_safe_zone_tokens: Optional[int] = 50*1024
|
|
374
|
+
conversation_prune_group_size: Optional[int] = 4
|
|
375
|
+
conversation_prune_strategy: Optional[str] = "summarize"
|
|
376
|
+
|
|
377
|
+
auto_command_max_iterations: Optional[int] = 10
|
|
378
|
+
|
|
379
|
+
skip_commit: Optional[bool] = False
|
|
380
|
+
|
|
373
381
|
class Config:
|
|
374
382
|
protected_namespaces = ()
|
|
375
383
|
|
|
@@ -3,6 +3,16 @@ from byzerllm.utils import format_str_jinja2
|
|
|
3
3
|
|
|
4
4
|
MESSAGES = {
|
|
5
5
|
"en": {
|
|
6
|
+
"config_validation_error": "Config validation error: {{error}}",
|
|
7
|
+
"invalid_boolean_value": "Value '{{value}}' is not a valid boolean(true/false)",
|
|
8
|
+
"invalid_integer_value": "Value '{{value}}' is not a valid integer",
|
|
9
|
+
"invalid_float_value": "Value '{{value}}' is not a valid float",
|
|
10
|
+
"invalid_type_value": "Value '{{value}}' is not a valid type (expected: {{types}})",
|
|
11
|
+
"value_out_of_range": "Value {{value}} is out of allowed range({{min}}~{{max}})",
|
|
12
|
+
"invalid_choice": "Value '{{value}}' is not in allowed options({{allowed}})",
|
|
13
|
+
"unknown_config_key": "Unknown config key '{{key}}'",
|
|
14
|
+
"model_not_found": "Model '{{model}}' is not configured in models.yml",
|
|
15
|
+
"required_without_default": "Config key '{{key}}' requires explicit value",
|
|
6
16
|
"auto_command_action_break": "Command {{command}} execution failed (got {{action}} result), no result can be obtained, please try again",
|
|
7
17
|
"auto_command_break": "Auto command execution failed to execute command: {{command}}",
|
|
8
18
|
"auto_command_executing": "\n\n============= Executing command: {{command}} =============\n\n",
|
|
@@ -123,9 +133,22 @@ MESSAGES = {
|
|
|
123
133
|
"auto_command_failed": "Auto command failed: {{error}}. Please check your input and try again.",
|
|
124
134
|
"command_execution_result": "{{action}} execution result",
|
|
125
135
|
"satisfied_prompt": "Requirements satisfied, no further action needed",
|
|
126
|
-
"auto_command_analyzed": "Selected command"
|
|
127
|
-
|
|
136
|
+
"auto_command_analyzed": "Selected command",
|
|
137
|
+
"invalid_enum_value": "Value '{{value}}' is not in allowed values ({{allowed}})",
|
|
138
|
+
"no_changes_made": "⚠️ no changes made, the reason may be that the text block generated by the coding function has a problem, so it cannot be merged into the project",
|
|
139
|
+
"conversation_pruning_start": "Conversation pruning started, total tokens: {{total_tokens}}, safe zone: {{safe_zone}}",
|
|
140
|
+
},
|
|
128
141
|
"zh": {
|
|
142
|
+
"config_validation_error": "配置验证错误: {{error}}",
|
|
143
|
+
"invalid_boolean_value": "值 '{{value}}' 不是有效的布尔值(true/false)",
|
|
144
|
+
"invalid_integer_value": "值 '{{value}}' 不是有效的整数",
|
|
145
|
+
"invalid_float_value": "值 '{{value}}' 不是有效的浮点数",
|
|
146
|
+
"invalid_type_value": "值 '{{value}}' 不是有效的类型 (期望: {{types}})",
|
|
147
|
+
"value_out_of_range": "值 {value} 超出允许范围({min}~{max})",
|
|
148
|
+
"invalid_choice": "值 '{value}' 不在允许选项中({allowed})",
|
|
149
|
+
"unknown_config_key": "未知的配置项 '{key}'",
|
|
150
|
+
"model_not_found": "模型 '{model}' 未在 models.yml 中配置",
|
|
151
|
+
"required_without_default": "配置项 '{key}' 需要明确设置值",
|
|
129
152
|
"auto_command_action_break": "命令 {{command}} 执行失败(获取到了 {{action}} 的结果),无法获得任何结果,请重试",
|
|
130
153
|
"auto_command_break": "自动命令执行失败: {{command}}",
|
|
131
154
|
"auto_command_executing": "\n\n============= 正在执行指令: {{command}} =============\n\n",
|
|
@@ -213,7 +236,7 @@ MESSAGES = {
|
|
|
213
236
|
"unmerged_blocks_warning": "⚠️ 发现 {{ num_blocks }} 个未合并的代码块,更改将不会被应用。请手动检查后重试。",
|
|
214
237
|
"pylint_file_check_failed": "⚠️ {{ file_path }} 的 Pylint 检查失败。更改未应用。错误: {{ error_message }}",
|
|
215
238
|
"merge_success": "✅ 成功合并了 {{ num_files }} 个文件中的更改 {{ num_changes }}/{{ total_blocks }} 个代码块。",
|
|
216
|
-
"no_changes_made": "⚠️
|
|
239
|
+
"no_changes_made": "⚠️ 未对任何文件进行更改。这个原因可能是因为coding函数生成的文本块格式有问题,导致无法合并进项目",
|
|
217
240
|
"unmerged_blocks_title": "未合并代码块",
|
|
218
241
|
"unmerged_file_path": "文件: {{file_path}}",
|
|
219
242
|
"unmerged_search_block": "Search Block({{similarity}}):",
|
|
@@ -245,7 +268,9 @@ MESSAGES = {
|
|
|
245
268
|
"auto_command_failed": "自动命令执行失败: {{error}}。请检查您的输入并重试。",
|
|
246
269
|
"command_execution_result": "{{action}} 执行结果",
|
|
247
270
|
"satisfied_prompt": "已满足需求,无需进一步操作",
|
|
248
|
-
"auto_command_analyzed": "被选择指令"
|
|
271
|
+
"auto_command_analyzed": "被选择指令",
|
|
272
|
+
"invalid_enum_value": "值 '{{value}}' 不在允许的值列表中 ({{allowed}})",
|
|
273
|
+
"conversation_pruning_start": "⚠️ 对话长度 {{total_tokens}} tokens 超过安全阈值 {{safe_zone}},开始修剪对话。"
|
|
249
274
|
}}
|
|
250
275
|
|
|
251
276
|
|
|
@@ -157,7 +157,7 @@ class CodeAutoMerge:
|
|
|
157
157
|
# get the file name
|
|
158
158
|
file_name = os.path.basename(self.args.file)
|
|
159
159
|
|
|
160
|
-
if not force_skip_git:
|
|
160
|
+
if not force_skip_git and not self.args.skip_commit:
|
|
161
161
|
try:
|
|
162
162
|
git_utils.commit_changes(self.args.source_dir, f"auto_coder_pre_{file_name}_{md5}")
|
|
163
163
|
except Exception as e:
|
|
@@ -176,6 +176,6 @@ class CodeAutoMerge:
|
|
|
176
176
|
f.write(block.content)
|
|
177
177
|
|
|
178
178
|
self.printer.print_in_terminal("files_merged", total=total)
|
|
179
|
-
if not force_skip_git:
|
|
179
|
+
if not force_skip_git and not self.args.skip_commit:
|
|
180
180
|
commit_result = git_utils.commit_changes(self.args.source_dir, f"auto_coder_{file_name}_{md5}\n{self.args.query}")
|
|
181
181
|
git_utils.print_commit_info(commit_result=commit_result)
|