auto-coder 0.1.269__tar.gz → 0.1.271__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.269 → auto_coder-0.1.271}/PKG-INFO +1 -1
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/auto_coder.egg-info/PKG-INFO +1 -1
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/auto_coder.egg-info/SOURCES.txt +1 -0
- auto_coder-0.1.271/src/autocoder/agent/auto_learn_from_commit.py +209 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/auto_coder.py +4 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/auto_coder_runner.py +26 -14
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/commands/auto_command.py +33 -5
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/commands/tools.py +28 -15
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/auto_coder_lang.py +21 -4
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_modification_ranker.py +55 -11
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/command_generator.py +3 -1
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/context_pruner.py +30 -3
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/files.py +44 -10
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/shells.py +68 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/entry.py +4 -2
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/index.py +1 -1
- auto_coder-0.1.271/src/autocoder/version.py +1 -0
- auto_coder-0.1.269/src/autocoder/version.py +0 -1
- {auto_coder-0.1.269 → auto_coder-0.1.271}/LICENSE +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/README.md +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/setup.cfg +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/setup.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/auto_coder.egg-info/dependency_links.txt +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/auto_coder.egg-info/entry_points.txt +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/auto_coder.egg-info/requires.txt +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/auto_coder.egg-info/top_level.txt +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/auto_demand_organizer.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/auto_filegroup.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/auto_guess_query.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/auto_review_commit.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/auto_tool.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/coder.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/designer.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/planner.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/agent/project_reader.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/auto_coder_rag.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/auto_coder_rag_client_mcp.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/auto_coder_rag_mcp.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/auto_coder_server.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/benchmark.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/chat/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/chat_auto_coder.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/chat_auto_coder_lang.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/command_args.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/commands/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/JupyterClient.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/ShellClient.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/anything2images.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/anything2img.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/audio.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/auto_configure.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/buildin_tokenizer.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/chunk_validation.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/cleaner.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_execute.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_generate.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_generate_diff.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_merge.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_merge_diff.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/code_auto_merge_strict_diff.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/command_completer.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/command_templates.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/conf_import_export.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/conf_validator.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/const.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/conversation_pruner.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/git_utils.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/global_cancel.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/image_to_page.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/index_import_export.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/interpreter.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/llm_rerank.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/mcp_hub.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/mcp_server.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/mcp_servers/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/mcp_servers/mcp_server_perplexity.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/mcp_tools.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/memory_manager.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/model_speed_test.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/printer.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/recall_validation.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/result_manager.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/screenshots.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/search.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/search_replace.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/stats_panel.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/sys_prompt.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/text.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/types.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/common/utils_code_auto_generate.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/data/byzerllm.md +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/data/tokenizer.json +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/db/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/db/store.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/dispacher/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/dispacher/actions/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/dispacher/actions/action.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/dispacher/actions/copilot.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/filter/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/filter/normal_filter.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/filter/quick_filter.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/for_command.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/symbols_utils.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/index/types.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/lang.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/models.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/privacy/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/privacy/model_filter.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/pyproject/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/api_server.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/cache/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/cache/base_cache.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/cache/byzer_storage_cache.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/cache/simple_cache.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/doc_filter.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/document_retriever.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/llm_wrapper.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/loaders/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/loaders/docx_loader.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/loaders/excel_loader.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/long_context_rag.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/rag_config.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/rag_entry.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/raw_rag.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/relevant_utils.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/simple_directory_reader.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/simple_rag.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/stream_event/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/stream_event/event_writer.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/stream_event/types.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/token_checker.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/token_counter.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/token_limiter.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/types.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/utils.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/rag/variable_holder.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/regexproject/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/suffixproject/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/tsproject/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/_markitdown.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/auto_coder_utils/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/auto_coder_utils/chat_stream_out.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/auto_project_type.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/chat_auto_coder_utils/__init__.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/conversation_store.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/llm_client_interceptors.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/llms.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/log_capture.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/model_provider_selector.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/multi_turn.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/operate_config_api.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/print_table.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/project_structure.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/queue_communicate.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/request_event_queue.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/request_queue.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/rest.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/tests.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/thread_utils.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/src/autocoder/utils/types.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_action_regex_project.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_chat_auto_coder.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_command_completer.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_planner.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_privacy.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_queue_communicate.py +0 -0
- {auto_coder-0.1.269 → auto_coder-0.1.271}/tests/test_symbols_utils.py +0 -0
|
@@ -25,6 +25,7 @@ src/autocoder/agent/__init__.py
|
|
|
25
25
|
src/autocoder/agent/auto_demand_organizer.py
|
|
26
26
|
src/autocoder/agent/auto_filegroup.py
|
|
27
27
|
src/autocoder/agent/auto_guess_query.py
|
|
28
|
+
src/autocoder/agent/auto_learn_from_commit.py
|
|
28
29
|
src/autocoder/agent/auto_review_commit.py
|
|
29
30
|
src/autocoder/agent/auto_tool.py
|
|
30
31
|
src/autocoder/agent/coder.py
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
from typing import Generator, List, Dict, Union, Tuple, Optional
|
|
2
|
+
import os
|
|
3
|
+
import yaml
|
|
4
|
+
import byzerllm
|
|
5
|
+
import pydantic
|
|
6
|
+
import git
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
from autocoder.common.printer import Printer
|
|
9
|
+
from autocoder.common import AutoCoderArgs
|
|
10
|
+
from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
|
|
11
|
+
import hashlib
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def load_yaml_config(yaml_file: str) -> Dict:
|
|
15
|
+
"""加载YAML配置文件"""
|
|
16
|
+
try:
|
|
17
|
+
with open(yaml_file, 'r', encoding='utf-8') as f:
|
|
18
|
+
return yaml.safe_load(f)
|
|
19
|
+
except Exception as e:
|
|
20
|
+
printer = Printer()
|
|
21
|
+
printer.print_in_terminal("yaml_load_error", style="red", yaml_file=yaml_file, error=str(e))
|
|
22
|
+
return {}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AutoLearnFromCommit:
|
|
26
|
+
def __init__(self, llm: Union[byzerllm.ByzerLLM,byzerllm.SimpleByzerLLM],
|
|
27
|
+
args:AutoCoderArgs,
|
|
28
|
+
skip_diff: bool = False,
|
|
29
|
+
console: Optional[Console] = None):
|
|
30
|
+
"""
|
|
31
|
+
初始化 AutoLearnFromCommit
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
llm: ByzerLLM 实例,用于代码学习
|
|
35
|
+
project_dir: 项目根目录
|
|
36
|
+
skip_diff: 是否跳过获取 diff 信息
|
|
37
|
+
"""
|
|
38
|
+
self.project_dir = args.source_dir
|
|
39
|
+
self.actions_dir = os.path.join(args.source_dir, "actions")
|
|
40
|
+
self.llm = llm
|
|
41
|
+
self.skip_diff = skip_diff
|
|
42
|
+
self.console = console or Console()
|
|
43
|
+
|
|
44
|
+
@byzerllm.prompt()
|
|
45
|
+
def learn(self, querie_with_urls_and_changes: List[Tuple[str, List[str], Dict[str, Tuple[str, str]]]], query: str) -> Generator[str,None,None]:
|
|
46
|
+
"""
|
|
47
|
+
请根据下面的代码变更,总结出通用的代码调整模式,以帮助实现类似的需求。
|
|
48
|
+
|
|
49
|
+
下面用户对本次的目标以及你需要总结的要求:
|
|
50
|
+
<goal>
|
|
51
|
+
{{ query }}
|
|
52
|
+
</goal>
|
|
53
|
+
|
|
54
|
+
下面是本次提交的代码变更:
|
|
55
|
+
<changes>
|
|
56
|
+
{% for query,urls,changes in querie_with_urls_and_changes %}
|
|
57
|
+
## 原始的任务需求
|
|
58
|
+
{{ query }}
|
|
59
|
+
|
|
60
|
+
修改的文件:
|
|
61
|
+
{% for url in urls %}
|
|
62
|
+
- {{ url }}
|
|
63
|
+
{% endfor %}
|
|
64
|
+
|
|
65
|
+
代码变更:
|
|
66
|
+
{% for file_path, (before, after) in changes.items() %}
|
|
67
|
+
##File: {{ file_path }}
|
|
68
|
+
##修改前:
|
|
69
|
+
|
|
70
|
+
{{ before or "New file" }}
|
|
71
|
+
|
|
72
|
+
##File: {{ file_path }}
|
|
73
|
+
##修改后:
|
|
74
|
+
|
|
75
|
+
{{ after or "File deleted" }}
|
|
76
|
+
|
|
77
|
+
{% endfor %}
|
|
78
|
+
{% endfor %}
|
|
79
|
+
</changes>
|
|
80
|
+
|
|
81
|
+
请总结以下内容:
|
|
82
|
+
1. 代码调整模式:描述为了实现这个目标,通常需要对代码做出哪些通用调整
|
|
83
|
+
2. 关键修改点:指出本次提交中最关键或最具代表性的修改点
|
|
84
|
+
3. 潜在扩展:基于这些修改,未来类似需求可能需要进行哪些扩展
|
|
85
|
+
4. 注意事项:在实现类似功能时需要注意哪些问题
|
|
86
|
+
|
|
87
|
+
总结要求:
|
|
88
|
+
1. 总结应该抽象化,不要局限于具体实现细节
|
|
89
|
+
2. 对于每个模式都应该提供明确的适用场景
|
|
90
|
+
3. 应该考虑代码的可维护性和可扩展性
|
|
91
|
+
4. 应该指出在不同技术栈或框架下的通用性
|
|
92
|
+
"""
|
|
93
|
+
pass
|
|
94
|
+
|
|
95
|
+
def parse_history_tasks(self) -> List[Dict]:
|
|
96
|
+
"""
|
|
97
|
+
解析历史任务信息
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
List[Dict]: 每个字典包含一个历史任务的信息
|
|
101
|
+
"""
|
|
102
|
+
# 获取所有YAML文件
|
|
103
|
+
action_files = [
|
|
104
|
+
f for f in os.listdir(self.actions_dir)
|
|
105
|
+
if f[:3].isdigit() and "_" in f and f.endswith('.yml')
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
# 按序号排序
|
|
109
|
+
def get_seq(name):
|
|
110
|
+
return int(name.split("_")[0])
|
|
111
|
+
|
|
112
|
+
# 获取最新的action文件列表
|
|
113
|
+
action_files = sorted(action_files, key=get_seq)
|
|
114
|
+
action_files.reverse()
|
|
115
|
+
|
|
116
|
+
action_file = action_files[0]
|
|
117
|
+
|
|
118
|
+
querie_with_urls_and_changes = []
|
|
119
|
+
repo = git.Repo(self.project_dir)
|
|
120
|
+
|
|
121
|
+
# 收集所有query、urls和对应的文件变化
|
|
122
|
+
for yaml_file in [action_file]:
|
|
123
|
+
yaml_path = os.path.join(self.actions_dir, yaml_file)
|
|
124
|
+
config = load_yaml_config(yaml_path)
|
|
125
|
+
|
|
126
|
+
if not config:
|
|
127
|
+
continue
|
|
128
|
+
|
|
129
|
+
query = config.get('query', '')
|
|
130
|
+
urls = config.get('urls', [])
|
|
131
|
+
|
|
132
|
+
if query:
|
|
133
|
+
changes = {}
|
|
134
|
+
if not self.skip_diff:
|
|
135
|
+
# 计算文件的MD5用于匹配commit
|
|
136
|
+
with open(yaml_path, 'r', encoding='utf-8') as f:
|
|
137
|
+
yaml_content = f.read()
|
|
138
|
+
file_md5 = hashlib.md5(yaml_content.encode("utf-8")).hexdigest()
|
|
139
|
+
response_id = f"auto_coder_{yaml_file}_{file_md5}"
|
|
140
|
+
# 查找对应的commit
|
|
141
|
+
try:
|
|
142
|
+
for commit in repo.iter_commits():
|
|
143
|
+
if response_id in commit.message:
|
|
144
|
+
if commit.parents:
|
|
145
|
+
parent = commit.parents[0]
|
|
146
|
+
# 获取所有文件的前后内容
|
|
147
|
+
for diff_item in parent.diff(commit):
|
|
148
|
+
file_path = diff_item.a_path if diff_item.a_path else diff_item.b_path
|
|
149
|
+
|
|
150
|
+
# 获取变更前内容
|
|
151
|
+
before_content = None
|
|
152
|
+
try:
|
|
153
|
+
if diff_item.a_blob:
|
|
154
|
+
before_content = repo.git.show(f"{parent.hexsha}:{file_path}")
|
|
155
|
+
except git.exc.GitCommandError:
|
|
156
|
+
pass # 文件可能是新增的
|
|
157
|
+
|
|
158
|
+
# 获取变更后内容
|
|
159
|
+
after_content = None
|
|
160
|
+
try:
|
|
161
|
+
if diff_item.b_blob:
|
|
162
|
+
after_content = repo.git.show(f"{commit.hexsha}:{file_path}")
|
|
163
|
+
except git.exc.GitCommandError:
|
|
164
|
+
pass # 文件可能被删除
|
|
165
|
+
|
|
166
|
+
changes[file_path] = (before_content, after_content)
|
|
167
|
+
break
|
|
168
|
+
except git.exc.GitCommandError as e:
|
|
169
|
+
printer = Printer()
|
|
170
|
+
printer.print_in_terminal("git_command_error", style="red", error=str(e))
|
|
171
|
+
except Exception as e:
|
|
172
|
+
printer = Printer()
|
|
173
|
+
printer.print_in_terminal("get_commit_changes_error", style="red", error=str(e))
|
|
174
|
+
|
|
175
|
+
querie_with_urls_and_changes.append((query, urls, changes))
|
|
176
|
+
|
|
177
|
+
return querie_with_urls_and_changes
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def learn_from_commit(self,query: str, conversations: List[Dict]) -> Generator[str,None,None]:
|
|
181
|
+
"""
|
|
182
|
+
从最新的代码提交中学习通用模式
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
Optional[Generator]: 学习结果生成器,如果出错则返回None
|
|
186
|
+
"""
|
|
187
|
+
printer = Printer()
|
|
188
|
+
# 获取最新的提交信息
|
|
189
|
+
changes = self.parse_history_tasks()
|
|
190
|
+
if not changes:
|
|
191
|
+
printer.print_in_terminal("no_latest_commit", style="red")
|
|
192
|
+
return None
|
|
193
|
+
|
|
194
|
+
# 调用LLM进行代码学习
|
|
195
|
+
try:
|
|
196
|
+
# 获取 prompt 内容
|
|
197
|
+
query = self.learn.prompt(changes, query)
|
|
198
|
+
new_conversations = conversations.copy()[0:-1]
|
|
199
|
+
new_conversations.append({"role": "user", "content": query})
|
|
200
|
+
# 构造对话消息
|
|
201
|
+
v = stream_chat_with_continue(
|
|
202
|
+
llm=self.llm,
|
|
203
|
+
conversations=new_conversations,
|
|
204
|
+
llm_config={}
|
|
205
|
+
)
|
|
206
|
+
return v
|
|
207
|
+
except Exception as e:
|
|
208
|
+
printer.print_in_terminal("code_learn_error", style="red", error=str(e))
|
|
209
|
+
return None
|
|
@@ -1339,6 +1339,10 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1339
1339
|
from autocoder.agent.auto_review_commit import AutoReviewCommit
|
|
1340
1340
|
reviewer = AutoReviewCommit(llm=chat_llm, args=args)
|
|
1341
1341
|
v = reviewer.review_commit(query=args.query,conversations=loaded_conversations)
|
|
1342
|
+
elif "learn_from_commit" in args.action:
|
|
1343
|
+
from autocoder.agent.auto_learn_from_commit import AutoLearnFromCommit
|
|
1344
|
+
learner = AutoLearnFromCommit(llm=chat_llm, args=args)
|
|
1345
|
+
v = learner.learn_from_commit(query=args.query,conversations=loaded_conversations)
|
|
1342
1346
|
else:
|
|
1343
1347
|
# 预估token数量
|
|
1344
1348
|
estimated_input_tokens = count_tokens(json.dumps(loaded_conversations, ensure_ascii=False))
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
from itertools import product
|
|
2
|
+
from rich.console import Console
|
|
3
|
+
from rich.panel import Panel
|
|
2
4
|
from prompt_toolkit.formatted_text import HTML
|
|
3
5
|
from prompt_toolkit.shortcuts import radiolist_dialog
|
|
4
6
|
from prompt_toolkit import prompt
|
|
@@ -646,21 +648,28 @@ def revert():
|
|
|
646
648
|
with redirect_stdout() as output:
|
|
647
649
|
auto_coder_main(["revert", "--file", file_path])
|
|
648
650
|
s = output.getvalue()
|
|
649
|
-
|
|
651
|
+
|
|
652
|
+
console = Console()
|
|
653
|
+
panel = Panel(
|
|
654
|
+
Markdown(s),
|
|
655
|
+
title="Revert Result",
|
|
656
|
+
border_style="green" if "Successfully reverted changes" in s else "red",
|
|
657
|
+
padding=(1, 2),
|
|
658
|
+
expand=False
|
|
659
|
+
)
|
|
660
|
+
console.print(panel)
|
|
661
|
+
|
|
650
662
|
if "Successfully reverted changes" in s:
|
|
651
663
|
result_manager.append(content=s, meta={"action": "revert","success":False, "input":{
|
|
652
664
|
}})
|
|
653
|
-
|
|
654
|
-
"Reverted the last chat action successfully. Remove the yaml file {file_path}"
|
|
655
|
-
)
|
|
665
|
+
|
|
656
666
|
os.remove(file_path)
|
|
657
667
|
else:
|
|
658
668
|
result_manager.append(content=s, meta={"action": "revert","success":False, "input":{
|
|
659
669
|
}})
|
|
660
670
|
else:
|
|
661
671
|
result_manager.append(content="No previous chat action found to revert.", meta={"action": "revert","success":False, "input":{
|
|
662
|
-
}})
|
|
663
|
-
print("No previous chat action found to revert.")
|
|
672
|
+
}})
|
|
664
673
|
|
|
665
674
|
|
|
666
675
|
def add_files(args: List[str]):
|
|
@@ -1155,6 +1164,7 @@ def mcp(query: str):
|
|
|
1155
1164
|
"silence": conf.get("silence", "true") == "true",
|
|
1156
1165
|
"include_project_structure": conf.get("include_project_structure", "true")
|
|
1157
1166
|
== "true",
|
|
1167
|
+
"exclude_files": memory.get("exclude_files", []),
|
|
1158
1168
|
}
|
|
1159
1169
|
for key, value in conf.items():
|
|
1160
1170
|
converted_value = convert_config_value(key, value)
|
|
@@ -1224,6 +1234,7 @@ def code_next(query: str):
|
|
|
1224
1234
|
"silence": conf.get("silence", "true") == "true",
|
|
1225
1235
|
"include_project_structure": conf.get("include_project_structure", "true")
|
|
1226
1236
|
== "true",
|
|
1237
|
+
"exclude_files": memory.get("exclude_files", []),
|
|
1227
1238
|
}
|
|
1228
1239
|
for key, value in conf.items():
|
|
1229
1240
|
converted_value = convert_config_value(key, value)
|
|
@@ -1595,6 +1606,9 @@ def chat(query: str):
|
|
|
1595
1606
|
if "/review" in query and "/commit" in query:
|
|
1596
1607
|
yaml_config["action"].append("review_commit")
|
|
1597
1608
|
query = query.replace("/review", "", 1).replace("/commit", "", 1).strip()
|
|
1609
|
+
elif "/learn" in query:
|
|
1610
|
+
yaml_config["action"].append("learn_from_commit")
|
|
1611
|
+
query = query.replace("/learn", "", 1).strip()
|
|
1598
1612
|
else:
|
|
1599
1613
|
is_review = query.strip().startswith("/review")
|
|
1600
1614
|
if is_review:
|
|
@@ -2283,6 +2297,7 @@ def index_build():
|
|
|
2283
2297
|
conf = memory.get("conf", {})
|
|
2284
2298
|
yaml_config = {
|
|
2285
2299
|
"include_file": ["./base/base.yml"],
|
|
2300
|
+
"exclude_files": memory.get("exclude_files", []),
|
|
2286
2301
|
}
|
|
2287
2302
|
|
|
2288
2303
|
for key, value in conf.items():
|
|
@@ -2295,10 +2310,8 @@ def index_build():
|
|
|
2295
2310
|
|
|
2296
2311
|
with open(yaml_file, "w",encoding="utf-8") as f:
|
|
2297
2312
|
f.write(yaml_content)
|
|
2298
|
-
try:
|
|
2299
|
-
|
|
2300
|
-
auto_coder_main(["index", "--file", yaml_file])
|
|
2301
|
-
print(output.getvalue(), flush=True)
|
|
2313
|
+
try:
|
|
2314
|
+
auto_coder_main(["index", "--file", yaml_file])
|
|
2302
2315
|
completer.refresh_files()
|
|
2303
2316
|
finally:
|
|
2304
2317
|
os.remove(yaml_file)
|
|
@@ -2315,6 +2328,7 @@ def get_final_config()->AutoCoderArgs:
|
|
|
2315
2328
|
"silence": conf.get("silence", "true") == "true",
|
|
2316
2329
|
"include_project_structure": conf.get("include_project_structure", "true")
|
|
2317
2330
|
== "true",
|
|
2331
|
+
"exclude_files": memory.get("exclude_files", []),
|
|
2318
2332
|
}
|
|
2319
2333
|
for key, value in conf.items():
|
|
2320
2334
|
converted_value = convert_config_value(key, value)
|
|
@@ -2380,10 +2394,8 @@ def index_query(query: str):
|
|
|
2380
2394
|
|
|
2381
2395
|
with open(yaml_file, "w",encoding="utf-8") as f:
|
|
2382
2396
|
f.write(yaml_content)
|
|
2383
|
-
try:
|
|
2384
|
-
|
|
2385
|
-
auto_coder_main(["index-query", "--file", yaml_file])
|
|
2386
|
-
print(output.getvalue(), flush=True)
|
|
2397
|
+
try:
|
|
2398
|
+
auto_coder_main(["index-query", "--file", yaml_file])
|
|
2387
2399
|
finally:
|
|
2388
2400
|
os.remove(yaml_file)
|
|
2389
2401
|
|
|
@@ -171,15 +171,21 @@ class CommandAutoTuner:
|
|
|
171
171
|
当前用户环境信息如下:
|
|
172
172
|
<os_info>
|
|
173
173
|
操作系统: {{ env_info.os_name }} {{ env_info.os_version }}
|
|
174
|
+
操作系统发行版: {{ os_distribution }}
|
|
174
175
|
Python版本: {{ env_info.python_version }}
|
|
175
176
|
终端类型: {{ env_info.shell_type }}
|
|
176
177
|
终端编码: {{ env_info.shell_encoding }}
|
|
178
|
+
|
|
179
|
+
{%- if shell_type %}
|
|
180
|
+
脚本类型:{{ shell_type }}
|
|
181
|
+
{%- endif %}
|
|
182
|
+
|
|
177
183
|
{%- if env_info.conda_env %}
|
|
178
184
|
Conda环境: {{ env_info.conda_env }}
|
|
179
185
|
{%- endif %}
|
|
180
186
|
{%- if env_info.virtualenv %}
|
|
181
187
|
虚拟环境: {{ env_info.virtualenv }}
|
|
182
|
-
{%- endif %}
|
|
188
|
+
{%- endif %}
|
|
183
189
|
</os_info>
|
|
184
190
|
|
|
185
191
|
我们的目标是根据用户输入和当前上下文,组合多个函数来完成用户的需求。
|
|
@@ -221,6 +227,7 @@ class CommandAutoTuner:
|
|
|
221
227
|
每个文件的tokens数,你可以根据这个信息来决定如何读取这个文件。比如对于很小的文件,那么可以直接全部读取,
|
|
222
228
|
而对于分析一个超大文件推荐组合 read_files 带上 line_ranges 参数来读取,或者组合 read_file_withread_file_with_keyword_ranges 等来读取,
|
|
223
229
|
每个函数你还可以使用多次来获取更多信息。
|
|
230
|
+
9. 根据操作系统,终端类型,脚本类型等各种信息,在涉及到路径或者脚本的时候,需要考虑平台差异性。
|
|
224
231
|
</function_combination_readme>
|
|
225
232
|
|
|
226
233
|
|
|
@@ -260,7 +267,13 @@ class CommandAutoTuner:
|
|
|
260
267
|
满足需求。
|
|
261
268
|
"""
|
|
262
269
|
|
|
263
|
-
env_info = detect_env()
|
|
270
|
+
env_info = detect_env()
|
|
271
|
+
shell_type = "bash"
|
|
272
|
+
if shells.is_running_in_cmd():
|
|
273
|
+
shell_type = "cmd"
|
|
274
|
+
elif shells.is_running_in_powershell():
|
|
275
|
+
shell_type = "powershell"
|
|
276
|
+
|
|
264
277
|
return {
|
|
265
278
|
"user_input": request.user_input,
|
|
266
279
|
"current_files": self.memory_config.memory["current_files"]["files"],
|
|
@@ -268,9 +281,10 @@ class CommandAutoTuner:
|
|
|
268
281
|
"available_commands": self._command_readme.prompt(),
|
|
269
282
|
"current_conf": json.dumps(self.memory_config.memory["conf"], indent=2),
|
|
270
283
|
"env_info": env_info,
|
|
271
|
-
"shell_type":
|
|
284
|
+
"shell_type": shell_type,
|
|
272
285
|
"shell_encoding": shells.get_terminal_encoding(),
|
|
273
|
-
"conversation_safe_zone_tokens": self.args.conversation_prune_safe_zone_tokens
|
|
286
|
+
"conversation_safe_zone_tokens": self.args.conversation_prune_safe_zone_tokens,
|
|
287
|
+
"os_distribution": shells.get_os_distribution()
|
|
274
288
|
}
|
|
275
289
|
|
|
276
290
|
@byzerllm.prompt()
|
|
@@ -1179,6 +1193,18 @@ class CommandAutoTuner:
|
|
|
1179
1193
|
此时会返回诸如 "ts,py,java,go,js,ts" 这样的字符串,表示项目类型。
|
|
1180
1194
|
</usage>
|
|
1181
1195
|
</command>
|
|
1196
|
+
|
|
1197
|
+
<command>
|
|
1198
|
+
<name>response_user</name>
|
|
1199
|
+
<description>响应用户。</description>
|
|
1200
|
+
<usage>
|
|
1201
|
+
如果你需要直接发送信息给用户,那么可以通过 response_user 函数来直接回复用户。
|
|
1202
|
+
|
|
1203
|
+
比如用户问你是谁?
|
|
1204
|
+
你可以通过如下方式来回答:
|
|
1205
|
+
response_user(response="你好,我是 auto-coder")
|
|
1206
|
+
</usage>
|
|
1207
|
+
</command>
|
|
1182
1208
|
</commands>
|
|
1183
1209
|
|
|
1184
1210
|
|
|
@@ -1224,7 +1250,9 @@ class CommandAutoTuner:
|
|
|
1224
1250
|
"get_project_related_files": self.tools.get_project_related_files,
|
|
1225
1251
|
"ask_user":self.tools.ask_user,
|
|
1226
1252
|
"read_file_with_keyword_ranges": self.tools.read_file_with_keyword_ranges,
|
|
1227
|
-
"get_project_type": self.project_type_analyzer.analyze,
|
|
1253
|
+
"get_project_type": self.project_type_analyzer.analyze,
|
|
1254
|
+
"response_user": self.tools.response_user,
|
|
1255
|
+
|
|
1228
1256
|
}
|
|
1229
1257
|
|
|
1230
1258
|
if command not in command_map:
|
|
@@ -28,6 +28,10 @@ from autocoder.utils.queue_communicate import (
|
|
|
28
28
|
import sys
|
|
29
29
|
import io
|
|
30
30
|
from autocoder.common import files as files_utils
|
|
31
|
+
from autocoder.common.printer import Printer
|
|
32
|
+
from prompt_toolkit import PromptSession
|
|
33
|
+
from prompt_toolkit.styles import Style
|
|
34
|
+
|
|
31
35
|
|
|
32
36
|
@byzerllm.prompt()
|
|
33
37
|
def detect_rm_command(command: str) -> Bool:
|
|
@@ -56,6 +60,7 @@ class AutoCommandTools:
|
|
|
56
60
|
self.args = args
|
|
57
61
|
self.llm = llm
|
|
58
62
|
self.result_manager = ResultManager()
|
|
63
|
+
self.printer = Printer()
|
|
59
64
|
|
|
60
65
|
def ask_user(self,question:str) -> str:
|
|
61
66
|
'''
|
|
@@ -91,35 +96,43 @@ class AutoCommandTools:
|
|
|
91
96
|
)
|
|
92
97
|
|
|
93
98
|
# 显示问题面板
|
|
94
|
-
console.print(question_panel)
|
|
99
|
+
console.print(question_panel)
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
session = PromptSession( message=self.printer.get_message_from_key('tool_ask_user'))
|
|
102
|
+
try:
|
|
103
|
+
answer = session.prompt()
|
|
104
|
+
except KeyboardInterrupt:
|
|
105
|
+
answer = ""
|
|
101
106
|
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
self.result_manager.append(content=answer, meta = {
|
|
108
|
+
"action": "ask_user",
|
|
109
|
+
"input": {
|
|
110
|
+
"question": question
|
|
111
|
+
}
|
|
112
|
+
})
|
|
104
113
|
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
return answer
|
|
115
|
+
|
|
116
|
+
def response_user(self, response: str):
|
|
117
|
+
console = Console()
|
|
118
|
+
answer_text = Text(response, style="italic")
|
|
107
119
|
answer_panel = Panel(
|
|
108
120
|
answer_text,
|
|
109
|
-
title="
|
|
121
|
+
title="",
|
|
110
122
|
border_style="green",
|
|
111
123
|
expand=False
|
|
112
124
|
)
|
|
113
125
|
console.print(answer_panel)
|
|
114
126
|
|
|
115
|
-
self.result_manager.append(content=
|
|
116
|
-
"action": "
|
|
127
|
+
self.result_manager.append(content=response, meta = {
|
|
128
|
+
"action": "response_user",
|
|
117
129
|
"input": {
|
|
118
|
-
"
|
|
130
|
+
"response": response
|
|
119
131
|
}
|
|
120
132
|
})
|
|
121
133
|
|
|
122
|
-
return
|
|
134
|
+
return response
|
|
135
|
+
|
|
123
136
|
|
|
124
137
|
def run_python_code(self, code: str) -> str:
|
|
125
138
|
"""
|
|
@@ -130,7 +130,7 @@ MESSAGES = {
|
|
|
130
130
|
"quick_filter_too_long": "⚠️ index file is too large ({{ tokens_len }}/{{ max_tokens }}). The query will be split into {{ split_size }} chunks.",
|
|
131
131
|
"quick_filter_tokens_len": "📊 Current index size: {{ tokens_len }} tokens",
|
|
132
132
|
"estimated_chat_input_tokens": "Estimated chat input tokens: {{ estimated_input_tokens }}",
|
|
133
|
-
"estimated_input_tokens_in_generate": "Estimated input tokens in generate ({{ generate_mode }}): {{ estimated_input_tokens }}",
|
|
133
|
+
"estimated_input_tokens_in_generate": "Estimated input tokens in generate ({{ generate_mode }}): {{ estimated_input_tokens }}",
|
|
134
134
|
"model_has_access_restrictions": "{{model_name}} has access restrictions, cannot use the current function",
|
|
135
135
|
"auto_command_not_found": "Auto command not found: {{command}}. Please check your input and try again.",
|
|
136
136
|
"auto_command_failed": "Auto command failed: {{error}}. Please check your input and try again.",
|
|
@@ -163,11 +163,22 @@ MESSAGES = {
|
|
|
163
163
|
"diff_blocks_title":"diff blocks",
|
|
164
164
|
"index_exclude_files_error": "index filter exclude files fail: {{ error }}",
|
|
165
165
|
"file_sliding_window_processing": "File {{ file_path }} is too large ({{ tokens }} tokens), processing with sliding window...",
|
|
166
|
-
"file_snippet_processing": "Processing file {{ file_path }} with code snippet extraction..."
|
|
166
|
+
"file_snippet_processing": "Processing file {{ file_path }} with code snippet extraction...",
|
|
167
|
+
"context_pruning_start": "⚠️ Context pruning started. Total tokens: {{ total_tokens }} (max allowed: {{ max_tokens }}). Applying strategy: {{ strategy }}.",
|
|
168
|
+
"context_pruning_reason": "Context length exceeds maximum limit ({{ total_tokens }} > {{ max_tokens }}). Pruning is required to fit within the model's context window.",
|
|
169
|
+
"rank_code_modification_title": "{{model_name}} ranking codes",
|
|
170
|
+
"sorted_files_message": "Reordered files:\n{% for file in files %}- {{ file }}\n{% endfor %}",
|
|
171
|
+
"estimated_input_tokens_in_ranking": "estimate input token {{ estimated_input_tokens }} when ranking",
|
|
172
|
+
"file_snippet_procesed": "{{ file_path }} processed with tokens: {{ tokens }} => {{ snippet_tokens }}. Current total tokens: {{ total_tokens }}",
|
|
173
|
+
"tool_ask_user": "Your Reply: ",
|
|
174
|
+
"tool_ask_user_accept":"Your Response received",
|
|
175
|
+
|
|
167
176
|
},
|
|
168
177
|
"zh": {
|
|
169
178
|
"file_sliding_window_processing": "文件 {{ file_path }} 过大 ({{ tokens }} tokens),正在使用滑动窗口处理...",
|
|
170
179
|
"file_snippet_processing": "正在对文件 {{ file_path }} 进行代码片段提取...",
|
|
180
|
+
"context_pruning_start": "⚠️ 开始上下文剪枝。总token数: {{ total_tokens }} (最大允许: {{ max_tokens }})。正在应用策略: {{ strategy }}。",
|
|
181
|
+
"context_pruning_reason": "上下文长度超过最大限制 ({{ total_tokens }} > {{ max_tokens }})。需要进行剪枝以适配模型的上下文窗口。",
|
|
171
182
|
"file_scored_message": "文件评分: {{file_path}} - 分数: {{score}}",
|
|
172
183
|
"invalid_file_pattern": "无效的文件模式: {{file_pattern}}. 例如: regex://.*/package-lock\\.json",
|
|
173
184
|
"conf_not_found": "未找到配置文件: {{path}}",
|
|
@@ -308,7 +319,7 @@ MESSAGES = {
|
|
|
308
319
|
"quick_filter_title": "{{ model_name }} 正在分析如何筛选上下文...",
|
|
309
320
|
"quick_filter_failed": "❌ 快速过滤器失败: {{ error }}. ",
|
|
310
321
|
"estimated_chat_input_tokens": "对话输入token预估为: {{ estimated_input_tokens }}",
|
|
311
|
-
"estimated_input_tokens_in_generate": "生成代码({{ generate_mode }})预计输入token数: {{
|
|
322
|
+
"estimated_input_tokens_in_generate": "生成代码({{ generate_mode }})预计输入token数: {{ estimated_input_tokens }}",
|
|
312
323
|
"model_has_access_restrictions": "{{model_name}} 有访问限制,无法使用当前功能",
|
|
313
324
|
"auto_command_not_found": "未找到自动命令: {{command}}。请检查您的输入并重试。",
|
|
314
325
|
"auto_command_failed": "自动命令执行失败: {{error}}。请检查您的输入并重试。",
|
|
@@ -324,7 +335,13 @@ MESSAGES = {
|
|
|
324
335
|
"index_import_success": "索引导入成功: {{path}}",
|
|
325
336
|
"edits_title": "编辑块",
|
|
326
337
|
"diff_blocks_title": "差异块",
|
|
327
|
-
"index_exclude_files_error": "索引排除文件时出错: {{error}}"
|
|
338
|
+
"index_exclude_files_error": "索引排除文件时出错: {{error}}",
|
|
339
|
+
"rank_code_modification_title": "模型{{model_name}}对代码打分",
|
|
340
|
+
"sorted_files_message": "重新排序后的文件路径:\n{% for file in files %}- {{ file }}\n{% endfor %}",
|
|
341
|
+
"estimated_input_tokens_in_ranking": "排序预计输入token数: {{ estimated_input_tokens }}",
|
|
342
|
+
"file_snippet_procesed": "文件 {{ file_path }} 处理后token数: {{ tokens }} => {{ snippet_tokens }} 当前总token数: {{ total_tokens }}",
|
|
343
|
+
"tool_ask_user": "您的回复: ",
|
|
344
|
+
"tool_ask_user_accept":"收到您的回复",
|
|
328
345
|
}}
|
|
329
346
|
|
|
330
347
|
|