auto-coder 0.1.224__tar.gz → 0.1.225__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.

Files changed (145) hide show
  1. {auto_coder-0.1.224 → auto_coder-0.1.225}/PKG-INFO +1 -1
  2. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/auto_coder.egg-info/PKG-INFO +1 -1
  3. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/auto_coder.egg-info/SOURCES.txt +1 -0
  4. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/__init__.py +3 -1
  5. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/command_templates.py +4 -4
  6. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/index/for_command.py +2 -1
  7. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/index/index.py +112 -113
  8. auto_coder-0.1.225/src/autocoder/index/types.py +24 -0
  9. auto_coder-0.1.225/src/autocoder/version.py +1 -0
  10. auto_coder-0.1.224/src/autocoder/version.py +0 -1
  11. {auto_coder-0.1.224 → auto_coder-0.1.225}/LICENSE +0 -0
  12. {auto_coder-0.1.224 → auto_coder-0.1.225}/README.md +0 -0
  13. {auto_coder-0.1.224 → auto_coder-0.1.225}/setup.cfg +0 -0
  14. {auto_coder-0.1.224 → auto_coder-0.1.225}/setup.py +0 -0
  15. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/auto_coder.egg-info/dependency_links.txt +0 -0
  16. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/auto_coder.egg-info/entry_points.txt +0 -0
  17. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/auto_coder.egg-info/requires.txt +0 -0
  18. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/auto_coder.egg-info/top_level.txt +0 -0
  19. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/__init__.py +0 -0
  20. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/__init__.py +0 -0
  21. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/auto_demand_organizer.py +0 -0
  22. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/auto_filegroup.py +0 -0
  23. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/auto_guess_query.py +0 -0
  24. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/auto_tool.py +0 -0
  25. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/coder.py +0 -0
  26. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/designer.py +0 -0
  27. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/planner.py +0 -0
  28. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/agent/project_reader.py +0 -0
  29. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/auto_coder.py +0 -0
  30. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/auto_coder_lang.py +0 -0
  31. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/auto_coder_rag.py +0 -0
  32. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/auto_coder_rag_client_mcp.py +0 -0
  33. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/auto_coder_rag_mcp.py +0 -0
  34. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/auto_coder_server.py +0 -0
  35. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/benchmark.py +0 -0
  36. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/chat/__init__.py +0 -0
  37. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/chat_auto_coder.py +0 -0
  38. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/chat_auto_coder_lang.py +0 -0
  39. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/command_args.py +0 -0
  40. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/JupyterClient.py +0 -0
  41. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/ShellClient.py +0 -0
  42. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/anything2images.py +0 -0
  43. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/anything2img.py +0 -0
  44. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/audio.py +0 -0
  45. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/buildin_tokenizer.py +0 -0
  46. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/chunk_validation.py +0 -0
  47. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/cleaner.py +0 -0
  48. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_execute.py +0 -0
  49. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_generate.py +0 -0
  50. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_generate_diff.py +0 -0
  51. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
  52. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
  53. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_merge.py +0 -0
  54. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_merge_diff.py +0 -0
  55. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_merge_editblock.py +0 -0
  56. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_auto_merge_strict_diff.py +0 -0
  57. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/code_modification_ranker.py +0 -0
  58. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/command_completer.py +0 -0
  59. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/command_generator.py +0 -0
  60. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/const.py +0 -0
  61. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/git_utils.py +0 -0
  62. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/image_to_page.py +0 -0
  63. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/interpreter.py +0 -0
  64. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/llm_rerank.py +0 -0
  65. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/mcp_hub.py +0 -0
  66. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/mcp_server.py +0 -0
  67. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/mcp_servers/__init__.py +0 -0
  68. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/mcp_servers/mcp_server_perplexity.py +0 -0
  69. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/mcp_tools.py +0 -0
  70. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/memory_manager.py +0 -0
  71. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/recall_validation.py +0 -0
  72. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/screenshots.py +0 -0
  73. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/search.py +0 -0
  74. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/search_replace.py +0 -0
  75. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/sys_prompt.py +0 -0
  76. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/text.py +0 -0
  77. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/common/types.py +0 -0
  78. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/data/tokenizer.json +0 -0
  79. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/db/__init__.py +0 -0
  80. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/db/store.py +0 -0
  81. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/dispacher/__init__.py +0 -0
  82. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/dispacher/actions/__init__.py +0 -0
  83. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/dispacher/actions/action.py +0 -0
  84. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/dispacher/actions/copilot.py +0 -0
  85. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
  86. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +0 -0
  87. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
  88. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/index/__init__.py +0 -0
  89. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/index/symbols_utils.py +0 -0
  90. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/lang.py +0 -0
  91. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/pyproject/__init__.py +0 -0
  92. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/__init__.py +0 -0
  93. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/api_server.py +0 -0
  94. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/cache/__init__.py +0 -0
  95. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/cache/base_cache.py +0 -0
  96. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/cache/byzer_storage_cache.py +0 -0
  97. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
  98. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/cache/simple_cache.py +0 -0
  99. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/doc_filter.py +0 -0
  100. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/document_retriever.py +0 -0
  101. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/llm_wrapper.py +0 -0
  102. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/loaders/__init__.py +0 -0
  103. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/loaders/docx_loader.py +0 -0
  104. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/loaders/excel_loader.py +0 -0
  105. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
  106. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
  107. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/long_context_rag.py +0 -0
  108. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/rag_config.py +0 -0
  109. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/rag_entry.py +0 -0
  110. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/raw_rag.py +0 -0
  111. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/relevant_utils.py +0 -0
  112. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/simple_directory_reader.py +0 -0
  113. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/simple_rag.py +0 -0
  114. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/stream_event/__init__.py +0 -0
  115. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/stream_event/event_writer.py +0 -0
  116. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/stream_event/types.py +0 -0
  117. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/token_checker.py +0 -0
  118. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/token_counter.py +0 -0
  119. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/token_limiter.py +0 -0
  120. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/types.py +0 -0
  121. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/utils.py +0 -0
  122. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/rag/variable_holder.py +0 -0
  123. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/regexproject/__init__.py +0 -0
  124. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/suffixproject/__init__.py +0 -0
  125. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/tsproject/__init__.py +0 -0
  126. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/__init__.py +0 -0
  127. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/_markitdown.py +0 -0
  128. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/conversation_store.py +0 -0
  129. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/llm_client_interceptors.py +0 -0
  130. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/log_capture.py +0 -0
  131. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/multi_turn.py +0 -0
  132. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/operate_config_api.py +0 -0
  133. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/print_table.py +0 -0
  134. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/queue_communicate.py +0 -0
  135. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/request_event_queue.py +0 -0
  136. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/request_queue.py +0 -0
  137. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/rest.py +0 -0
  138. {auto_coder-0.1.224 → auto_coder-0.1.225}/src/autocoder/utils/tests.py +0 -0
  139. {auto_coder-0.1.224 → auto_coder-0.1.225}/tests/test_action_regex_project.py +0 -0
  140. {auto_coder-0.1.224 → auto_coder-0.1.225}/tests/test_chat_auto_coder.py +0 -0
  141. {auto_coder-0.1.224 → auto_coder-0.1.225}/tests/test_code_auto_merge_editblock.py +0 -0
  142. {auto_coder-0.1.224 → auto_coder-0.1.225}/tests/test_command_completer.py +0 -0
  143. {auto_coder-0.1.224 → auto_coder-0.1.225}/tests/test_planner.py +0 -0
  144. {auto_coder-0.1.224 → auto_coder-0.1.225}/tests/test_queue_communicate.py +0 -0
  145. {auto_coder-0.1.224 → auto_coder-0.1.225}/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.224
3
+ Version: 0.1.225
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.224
3
+ Version: 0.1.225
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -84,6 +84,7 @@ src/autocoder/index/__init__.py
84
84
  src/autocoder/index/for_command.py
85
85
  src/autocoder/index/index.py
86
86
  src/autocoder/index/symbols_utils.py
87
+ src/autocoder/index/types.py
87
88
  src/autocoder/pyproject/__init__.py
88
89
  src/autocoder/rag/__init__.py
89
90
  src/autocoder/rag/api_server.py
@@ -262,8 +262,10 @@ class AutoCoderArgs(pydantic.BaseModel):
262
262
  index_model_max_length: Optional[int] = 0
263
263
  index_model_max_input_length: Optional[int] = 0
264
264
  index_model_anti_quota_limit: Optional[int] = 0
265
+
265
266
 
266
267
  index_filter_level: Optional[int] = 0
268
+ index_filter_enable_relevance_verification: Optional[bool] = True
267
269
  index_filter_workers: Optional[int] = 1
268
270
  index_filter_file_num: Optional[int] = -1
269
271
  index_build_workers: Optional[int] = 1
@@ -349,7 +351,7 @@ class AutoCoderArgs(pydantic.BaseModel):
349
351
  generate_times_same_model: Optional[int] = 1
350
352
 
351
353
  action: List[str] = []
352
- enable_global_memory: Optional[bool] = True
354
+ enable_global_memory: Optional[bool] = True
353
355
 
354
356
  class Config:
355
357
  protected_namespaces = ()
@@ -30,7 +30,7 @@ def init_command_template(source_dir:str):
30
30
  project_type: py
31
31
 
32
32
  ## The model you want to drive AutoCoder to run
33
- model: gpt3_5_chat
33
+ model: deepseek_chat
34
34
 
35
35
 
36
36
  ## Enable the index building which can help you find the related files by your query
@@ -38,7 +38,7 @@ def init_command_template(source_dir:str):
38
38
  skip_build_index: false
39
39
  ## The model to build index for the project (Optional)
40
40
  ## 用于为项目构建索引的模型(可选)
41
- index_model: haiku_chat
41
+ index_model: deepseek_chat
42
42
 
43
43
  ## the filter level to find the related files
44
44
  ## 0: only find the files with the file name
@@ -192,8 +192,8 @@ def base_enable_index()->str:
192
192
  skip_build_index: false
193
193
  anti_quota_limit: 0
194
194
  index_filter_level: 1
195
- index_filter_workers: 4
196
- index_build_workers: 4
195
+ index_filter_workers: 100
196
+ index_build_workers: 100
197
197
  '''
198
198
 
199
199
  @byzerllm.prompt()
@@ -1,4 +1,5 @@
1
- from autocoder.index.index import IndexManager, TargetFile
1
+ from autocoder.index.index import IndexManager
2
+ from autocoder.index.types import TargetFile
2
3
  from autocoder.suffixproject import SuffixProject
3
4
  from autocoder.tsproject import TSProject
4
5
  from autocoder.pyproject import PyProject
@@ -29,29 +29,12 @@ from autocoder.utils.queue_communicate import (
29
29
  CommunicateEvent,
30
30
  CommunicateEventType,
31
31
  )
32
-
33
-
34
- class IndexItem(pydantic.BaseModel):
35
- module_name: str
36
- symbols: str
37
- last_modified: float
38
- md5: str # 新增文件内容的MD5哈希值字段
39
-
40
-
41
- class TargetFile(pydantic.BaseModel):
42
- file_path: str
43
- reason: str = pydantic.Field(
44
- ..., description="The reason why the file is the target file"
45
- )
46
-
47
-
48
- class VerifyFileRelevance(pydantic.BaseModel):
49
- relevant_score: int
50
- reason: str
51
-
52
-
53
- class FileList(pydantic.BaseModel):
54
- file_list: List[TargetFile]
32
+ from autocoder.index.types import (
33
+ IndexItem,
34
+ TargetFile,
35
+ VerifyFileRelevance,
36
+ FileList,
37
+ )
55
38
 
56
39
 
57
40
  class IndexManager:
@@ -97,7 +80,7 @@ class IndexManager:
97
80
  ```json
98
81
  {
99
82
  "relevant_score": 0-10,
100
- "reason": "这是相关的原因..."
83
+ "reason": "这是相关的原因(不超过10个中文字符)..."
101
84
  }
102
85
  ```
103
86
  """
@@ -119,12 +102,12 @@ class IndexManager:
119
102
  {
120
103
  "file_list": [
121
104
  {
122
- "file_path": "path/to/file.py",
123
- "reason": "The reason why the file is the target file"
105
+ "file_path": "path/to/file1.py",
106
+ "reason": "这是被选择的原因(不超过10个中文字符)"
124
107
  },
125
108
  {
126
- "file_path": "path/to/file.py",
127
- "reason": "The reason why the file is the target file"
109
+ "file_path": "path/to/file2.py",
110
+ "reason": "这是被选择的原因(不超过10个中文字符)"
128
111
  }
129
112
  ]
130
113
  }
@@ -211,17 +194,19 @@ class IndexManager:
211
194
  if current_chunk:
212
195
  chunks.append("\n".join(current_chunk))
213
196
  return chunks
197
+
198
+ def should_skip(self, file_path: str):
199
+ ext = os.path.splitext(file_path)[1].lower()
200
+ if ext in [".md", ".html", ".txt", ".doc", ".pdf"]:
201
+ return True
202
+ return False
214
203
 
215
204
  def build_index_for_single_source(self, source: SourceCode):
216
205
  file_path = source.module_name
217
206
  if not os.path.exists(file_path):
218
207
  return None
219
208
 
220
- ext = os.path.splitext(file_path)[1].lower()
221
- if ext in [".md", ".html", ".txt", ".doc", ".pdf"]:
222
- return None
223
-
224
- if source.source_code.strip() == "":
209
+ if self.should_skip(file_path):
225
210
  return None
226
211
 
227
212
  md5 = hashlib.md5(source.source_code.encode("utf-8")).hexdigest()
@@ -290,6 +275,13 @@ class IndexManager:
290
275
 
291
276
  wait_to_build_files = []
292
277
  for source in self.sources:
278
+ file_path = source.module_name
279
+ if not os.path.exists(file_path):
280
+ continue
281
+
282
+ if self.should_skip(file_path):
283
+ continue
284
+
293
285
  source_code = source.source_code
294
286
  if self.args.auto_merge == "strict_diff":
295
287
  v = source.source_code.splitlines()
@@ -297,7 +289,7 @@ class IndexManager:
297
289
  for line in v:
298
290
  new_v.append(line[line.find(":"):])
299
291
  source_code = "\n".join(new_v)
300
-
292
+
301
293
  md5 = hashlib.md5(source_code.encode("utf-8")).hexdigest()
302
294
  if (
303
295
  source.module_name not in index_data
@@ -453,6 +445,7 @@ class IndexManager:
453
445
  nonlocal completed_threads
454
446
  result = self._get_target_files_by_query.with_llm(
455
447
  self.llm).with_return_type(FileList).run(chunk, query)
448
+ print(result)
456
449
  if result is not None:
457
450
  with lock:
458
451
  all_results.extend(result.file_list)
@@ -477,18 +470,23 @@ class IndexManager:
477
470
  return all_results, total_threads, completed_threads
478
471
 
479
472
  def get_target_files_by_query(self, query: str) -> FileList:
473
+ '''
474
+ 根据用户查询过滤文件。
475
+ 1. 必选,根据文件名和路径,以及文件用途说明,过滤出相关文件。
476
+ 2. index_filter_level>=1,根据文件名和路径,文件说明以及符号列表过滤出相关文件。
477
+ '''
480
478
  all_results: List[TargetFile] = []
479
+ if self.args.index_filter_level == 0:
480
+ def w():
481
+ return self._get_meta_str(
482
+ skip_symbols=False,
483
+ max_chunk_size=-1,
484
+ includes=[SymbolType.USAGE],
485
+ )
481
486
 
482
- def w():
483
- return self._get_meta_str(
484
- skip_symbols=False,
485
- max_chunk_size=-1,
486
- includes=[SymbolType.USAGE],
487
- )
488
-
489
- temp_result, total_threads, completed_threads = self._query_index_with_thread(
490
- query, w)
491
- all_results.extend(temp_result)
487
+ temp_result, total_threads, completed_threads = self._query_index_with_thread(
488
+ query, w)
489
+ all_results.extend(temp_result)
492
490
 
493
491
  if self.args.index_filter_level >= 1:
494
492
 
@@ -524,12 +522,12 @@ class IndexManager:
524
522
  {
525
523
  "file_list": [
526
524
  {
527
- "file_path": "path/to/file.py",
528
- "reason": "The reason why the file is the target file"
525
+ "file_path": "path/to/file1.py",
526
+ "reason": "这是被选择的原因(不超过10个中文字符)"
529
527
  },
530
528
  {
531
- "file_path": "path/to/file.py",
532
- "reason": "The reason why the file is the target file"
529
+ "file_path": "path/to/file2.py",
530
+ "reason": "这是被选择的原因(不超过10个中文字符)"
533
531
  }
534
532
  ]
535
533
  }
@@ -699,76 +697,77 @@ def build_index_and_filter_files(
699
697
 
700
698
  # Phase 5: Relevance verification
701
699
  logger.info("Phase 5: Performing relevance verification...")
702
- phase_start = time.monotonic()
703
- verified_files = {}
704
- temp_files = list(final_files.values())
705
- verification_results = []
706
-
707
- def print_verification_results(results):
708
- from rich.table import Table
709
- from rich.console import Console
710
-
711
- console = Console()
712
- table = Table(title="File Relevance Verification Results", show_header=True, header_style="bold magenta")
713
- table.add_column("File Path", style="cyan", no_wrap=True)
714
- table.add_column("Score", justify="right", style="green")
715
- table.add_column("Status", style="yellow")
716
- table.add_column("Reason/Error")
717
-
718
- for file_path, score, status, reason in results:
719
- table.add_row(
720
- file_path,
721
- str(score) if score is not None else "N/A",
722
- status,
723
- reason
724
- )
700
+ if args.index_filter_enable_relevance_verification:
701
+ phase_start = time.monotonic()
702
+ verified_files = {}
703
+ temp_files = list(final_files.values())
704
+ verification_results = []
725
705
 
726
- console.print(table)
727
-
728
- def verify_single_file(file: TargetFile):
729
- for source in sources:
730
- if source.module_name == file.file_path:
731
- file_content = source.source_code
732
- try:
733
- result = index_manager.verify_file_relevance.with_llm(llm).with_return_type(VerifyFileRelevance).run(
734
- file_content=file_content,
735
- query=args.query
736
- )
737
- if result.relevant_score >= args.verify_file_relevance_score:
706
+ def print_verification_results(results):
707
+ from rich.table import Table
708
+ from rich.console import Console
709
+
710
+ console = Console()
711
+ table = Table(title="File Relevance Verification Results", show_header=True, header_style="bold magenta")
712
+ table.add_column("File Path", style="cyan", no_wrap=True)
713
+ table.add_column("Score", justify="right", style="green")
714
+ table.add_column("Status", style="yellow")
715
+ table.add_column("Reason/Error")
716
+
717
+ for file_path, score, status, reason in results:
718
+ table.add_row(
719
+ file_path,
720
+ str(score) if score is not None else "N/A",
721
+ status,
722
+ reason
723
+ )
724
+
725
+ console.print(table)
726
+
727
+ def verify_single_file(file: TargetFile):
728
+ for source in sources:
729
+ if source.module_name == file.file_path:
730
+ file_content = source.source_code
731
+ try:
732
+ result = index_manager.verify_file_relevance.with_llm(llm).with_return_type(VerifyFileRelevance).run(
733
+ file_content=file_content,
734
+ query=args.query
735
+ )
736
+ if result.relevant_score >= args.verify_file_relevance_score:
737
+ verified_files[file.file_path] = TargetFile(
738
+ file_path=file.file_path,
739
+ reason=f"Score:{result.relevant_score}, {result.reason}"
740
+ )
741
+ return file.file_path, result.relevant_score, "PASS", result.reason
742
+ else:
743
+ return file.file_path, result.relevant_score, "FAIL", result.reason
744
+ except Exception as e:
745
+ error_msg = str(e)
738
746
  verified_files[file.file_path] = TargetFile(
739
747
  file_path=file.file_path,
740
- reason=f"Score:{result.relevant_score}, {result.reason}"
748
+ reason=f"Verification failed: {error_msg}"
741
749
  )
742
- return file.file_path, result.relevant_score, "PASS", result.reason
743
- else:
744
- return file.file_path, result.relevant_score, "FAIL", result.reason
745
- except Exception as e:
746
- error_msg = str(e)
747
- verified_files[file.file_path] = TargetFile(
748
- file_path=file.file_path,
749
- reason=f"Verification failed: {error_msg}"
750
- )
751
- return file.file_path, None, "ERROR", error_msg
752
- return None
753
-
754
- with ThreadPoolExecutor(max_workers=args.index_filter_workers) as executor:
755
- futures = [executor.submit(verify_single_file, file)
756
- for file in temp_files]
757
- for future in as_completed(futures):
758
- result = future.result()
759
- if result:
760
- verification_results.append(result)
761
- time.sleep(args.anti_quota_limit)
762
-
763
- # Print verification results in a table
764
- print_verification_results(verification_results)
765
-
766
- stats["verified_files"] = len(verified_files)
767
- phase_end = time.monotonic()
768
- stats["timings"]["relevance_verification"] = phase_end - phase_start
750
+ return file.file_path, None, "ERROR", error_msg
751
+ return None
752
+
753
+ with ThreadPoolExecutor(max_workers=args.index_filter_workers) as executor:
754
+ futures = [executor.submit(verify_single_file, file)
755
+ for file in temp_files]
756
+ for future in as_completed(futures):
757
+ result = future.result()
758
+ if result:
759
+ verification_results.append(result)
760
+ time.sleep(args.anti_quota_limit)
761
+
762
+ # Print verification results in a table
763
+ print_verification_results(verification_results)
764
+
765
+ stats["verified_files"] = len(verified_files)
766
+ phase_end = time.monotonic()
767
+ stats["timings"]["relevance_verification"] = phase_end - phase_start
769
768
 
770
- # Keep all files, not just verified ones
771
- final_files = verified_files
769
+ # Keep all files, not just verified ones
770
+ final_files = verified_files
772
771
 
773
772
  def display_table_and_get_selections(data):
774
773
  from prompt_toolkit.shortcuts import checkboxlist_dialog
@@ -0,0 +1,24 @@
1
+ import pydantic
2
+ from typing import List
3
+
4
+ class IndexItem(pydantic.BaseModel):
5
+ module_name: str
6
+ symbols: str
7
+ last_modified: float
8
+ md5: str # 新增文件内容的MD5哈希值字段
9
+
10
+
11
+ class TargetFile(pydantic.BaseModel):
12
+ file_path: str
13
+ reason: str = pydantic.Field(
14
+ ..., description="The reason why the file is the target file"
15
+ )
16
+
17
+
18
+ class VerifyFileRelevance(pydantic.BaseModel):
19
+ relevant_score: int
20
+ reason: str
21
+
22
+
23
+ class FileList(pydantic.BaseModel):
24
+ file_list: List[TargetFile]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.225"
@@ -1 +0,0 @@
1
- __version__ = "0.1.224"
File without changes
File without changes
File without changes
File without changes