auto-coder 0.1.231__tar.gz → 0.1.233__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.231 → auto_coder-0.1.233}/PKG-INFO +1 -1
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/auto_coder.egg-info/PKG-INFO +1 -1
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/auto_coder.egg-info/SOURCES.txt +4 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/auto_coder.py +32 -6
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/chat_auto_coder.py +12 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/__init__.py +1 -0
- auto_coder-0.1.233/src/autocoder/common/utils_code_auto_generate.py +90 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/dispacher/actions/action.py +1 -1
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/dispacher/actions/copilot.py +1 -1
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +1 -1
- auto_coder-0.1.233/src/autocoder/index/entry.py +286 -0
- auto_coder-0.1.233/src/autocoder/index/filter/normal_filter.py +168 -0
- auto_coder-0.1.233/src/autocoder/index/filter/quick_filter.py +98 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/index/index.py +6 -393
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/index/types.py +4 -1
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/auto_coder_utils/chat_stream_out.py +1 -1
- auto_coder-0.1.233/src/autocoder/utils/chat_auto_coder_utils/__init__.py +0 -0
- auto_coder-0.1.233/src/autocoder/version.py +1 -0
- auto_coder-0.1.231/src/autocoder/common/utils_code_auto_generate.py +0 -38
- auto_coder-0.1.231/src/autocoder/version.py +0 -1
- {auto_coder-0.1.231 → auto_coder-0.1.233}/LICENSE +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/README.md +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/setup.cfg +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/setup.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/auto_coder.egg-info/dependency_links.txt +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/auto_coder.egg-info/entry_points.txt +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/auto_coder.egg-info/requires.txt +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/auto_coder.egg-info/top_level.txt +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/auto_demand_organizer.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/auto_filegroup.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/auto_guess_query.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/auto_tool.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/coder.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/designer.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/planner.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/agent/project_reader.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/auto_coder_lang.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/auto_coder_rag.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/auto_coder_rag_client_mcp.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/auto_coder_rag_mcp.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/auto_coder_server.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/benchmark.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/chat/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/chat_auto_coder_lang.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/command_args.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/JupyterClient.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/ShellClient.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/anything2images.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/anything2img.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/audio.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/buildin_tokenizer.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/chunk_validation.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/cleaner.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_execute.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_generate.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_generate_diff.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_merge.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_merge_diff.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_auto_merge_strict_diff.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/code_modification_ranker.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/command_completer.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/command_generator.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/command_templates.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/const.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/files.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/git_utils.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/image_to_page.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/interpreter.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/llm_rerank.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/mcp_hub.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/mcp_server.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/mcp_servers/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/mcp_servers/mcp_server_perplexity.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/mcp_tools.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/memory_manager.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/recall_validation.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/screenshots.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/search.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/search_replace.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/sys_prompt.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/text.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/common/types.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/data/tokenizer.json +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/db/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/db/store.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/dispacher/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/dispacher/actions/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/index/__init__.py +0 -0
- {auto_coder-0.1.231/src/autocoder/rag → auto_coder-0.1.233/src/autocoder/index/filter}/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/index/for_command.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/index/symbols_utils.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/lang.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/models.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/pyproject/__init__.py +0 -0
- {auto_coder-0.1.231/src/autocoder/rag/cache → auto_coder-0.1.233/src/autocoder/rag}/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/api_server.py +0 -0
- {auto_coder-0.1.231/src/autocoder/rag/stream_event → auto_coder-0.1.233/src/autocoder/rag/cache}/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/cache/base_cache.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/cache/byzer_storage_cache.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/cache/simple_cache.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/doc_filter.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/document_retriever.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/llm_wrapper.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/loaders/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/loaders/docx_loader.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/loaders/excel_loader.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/long_context_rag.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/rag_config.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/rag_entry.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/raw_rag.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/relevant_utils.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/simple_directory_reader.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/simple_rag.py +0 -0
- {auto_coder-0.1.231/src/autocoder/utils/auto_coder_utils → auto_coder-0.1.233/src/autocoder/rag/stream_event}/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/stream_event/event_writer.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/stream_event/types.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/token_checker.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/token_counter.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/token_limiter.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/types.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/utils.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/rag/variable_holder.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/regexproject/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/suffixproject/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/tsproject/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/_markitdown.py +0 -0
- {auto_coder-0.1.231/src/autocoder/utils/chat_auto_coder_utils → auto_coder-0.1.233/src/autocoder/utils/auto_coder_utils}/__init__.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/conversation_store.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/llm_client_interceptors.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/llms.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/log_capture.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/multi_turn.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/operate_config_api.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/print_table.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/queue_communicate.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/request_event_queue.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/request_queue.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/rest.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/src/autocoder/utils/tests.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/tests/test_action_regex_project.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/tests/test_chat_auto_coder.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/tests/test_code_auto_merge_editblock.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/tests/test_command_completer.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/tests/test_planner.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/tests/test_queue_communicate.py +0 -0
- {auto_coder-0.1.231 → auto_coder-0.1.233}/tests/test_symbols_utils.py +0 -0
|
@@ -84,10 +84,14 @@ src/autocoder/dispacher/actions/plugins/__init__.py
|
|
|
84
84
|
src/autocoder/dispacher/actions/plugins/action_regex_project.py
|
|
85
85
|
src/autocoder/dispacher/actions/plugins/action_translate.py
|
|
86
86
|
src/autocoder/index/__init__.py
|
|
87
|
+
src/autocoder/index/entry.py
|
|
87
88
|
src/autocoder/index/for_command.py
|
|
88
89
|
src/autocoder/index/index.py
|
|
89
90
|
src/autocoder/index/symbols_utils.py
|
|
90
91
|
src/autocoder/index/types.py
|
|
92
|
+
src/autocoder/index/filter/__init__.py
|
|
93
|
+
src/autocoder/index/filter/normal_filter.py
|
|
94
|
+
src/autocoder/index/filter/quick_filter.py
|
|
91
95
|
src/autocoder/pyproject/__init__.py
|
|
92
96
|
src/autocoder/rag/__init__.py
|
|
93
97
|
src/autocoder/rag/api_server.py
|
|
@@ -42,6 +42,7 @@ from rich.live import Live
|
|
|
42
42
|
from autocoder.auto_coder_lang import get_message
|
|
43
43
|
from autocoder.common.memory_manager import save_to_memory_file
|
|
44
44
|
from autocoder import models as models_module
|
|
45
|
+
from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
|
|
45
46
|
from autocoder.utils.auto_coder_utils.chat_stream_out import stream_out
|
|
46
47
|
|
|
47
48
|
console = Console()
|
|
@@ -443,7 +444,24 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
443
444
|
"saas.is_reasoning": model_info["is_reasoning"]
|
|
444
445
|
}
|
|
445
446
|
)
|
|
446
|
-
llm.setup_sub_client("inference_model", inference_model)
|
|
447
|
+
llm.setup_sub_client("inference_model", inference_model)
|
|
448
|
+
|
|
449
|
+
if args.index_filter_model:
|
|
450
|
+
model_info = models_module.get_model_by_name(args.index_filter_model)
|
|
451
|
+
model_name = args.index_filter_model
|
|
452
|
+
index_filter_model = byzerllm.SimpleByzerLLM(default_model_name=model_name)
|
|
453
|
+
index_filter_model.deploy(
|
|
454
|
+
model_path="",
|
|
455
|
+
pretrained_model_type=model_info["model_type"],
|
|
456
|
+
udf_name=model_name,
|
|
457
|
+
infer_params={
|
|
458
|
+
"saas.base_url": model_info["base_url"],
|
|
459
|
+
"saas.api_key": model_info["api_key"],
|
|
460
|
+
"saas.model": model_info["model_name"],
|
|
461
|
+
"saas.is_reasoning": model_info["is_reasoning"]
|
|
462
|
+
}
|
|
463
|
+
)
|
|
464
|
+
llm.setup_sub_client("index_filter_model", index_filter_model)
|
|
447
465
|
|
|
448
466
|
|
|
449
467
|
if args.product_mode == "pro":
|
|
@@ -482,7 +500,12 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
482
500
|
if args.inference_model:
|
|
483
501
|
inference_model = byzerllm.ByzerLLM()
|
|
484
502
|
inference_model.setup_default_model_name(args.inference_model)
|
|
485
|
-
llm.setup_sub_client("inference_model", inference_model)
|
|
503
|
+
llm.setup_sub_client("inference_model", inference_model)
|
|
504
|
+
|
|
505
|
+
if args.index_filter_model:
|
|
506
|
+
index_filter_model = byzerllm.ByzerLLM()
|
|
507
|
+
index_filter_model.setup_default_model_name(args.index_filter_model)
|
|
508
|
+
llm.setup_sub_client("index_filter_model", index_filter_model)
|
|
486
509
|
|
|
487
510
|
|
|
488
511
|
if args.human_as_model:
|
|
@@ -1106,7 +1129,8 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1106
1129
|
{"role": "assistant", "content": "read"})
|
|
1107
1130
|
source_count += 1
|
|
1108
1131
|
|
|
1109
|
-
from autocoder.index.index import IndexManager
|
|
1132
|
+
from autocoder.index.index import IndexManager
|
|
1133
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
1110
1134
|
from autocoder.pyproject import PyProject
|
|
1111
1135
|
from autocoder.tsproject import TSProject
|
|
1112
1136
|
from autocoder.suffixproject import SuffixProject
|
|
@@ -1273,9 +1297,11 @@ def main(input_args: Optional[List[str]] = None):
|
|
|
1273
1297
|
)
|
|
1274
1298
|
v = [[response.result,None]]
|
|
1275
1299
|
else:
|
|
1276
|
-
v =
|
|
1277
|
-
|
|
1278
|
-
|
|
1300
|
+
v = stream_chat_with_continue(
|
|
1301
|
+
llm=chat_llm,
|
|
1302
|
+
conversations=loaded_conversations,
|
|
1303
|
+
llm_config={}
|
|
1304
|
+
)
|
|
1279
1305
|
|
|
1280
1306
|
assistant_response, last_meta = stream_out(
|
|
1281
1307
|
v,
|
|
@@ -52,6 +52,7 @@ from autocoder.common.memory_manager import get_global_memory_file_paths
|
|
|
52
52
|
from autocoder import models
|
|
53
53
|
import shlex
|
|
54
54
|
from autocoder.utils.llms import get_single_llm
|
|
55
|
+
import pkg_resources
|
|
55
56
|
|
|
56
57
|
class SymbolItem(BaseModel):
|
|
57
58
|
symbol_name: str
|
|
@@ -2478,6 +2479,17 @@ def lib_command(args: List[str]):
|
|
|
2478
2479
|
|
|
2479
2480
|
|
|
2480
2481
|
def main():
|
|
2482
|
+
from autocoder.rag.variable_holder import VariableHolder
|
|
2483
|
+
from tokenizers import Tokenizer
|
|
2484
|
+
try:
|
|
2485
|
+
tokenizer_path = pkg_resources.resource_filename(
|
|
2486
|
+
"autocoder", "data/tokenizer.json"
|
|
2487
|
+
)
|
|
2488
|
+
VariableHolder.TOKENIZER_PATH = tokenizer_path
|
|
2489
|
+
VariableHolder.TOKENIZER_MODEL = Tokenizer.from_file(tokenizer_path)
|
|
2490
|
+
except FileNotFoundError:
|
|
2491
|
+
tokenizer_path = None
|
|
2492
|
+
|
|
2481
2493
|
ARGS = parse_arguments()
|
|
2482
2494
|
|
|
2483
2495
|
if ARGS.lite:
|
|
@@ -259,6 +259,7 @@ class AutoCoderArgs(pydantic.BaseModel):
|
|
|
259
259
|
skip_filter_index: Optional[bool] = False
|
|
260
260
|
|
|
261
261
|
index_model: Optional[str] = ""
|
|
262
|
+
index_filter_model: Optional[str] = ""
|
|
262
263
|
index_model_max_length: Optional[int] = 0
|
|
263
264
|
index_model_max_input_length: Optional[int] = 0
|
|
264
265
|
index_model_anti_quota_limit: Optional[int] = 0
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from byzerllm import ByzerLLM,SimpleByzerLLM
|
|
2
|
+
from typing import Generator, List, Any, Union
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
from loguru import logger
|
|
5
|
+
|
|
6
|
+
class ChatWithContinueResult(BaseModel):
|
|
7
|
+
content: str
|
|
8
|
+
input_tokens_count: int
|
|
9
|
+
generated_tokens_count: int
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def chat_with_continue(llm: Union[ByzerLLM,SimpleByzerLLM], conversations: List[dict], llm_config: dict) -> ChatWithContinueResult:
|
|
13
|
+
final_result = ChatWithContinueResult(content="", input_tokens_count=0, generated_tokens_count=0)
|
|
14
|
+
v = llm.chat_oai(
|
|
15
|
+
conversations=conversations, llm_config=llm_config)
|
|
16
|
+
|
|
17
|
+
single_result = v[0].output
|
|
18
|
+
metadata = v[0].metadata
|
|
19
|
+
|
|
20
|
+
final_result.input_tokens_count += metadata.get("input_tokens_count", 0)
|
|
21
|
+
final_result.generated_tokens_count += metadata.get("generated_tokens_count", 0)
|
|
22
|
+
|
|
23
|
+
temp_conversations = conversations + \
|
|
24
|
+
[{"role": "assistant", "content": single_result}]
|
|
25
|
+
|
|
26
|
+
count = 1
|
|
27
|
+
while (metadata.get("finish_reason", "stop") == "length" and count < 6):
|
|
28
|
+
v = llm.chat_oai(
|
|
29
|
+
conversations=temp_conversations, llm_config={**llm_config, "gen.response_prefix": True})
|
|
30
|
+
metadata = v[0].metadata
|
|
31
|
+
single_result += v[0].output
|
|
32
|
+
final_result.input_tokens_count += metadata.get("input_tokens_count", 0)
|
|
33
|
+
final_result.generated_tokens_count += metadata.get("generated_tokens_count", 0)
|
|
34
|
+
count += 1
|
|
35
|
+
|
|
36
|
+
# if count >= 2:
|
|
37
|
+
# logger.info(f"The code generation is exceed the max length, continue to generate the code {count -1 } times")
|
|
38
|
+
final_result.content = single_result
|
|
39
|
+
return final_result
|
|
40
|
+
|
|
41
|
+
def stream_chat_with_continue(
|
|
42
|
+
llm: Union[ByzerLLM, SimpleByzerLLM],
|
|
43
|
+
conversations: List[dict],
|
|
44
|
+
llm_config: dict
|
|
45
|
+
) -> Generator[Any, None, None]:
|
|
46
|
+
"""
|
|
47
|
+
流式处理并继续生成内容,直到完成。
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
llm (Union[ByzerLLM, SimpleByzerLLM]): LLM实例
|
|
51
|
+
conversations (List[dict]): 对话历史
|
|
52
|
+
llm_config (dict): LLM配置参数
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
count = 0
|
|
58
|
+
temp_conversations = conversations
|
|
59
|
+
current_metadata = None
|
|
60
|
+
|
|
61
|
+
while True:
|
|
62
|
+
# 使用流式接口获取生成内容
|
|
63
|
+
stream_generator = llm.stream_chat_oai(
|
|
64
|
+
conversations=temp_conversations,
|
|
65
|
+
delta_mode=True,
|
|
66
|
+
llm_config={**llm_config, "gen.response_prefix": True if count > 0 else False}
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
current_content = ""
|
|
70
|
+
for res in stream_generator:
|
|
71
|
+
content = res[0]
|
|
72
|
+
current_content += content
|
|
73
|
+
if current_metadata is None:
|
|
74
|
+
current_metadata = res[1]
|
|
75
|
+
else:
|
|
76
|
+
current_metadata.generated_tokens_count += res[1].generated_tokens_count
|
|
77
|
+
current_metadata.input_tokens_count += res[1].input_tokens_count
|
|
78
|
+
current_metadata.finish_reason = res[1].finish_reason
|
|
79
|
+
|
|
80
|
+
# Yield 当前的 StreamChatWithContinueResult
|
|
81
|
+
yield (content,current_metadata)
|
|
82
|
+
|
|
83
|
+
# 更新对话历史
|
|
84
|
+
temp_conversations.append({"role": "assistant", "content": current_content})
|
|
85
|
+
|
|
86
|
+
# 检查是否需要继续生成
|
|
87
|
+
if current_metadata.finish_reason != "length" or count >= 5:
|
|
88
|
+
break
|
|
89
|
+
|
|
90
|
+
count += 1
|
|
@@ -9,7 +9,7 @@ from autocoder.common.buildin_tokenizer import BuildinTokenizer
|
|
|
9
9
|
from autocoder.pyproject import PyProject, Level1PyProject
|
|
10
10
|
from autocoder.tsproject import TSProject
|
|
11
11
|
from autocoder.suffixproject import SuffixProject
|
|
12
|
-
from autocoder.index.
|
|
12
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
13
13
|
from autocoder.common.code_auto_merge import CodeAutoMerge
|
|
14
14
|
from autocoder.common.code_auto_merge_diff import CodeAutoMergeDiff
|
|
15
15
|
from autocoder.common.code_auto_merge_strict_diff import CodeAutoMergeStrictDiff
|
|
@@ -9,7 +9,7 @@ from autocoder.common.JupyterClient import JupyterNotebook
|
|
|
9
9
|
from autocoder.common.ShellClient import ShellClient
|
|
10
10
|
from autocoder.suffixproject import SuffixProject
|
|
11
11
|
from autocoder.common.search import Search, SearchEngine
|
|
12
|
-
from autocoder.index.
|
|
12
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
13
13
|
from autocoder.common.image_to_page import ImageToPage, ImageToPageDirectly
|
|
14
14
|
from typing import Optional, Dict, Any, List
|
|
15
15
|
import byzerllm
|
|
@@ -9,7 +9,7 @@ from autocoder.common.code_auto_generate import CodeAutoGenerate
|
|
|
9
9
|
from autocoder.common.code_auto_generate_diff import CodeAutoGenerateDiff
|
|
10
10
|
from autocoder.common.code_auto_generate_strict_diff import CodeAutoGenerateStrictDiff
|
|
11
11
|
from autocoder.common.code_auto_generate_editblock import CodeAutoGenerateEditBlock
|
|
12
|
-
from autocoder.index.
|
|
12
|
+
from autocoder.index.entry import build_index_and_filter_files
|
|
13
13
|
from autocoder.regexproject import RegexProject
|
|
14
14
|
from autocoder.utils.conversation_store import store_code_model_conversation
|
|
15
15
|
from loguru import logger
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
import time
|
|
4
|
+
from typing import List, Dict, Any, Optional
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from autocoder.common import SourceCode, AutoCoderArgs
|
|
7
|
+
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.table import Table
|
|
10
|
+
from rich.panel import Panel
|
|
11
|
+
|
|
12
|
+
from loguru import logger
|
|
13
|
+
from autocoder.utils.queue_communicate import (
|
|
14
|
+
queue_communicate,
|
|
15
|
+
CommunicateEvent,
|
|
16
|
+
CommunicateEventType,
|
|
17
|
+
)
|
|
18
|
+
from autocoder.index.types import (
|
|
19
|
+
TargetFile
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
from autocoder.index.filter.quick_filter import QuickFilter
|
|
23
|
+
from autocoder.index.filter.normal_filter import NormalFilter
|
|
24
|
+
from autocoder.index.index import IndexManager
|
|
25
|
+
|
|
26
|
+
def build_index_and_filter_files(
|
|
27
|
+
llm, args: AutoCoderArgs, sources: List[SourceCode]
|
|
28
|
+
) -> str:
|
|
29
|
+
# Initialize timing and statistics
|
|
30
|
+
total_start_time = time.monotonic()
|
|
31
|
+
stats = {
|
|
32
|
+
"total_files": len(sources),
|
|
33
|
+
"indexed_files": 0,
|
|
34
|
+
"level1_filtered": 0,
|
|
35
|
+
"level2_filtered": 0,
|
|
36
|
+
"verified_files": 0,
|
|
37
|
+
"final_files": 0,
|
|
38
|
+
"timings": {
|
|
39
|
+
"process_tagged_sources": 0.0,
|
|
40
|
+
"build_index": 0.0,
|
|
41
|
+
"quick_filter": 0.0,
|
|
42
|
+
"normal_filter": {
|
|
43
|
+
"level1_filter": 0.0,
|
|
44
|
+
"level2_filter": 0.0,
|
|
45
|
+
"relevance_verification": 0.0,
|
|
46
|
+
},
|
|
47
|
+
"file_selection": 0.0,
|
|
48
|
+
"prepare_output": 0.0,
|
|
49
|
+
"total": 0.0
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
def get_file_path(file_path):
|
|
54
|
+
if file_path.startswith("##"):
|
|
55
|
+
return file_path.strip()[2:]
|
|
56
|
+
return file_path
|
|
57
|
+
|
|
58
|
+
final_files: Dict[str, TargetFile] = {}
|
|
59
|
+
|
|
60
|
+
# Phase 1: Process REST/RAG/Search sources
|
|
61
|
+
logger.info("Phase 1: Processing REST/RAG/Search sources...")
|
|
62
|
+
phase_start = time.monotonic()
|
|
63
|
+
for source in sources:
|
|
64
|
+
if source.tag in ["REST", "RAG", "SEARCH"]:
|
|
65
|
+
final_files[get_file_path(source.module_name)] = TargetFile(
|
|
66
|
+
file_path=source.module_name, reason="Rest/Rag/Search"
|
|
67
|
+
)
|
|
68
|
+
phase_end = time.monotonic()
|
|
69
|
+
stats["timings"]["process_tagged_sources"] = phase_end - phase_start
|
|
70
|
+
|
|
71
|
+
if not args.skip_build_index and llm:
|
|
72
|
+
# Phase 2: Build index
|
|
73
|
+
if args.request_id and not args.skip_events:
|
|
74
|
+
queue_communicate.send_event(
|
|
75
|
+
request_id=args.request_id,
|
|
76
|
+
event=CommunicateEvent(
|
|
77
|
+
event_type=CommunicateEventType.CODE_INDEX_BUILD_START.value,
|
|
78
|
+
data=json.dumps({"total_files": len(sources)})
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
logger.info("Phase 2: Building index for all files...")
|
|
83
|
+
phase_start = time.monotonic()
|
|
84
|
+
index_manager = IndexManager(llm=llm, sources=sources, args=args)
|
|
85
|
+
index_data = index_manager.build_index()
|
|
86
|
+
stats["indexed_files"] = len(index_data) if index_data else 0
|
|
87
|
+
phase_end = time.monotonic()
|
|
88
|
+
stats["timings"]["build_index"] = phase_end - phase_start
|
|
89
|
+
|
|
90
|
+
if args.request_id and not args.skip_events:
|
|
91
|
+
queue_communicate.send_event(
|
|
92
|
+
request_id=args.request_id,
|
|
93
|
+
event=CommunicateEvent(
|
|
94
|
+
event_type=CommunicateEventType.CODE_INDEX_BUILD_END.value,
|
|
95
|
+
data=json.dumps({
|
|
96
|
+
"indexed_files": stats["indexed_files"],
|
|
97
|
+
"build_index_time": stats["timings"]["build_index"],
|
|
98
|
+
})
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
quick_filter = QuickFilter(index_manager,stats,sources)
|
|
103
|
+
final_files = quick_filter.filter(index_manager.read_index(),args.query)
|
|
104
|
+
|
|
105
|
+
if not final_files:
|
|
106
|
+
normal_filter = NormalFilter(index_manager,stats,sources)
|
|
107
|
+
final_files = normal_filter.filter(index_manager.read_index(),args.query)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def display_table_and_get_selections(data):
|
|
111
|
+
from prompt_toolkit.shortcuts import checkboxlist_dialog
|
|
112
|
+
from prompt_toolkit.styles import Style
|
|
113
|
+
|
|
114
|
+
choices = [(file, f"{file} - {reason}") for file, reason in data]
|
|
115
|
+
selected_files = [file for file, _ in choices]
|
|
116
|
+
|
|
117
|
+
style = Style.from_dict(
|
|
118
|
+
{
|
|
119
|
+
"dialog": "bg:#88ff88",
|
|
120
|
+
"dialog frame.label": "bg:#ffffff #000000",
|
|
121
|
+
"dialog.body": "bg:#88ff88 #000000",
|
|
122
|
+
"dialog shadow": "bg:#00aa00",
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
result = checkboxlist_dialog(
|
|
127
|
+
title="Target Files",
|
|
128
|
+
text="Tab to switch between buttons, and Space/Enter to select/deselect.",
|
|
129
|
+
values=choices,
|
|
130
|
+
style=style,
|
|
131
|
+
default_values=selected_files,
|
|
132
|
+
).run()
|
|
133
|
+
|
|
134
|
+
return [file for file in result] if result else []
|
|
135
|
+
|
|
136
|
+
def print_selected(data):
|
|
137
|
+
console = Console()
|
|
138
|
+
|
|
139
|
+
table = Table(
|
|
140
|
+
title="Files Used as Context",
|
|
141
|
+
show_header=True,
|
|
142
|
+
header_style="bold magenta",
|
|
143
|
+
)
|
|
144
|
+
table.add_column("File Path", style="cyan", no_wrap=True)
|
|
145
|
+
table.add_column("Reason", style="green")
|
|
146
|
+
|
|
147
|
+
for file, reason in data:
|
|
148
|
+
table.add_row(file, reason)
|
|
149
|
+
|
|
150
|
+
panel = Panel(
|
|
151
|
+
table,
|
|
152
|
+
expand=False,
|
|
153
|
+
border_style="bold blue",
|
|
154
|
+
padding=(1, 1),
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
console.print(panel)
|
|
158
|
+
|
|
159
|
+
# Phase 6: File selection and limitation
|
|
160
|
+
logger.info("Phase 6: Processing file selection and limits...")
|
|
161
|
+
phase_start = time.monotonic()
|
|
162
|
+
|
|
163
|
+
if args.index_filter_file_num > 0:
|
|
164
|
+
logger.info(
|
|
165
|
+
f"Limiting files from {len(final_files)} to {args.index_filter_file_num}")
|
|
166
|
+
|
|
167
|
+
if args.skip_confirm:
|
|
168
|
+
final_filenames = [file.file_path for file in final_files.values()]
|
|
169
|
+
if args.index_filter_file_num > 0:
|
|
170
|
+
final_filenames = final_filenames[: args.index_filter_file_num]
|
|
171
|
+
else:
|
|
172
|
+
target_files_data = [
|
|
173
|
+
(file.file_path, file.reason) for file in final_files.values()
|
|
174
|
+
]
|
|
175
|
+
if not target_files_data:
|
|
176
|
+
logger.warning(
|
|
177
|
+
"No target files found, you may need to rewrite the query and try again."
|
|
178
|
+
)
|
|
179
|
+
final_filenames = []
|
|
180
|
+
else:
|
|
181
|
+
final_filenames = display_table_and_get_selections(
|
|
182
|
+
target_files_data)
|
|
183
|
+
|
|
184
|
+
if args.index_filter_file_num > 0:
|
|
185
|
+
final_filenames = final_filenames[: args.index_filter_file_num]
|
|
186
|
+
|
|
187
|
+
phase_end = time.monotonic()
|
|
188
|
+
stats["timings"]["file_selection"] = phase_end - phase_start
|
|
189
|
+
|
|
190
|
+
# Phase 7: Display results and prepare output
|
|
191
|
+
logger.info("Phase 7: Preparing final output...")
|
|
192
|
+
phase_start = time.monotonic()
|
|
193
|
+
try:
|
|
194
|
+
print_selected(
|
|
195
|
+
[
|
|
196
|
+
(file.file_path, file.reason)
|
|
197
|
+
for file in final_files.values()
|
|
198
|
+
if file.file_path in final_filenames
|
|
199
|
+
]
|
|
200
|
+
)
|
|
201
|
+
except Exception as e:
|
|
202
|
+
logger.warning(
|
|
203
|
+
"Failed to display selected files in terminal mode. Falling back to simple print."
|
|
204
|
+
)
|
|
205
|
+
print("Target Files Selected:")
|
|
206
|
+
for file in final_filenames:
|
|
207
|
+
print(f"{file} - {final_files[file].reason}")
|
|
208
|
+
|
|
209
|
+
source_code = ""
|
|
210
|
+
depulicated_sources = set()
|
|
211
|
+
|
|
212
|
+
for file in sources:
|
|
213
|
+
if file.module_name in final_filenames:
|
|
214
|
+
if file.module_name in depulicated_sources:
|
|
215
|
+
continue
|
|
216
|
+
depulicated_sources.add(file.module_name)
|
|
217
|
+
source_code += f"##File: {file.module_name}\n"
|
|
218
|
+
source_code += f"{file.source_code}\n\n"
|
|
219
|
+
|
|
220
|
+
if args.request_id and not args.skip_events:
|
|
221
|
+
queue_communicate.send_event(
|
|
222
|
+
request_id=args.request_id,
|
|
223
|
+
event=CommunicateEvent(
|
|
224
|
+
event_type=CommunicateEventType.CODE_INDEX_FILTER_FILE_SELECTED.value,
|
|
225
|
+
data=json.dumps([
|
|
226
|
+
(file.file_path, file.reason)
|
|
227
|
+
for file in final_files.values()
|
|
228
|
+
if file.file_path in depulicated_sources
|
|
229
|
+
])
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
stats["final_files"] = len(depulicated_sources)
|
|
234
|
+
phase_end = time.monotonic()
|
|
235
|
+
stats["timings"]["prepare_output"] = phase_end - phase_start
|
|
236
|
+
|
|
237
|
+
# Calculate total time and print summary
|
|
238
|
+
total_end_time = time.monotonic()
|
|
239
|
+
total_time = total_end_time - total_start_time
|
|
240
|
+
stats["timings"]["total"] = total_time
|
|
241
|
+
|
|
242
|
+
# Calculate total filter time
|
|
243
|
+
total_filter_time = (
|
|
244
|
+
stats["timings"]["quick_filter"] +
|
|
245
|
+
stats["timings"]["normal_filter"]["level1_filter"] +
|
|
246
|
+
stats["timings"]["normal_filter"]["level2_filter"] +
|
|
247
|
+
stats["timings"]["normal_filter"]["relevance_verification"]
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
# Print final statistics in a more structured way
|
|
251
|
+
summary = f"""
|
|
252
|
+
=== Indexing and Filtering Summary ===
|
|
253
|
+
• Total files scanned: {stats['total_files']}
|
|
254
|
+
• Files indexed: {stats['indexed_files']}
|
|
255
|
+
• Files filtered:
|
|
256
|
+
- Level 1 (query-based): {stats['level1_filtered']}
|
|
257
|
+
- Level 2 (related files): {stats['level2_filtered']}
|
|
258
|
+
- Relevance verified: {stats.get('verified_files', 0)}
|
|
259
|
+
• Final files selected: {stats['final_files']}
|
|
260
|
+
|
|
261
|
+
=== Time Breakdown ===
|
|
262
|
+
• Index build: {stats['timings'].get('build_index', 0):.2f}s
|
|
263
|
+
• Quick filter: {stats['timings'].get('quick_filter', 0):.2f}s
|
|
264
|
+
• Normal filter:
|
|
265
|
+
- Level 1 filter: {stats['timings']["normal_filter"].get('level1_filter', 0):.2f}s
|
|
266
|
+
- Level 2 filter: {stats['timings']["normal_filter"].get('level2_filter', 0):.2f}s
|
|
267
|
+
- Relevance check: {stats['timings']["normal_filter"].get('relevance_verification', 0):.2f}s
|
|
268
|
+
• File selection: {stats['timings'].get('file_selection', 0):.2f}s
|
|
269
|
+
• Total time: {total_time:.2f}s
|
|
270
|
+
====================================
|
|
271
|
+
"""
|
|
272
|
+
logger.info(summary)
|
|
273
|
+
|
|
274
|
+
if args.request_id and not args.skip_events:
|
|
275
|
+
queue_communicate.send_event(
|
|
276
|
+
request_id=args.request_id,
|
|
277
|
+
event=CommunicateEvent(
|
|
278
|
+
event_type=CommunicateEventType.CODE_INDEX_FILTER_END.value,
|
|
279
|
+
data=json.dumps({
|
|
280
|
+
"filtered_files": stats["final_files"],
|
|
281
|
+
"filter_time": total_filter_time
|
|
282
|
+
})
|
|
283
|
+
)
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
return source_code
|