auto-coder 0.1.274__tar.gz → 0.1.275__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 (185) hide show
  1. {auto_coder-0.1.274 → auto_coder-0.1.275}/PKG-INFO +1 -1
  2. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/auto_coder.egg-info/PKG-INFO +1 -1
  3. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/auto_coder_rag.py +30 -5
  4. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/auto_coder_runner.py +1 -1
  5. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/commands/auto_command.py +3 -1
  6. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/__init__.py +1 -0
  7. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_merge.py +1 -2
  8. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_merge_diff.py +1 -1
  9. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_merge_editblock.py +2 -1
  10. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_merge_strict_diff.py +3 -1
  11. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/command_generator.py +3 -1
  12. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/git_utils.py +7 -3
  13. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/shells.py +23 -1
  14. auto_coder-0.1.275/src/autocoder/rag/cache/base_cache.py +29 -0
  15. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/cache/byzer_storage_cache.py +74 -47
  16. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/utils.py +1 -1
  17. auto_coder-0.1.275/src/autocoder/version.py +1 -0
  18. auto_coder-0.1.274/src/autocoder/rag/cache/base_cache.py +0 -14
  19. auto_coder-0.1.274/src/autocoder/version.py +0 -1
  20. {auto_coder-0.1.274 → auto_coder-0.1.275}/LICENSE +0 -0
  21. {auto_coder-0.1.274 → auto_coder-0.1.275}/README.md +0 -0
  22. {auto_coder-0.1.274 → auto_coder-0.1.275}/setup.cfg +0 -0
  23. {auto_coder-0.1.274 → auto_coder-0.1.275}/setup.py +0 -0
  24. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/auto_coder.egg-info/SOURCES.txt +0 -0
  25. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/auto_coder.egg-info/dependency_links.txt +0 -0
  26. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/auto_coder.egg-info/entry_points.txt +0 -0
  27. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/auto_coder.egg-info/requires.txt +0 -0
  28. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/auto_coder.egg-info/top_level.txt +0 -0
  29. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/__init__.py +0 -0
  30. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/__init__.py +0 -0
  31. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/auto_demand_organizer.py +0 -0
  32. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/auto_filegroup.py +0 -0
  33. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/auto_guess_query.py +0 -0
  34. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/auto_learn_from_commit.py +0 -0
  35. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/auto_review_commit.py +0 -0
  36. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/auto_tool.py +0 -0
  37. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/coder.py +0 -0
  38. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/designer.py +0 -0
  39. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/planner.py +0 -0
  40. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/agent/project_reader.py +0 -0
  41. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/auto_coder.py +0 -0
  42. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/auto_coder_rag_client_mcp.py +0 -0
  43. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/auto_coder_rag_mcp.py +0 -0
  44. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/auto_coder_server.py +0 -0
  45. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/benchmark.py +0 -0
  46. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/chat/__init__.py +0 -0
  47. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/chat_auto_coder.py +0 -0
  48. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/chat_auto_coder_lang.py +0 -0
  49. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/command_args.py +0 -0
  50. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/commands/__init__.py +0 -0
  51. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/commands/tools.py +0 -0
  52. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/JupyterClient.py +0 -0
  53. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/ShellClient.py +0 -0
  54. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/anything2images.py +0 -0
  55. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/anything2img.py +0 -0
  56. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/audio.py +0 -0
  57. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/auto_coder_lang.py +0 -0
  58. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/auto_configure.py +0 -0
  59. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/buildin_tokenizer.py +0 -0
  60. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/chunk_validation.py +0 -0
  61. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/cleaner.py +0 -0
  62. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_execute.py +0 -0
  63. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_generate.py +0 -0
  64. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_generate_diff.py +0 -0
  65. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
  66. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
  67. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/code_modification_ranker.py +0 -0
  68. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/command_completer.py +0 -0
  69. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/command_templates.py +0 -0
  70. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/conf_import_export.py +0 -0
  71. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/conf_validator.py +0 -0
  72. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/const.py +0 -0
  73. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/context_pruner.py +0 -0
  74. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/conversation_pruner.py +0 -0
  75. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/files.py +0 -0
  76. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/global_cancel.py +0 -0
  77. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/image_to_page.py +0 -0
  78. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/index_import_export.py +0 -0
  79. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/interpreter.py +0 -0
  80. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/llm_rerank.py +0 -0
  81. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/mcp_hub.py +0 -0
  82. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/mcp_server.py +0 -0
  83. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/mcp_servers/__init__.py +0 -0
  84. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/mcp_servers/mcp_server_perplexity.py +0 -0
  85. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/mcp_tools.py +0 -0
  86. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/memory_manager.py +0 -0
  87. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/model_speed_test.py +0 -0
  88. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/printer.py +0 -0
  89. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/recall_validation.py +0 -0
  90. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/result_manager.py +0 -0
  91. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/screenshots.py +0 -0
  92. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/search.py +0 -0
  93. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/search_replace.py +0 -0
  94. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/stats_panel.py +0 -0
  95. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/sys_prompt.py +0 -0
  96. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/text.py +0 -0
  97. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/types.py +0 -0
  98. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/common/utils_code_auto_generate.py +0 -0
  99. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/data/byzerllm.md +0 -0
  100. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/data/tokenizer.json +0 -0
  101. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/db/__init__.py +0 -0
  102. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/db/store.py +0 -0
  103. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/dispacher/__init__.py +0 -0
  104. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/dispacher/actions/__init__.py +0 -0
  105. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/dispacher/actions/action.py +0 -0
  106. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/dispacher/actions/copilot.py +0 -0
  107. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
  108. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +0 -0
  109. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
  110. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/__init__.py +0 -0
  111. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/entry.py +0 -0
  112. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/filter/__init__.py +0 -0
  113. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/filter/normal_filter.py +0 -0
  114. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/filter/quick_filter.py +0 -0
  115. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/for_command.py +0 -0
  116. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/index.py +0 -0
  117. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/symbols_utils.py +0 -0
  118. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/index/types.py +0 -0
  119. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/lang.py +0 -0
  120. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/models.py +0 -0
  121. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/privacy/__init__.py +0 -0
  122. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/privacy/model_filter.py +0 -0
  123. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/pyproject/__init__.py +0 -0
  124. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/__init__.py +0 -0
  125. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/api_server.py +0 -0
  126. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/cache/__init__.py +0 -0
  127. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
  128. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/cache/simple_cache.py +0 -0
  129. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/doc_filter.py +0 -0
  130. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/document_retriever.py +0 -0
  131. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/llm_wrapper.py +0 -0
  132. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/loaders/__init__.py +0 -0
  133. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/loaders/docx_loader.py +0 -0
  134. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/loaders/excel_loader.py +0 -0
  135. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
  136. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
  137. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/long_context_rag.py +0 -0
  138. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/rag_config.py +0 -0
  139. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/rag_entry.py +0 -0
  140. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/raw_rag.py +0 -0
  141. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/relevant_utils.py +0 -0
  142. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/simple_directory_reader.py +0 -0
  143. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/simple_rag.py +0 -0
  144. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/stream_event/__init__.py +0 -0
  145. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/stream_event/event_writer.py +0 -0
  146. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/stream_event/types.py +0 -0
  147. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/token_checker.py +0 -0
  148. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/token_counter.py +0 -0
  149. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/token_limiter.py +0 -0
  150. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/token_limiter_utils.py +0 -0
  151. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/types.py +0 -0
  152. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/rag/variable_holder.py +0 -0
  153. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/regexproject/__init__.py +0 -0
  154. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/suffixproject/__init__.py +0 -0
  155. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/tsproject/__init__.py +0 -0
  156. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/__init__.py +0 -0
  157. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/_markitdown.py +0 -0
  158. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/auto_coder_utils/__init__.py +0 -0
  159. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/auto_coder_utils/chat_stream_out.py +0 -0
  160. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/auto_project_type.py +0 -0
  161. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/chat_auto_coder_utils/__init__.py +0 -0
  162. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/conversation_store.py +0 -0
  163. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/llm_client_interceptors.py +0 -0
  164. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/llms.py +0 -0
  165. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/log_capture.py +0 -0
  166. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/model_provider_selector.py +0 -0
  167. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/multi_turn.py +0 -0
  168. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/operate_config_api.py +0 -0
  169. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/print_table.py +0 -0
  170. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/project_structure.py +0 -0
  171. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/queue_communicate.py +0 -0
  172. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/request_event_queue.py +0 -0
  173. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/request_queue.py +0 -0
  174. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/rest.py +0 -0
  175. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/tests.py +0 -0
  176. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/thread_utils.py +0 -0
  177. {auto_coder-0.1.274 → auto_coder-0.1.275}/src/autocoder/utils/types.py +0 -0
  178. {auto_coder-0.1.274 → auto_coder-0.1.275}/tests/test_action_regex_project.py +0 -0
  179. {auto_coder-0.1.274 → auto_coder-0.1.275}/tests/test_chat_auto_coder.py +0 -0
  180. {auto_coder-0.1.274 → auto_coder-0.1.275}/tests/test_code_auto_merge_editblock.py +0 -0
  181. {auto_coder-0.1.274 → auto_coder-0.1.275}/tests/test_command_completer.py +0 -0
  182. {auto_coder-0.1.274 → auto_coder-0.1.275}/tests/test_planner.py +0 -0
  183. {auto_coder-0.1.274 → auto_coder-0.1.275}/tests/test_privacy.py +0 -0
  184. {auto_coder-0.1.274 → auto_coder-0.1.275}/tests/test_queue_communicate.py +0 -0
  185. {auto_coder-0.1.274 → auto_coder-0.1.275}/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.274
3
+ Version: 0.1.275
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.274
3
+ Version: 0.1.275
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -17,6 +17,7 @@ import shlex
17
17
  from rich.console import Console
18
18
  from rich.table import Table
19
19
  import os
20
+ import hashlib
20
21
  from loguru import logger
21
22
  import asyncio
22
23
  from datetime import datetime
@@ -32,6 +33,21 @@ if platform.system() == "Windows":
32
33
  init()
33
34
 
34
35
 
36
+ def generate_unique_name_from_path(path: str) -> str:
37
+ """
38
+ Generate a unique name (MD5 hash) from a path after normalizing it.
39
+ For Linux/Unix systems, trailing path separators are removed.
40
+ """
41
+ if not path:
42
+ return ""
43
+
44
+ # Normalize the path (resolve absolute path and remove trailing separators)
45
+ normalized_path = os.path.normpath(os.path.abspath(path))
46
+
47
+ # Generate MD5 hash from the normalized path
48
+ return hashlib.md5(normalized_path.encode("utf-8")).hexdigest()
49
+
50
+
35
51
  def initialize_system(args):
36
52
  if args.product_mode == "lite":
37
53
  return
@@ -491,6 +507,10 @@ def main(input_args: Optional[List[str]] = None):
491
507
  }
492
508
  )
493
509
 
510
+ # Generate unique name for RAG build if doc_dir exists
511
+ if server_args.doc_dir:
512
+ auto_coder_args.rag_build_name = generate_unique_name_from_path(server_args.doc_dir)
513
+ logger.info(f"Generated RAG build name: {auto_coder_args.rag_build_name}")
494
514
 
495
515
  if auto_coder_args.enable_hybrid_index and args.product_mode == "lite":
496
516
  raise Exception("Hybrid index is not supported in lite mode")
@@ -500,7 +520,7 @@ def main(input_args: Optional[List[str]] = None):
500
520
  try:
501
521
  from byzerllm.apps.byzer_storage.simple_api import ByzerStorage
502
522
 
503
- storage = ByzerStorage("byzerai_store", "rag", "files")
523
+ storage = ByzerStorage("byzerai_store", "rag", auto_coder_args.rag_build_name)
504
524
  storage.retrieval.cluster_info("byzerai_store")
505
525
  except Exception as e:
506
526
  logger.error(
@@ -611,6 +631,7 @@ def main(input_args: Optional[List[str]] = None):
611
631
 
612
632
  if server_args.doc_dir:
613
633
  auto_coder_args.rag_type = "simple"
634
+ auto_coder_args.rag_build_name = generate_unique_name_from_path(server_args.doc_dir)
614
635
  rag = RAGFactory.get_rag(
615
636
  llm=llm,
616
637
  args=auto_coder_args,
@@ -618,6 +639,7 @@ def main(input_args: Optional[List[str]] = None):
618
639
  tokenizer_path=server_args.tokenizer_path,
619
640
  )
620
641
  else:
642
+ auto_coder_args.rag_build_name = generate_unique_name_from_path("")
621
643
  rag = RAGFactory.get_rag(llm=llm, args=auto_coder_args, path="")
622
644
 
623
645
  llm_wrapper = LLWrapper(llm=llm, rag=rag)
@@ -636,10 +658,7 @@ def main(input_args: Optional[List[str]] = None):
636
658
  logger.warning(f"Failed to save service info: {str(e)}")
637
659
 
638
660
  serve(llm=llm_wrapper, args=server_args)
639
- elif args.command == "build_hybrid_index":
640
- if not args.quick:
641
- initialize_system()
642
-
661
+ elif args.command == "build_hybrid_index":
643
662
  auto_coder_args = AutoCoderArgs(
644
663
  **{
645
664
  arg: getattr(args, arg)
@@ -648,6 +667,11 @@ def main(input_args: Optional[List[str]] = None):
648
667
  }
649
668
  )
650
669
 
670
+ # Generate unique name for RAG build if doc_dir exists
671
+ if args.doc_dir:
672
+ auto_coder_args.rag_build_name = generate_unique_name_from_path(args.doc_dir)
673
+ logger.info(f"Generated RAG build name: {auto_coder_args.rag_build_name}")
674
+
651
675
  auto_coder_args.enable_hybrid_index = True
652
676
  auto_coder_args.rag_type = "simple"
653
677
 
@@ -675,6 +699,7 @@ def main(input_args: Optional[List[str]] = None):
675
699
  return
676
700
  llm.setup_default_emb_model_name("emb")
677
701
 
702
+ auto_coder_args.rag_build_name = generate_unique_name_from_path(args.doc_dir)
678
703
  rag = RAGFactory.get_rag(
679
704
  llm=llm,
680
705
  args=auto_coder_args,
@@ -1384,7 +1384,7 @@ def commit(query: str):
1384
1384
  md5 = hashlib.md5(file_content.encode("utf-8")).hexdigest()
1385
1385
  file_name = os.path.basename(execute_file)
1386
1386
  commit_result = git_utils.commit_changes(
1387
- ".", f"auto_coder_{file_name}_{md5}\n{commit_message}"
1387
+ ".", f"{commit_message}\nauto_coder_{file_name}_{md5}"
1388
1388
  )
1389
1389
  git_utils.print_commit_info(commit_result=commit_result)
1390
1390
  if commit_message:
@@ -175,6 +175,7 @@ class CommandAutoTuner:
175
175
  Python版本: {{ env_info.python_version }}
176
176
  终端类型: {{ env_info.shell_type }}
177
177
  终端编码: {{ env_info.shell_encoding }}
178
+ 当前用户: {{ current_user }}
178
179
 
179
180
  {%- if shell_type %}
180
181
  脚本类型:{{ shell_type }}
@@ -284,7 +285,8 @@ class CommandAutoTuner:
284
285
  "shell_type": shell_type,
285
286
  "shell_encoding": shells.get_terminal_encoding(),
286
287
  "conversation_safe_zone_tokens": self.args.conversation_prune_safe_zone_tokens,
287
- "os_distribution": shells.get_os_distribution()
288
+ "os_distribution": shells.get_os_distribution(),
289
+ "current_user": shells.get_current_username()
288
290
  }
289
291
 
290
292
  @byzerllm.prompt()
@@ -320,6 +320,7 @@ class AutoCoderArgs(pydantic.BaseModel):
320
320
 
321
321
  monitor_mode: bool = False
322
322
  enable_hybrid_index: bool = False
323
+ rag_build_name: Optional[str] = None
323
324
  disable_auto_window: bool = False
324
325
  filter_batch_size: Optional[int] = 5
325
326
  disable_segment_reorder: bool = False
@@ -1,4 +1,3 @@
1
-
2
1
  import os
3
2
  from byzerllm.utils.client import code_utils
4
3
  from autocoder.common import AutoCoderArgs, git_utils
@@ -197,5 +196,5 @@ class CodeAutoMerge:
197
196
 
198
197
  self.printer.print_in_terminal("files_merged", total=total)
199
198
  if not force_skip_git and not self.args.skip_commit:
200
- commit_result = git_utils.commit_changes(self.args.source_dir, f"auto_coder_{file_name}_{md5}\n{self.args.query}")
199
+ commit_result = git_utils.commit_changes(self.args.source_dir, f"{self.args.query}\nauto_coder_{file_name}_{md5}")
201
200
  git_utils.print_commit_info(commit_result=commit_result)
@@ -579,7 +579,7 @@ class CodeAutoMergeDiff:
579
579
 
580
580
  self.printer.print_in_terminal("files_merged_total", total=total)
581
581
  if not force_skip_git and not self.args.skip_commit:
582
- commit_result = git_utils.commit_changes(self.args.source_dir, f"auto_coder_{file_name}_{md5}\n{self.args.query}")
582
+ commit_result = git_utils.commit_changes(self.args.source_dir, f"{self.args.query}\nauto_coder_{file_name}_{md5}")
583
583
  git_utils.print_commit_info(commit_result=commit_result)
584
584
  else:
585
585
  # Print edits for review
@@ -425,7 +425,8 @@ class CodeAutoMergeEditBlock:
425
425
  if not force_skip_git and not self.args.skip_commit:
426
426
  try:
427
427
  commit_result = git_utils.commit_changes(
428
- self.args.source_dir, f"auto_coder_{file_name}_{md5}\n{self.args.query}"
428
+ self.args.source_dir,
429
+ f"{self.args.query}\nauto_coder_{file_name}_{md5}",
429
430
  )
430
431
  git_utils.print_commit_info(commit_result=commit_result)
431
432
  except Exception as e:
@@ -285,7 +285,9 @@ class CodeAutoMergeStrictDiff:
285
285
 
286
286
  self.printer.print_in_terminal("files_merged_total", total=total)
287
287
  if not force_skip_git and not self.args.skip_commit:
288
- commit_result = git_utils.commit_changes(self.args.source_dir, f"auto_coder_{file_name}_{md5}\n{self.args.query}")
288
+ commit_result = git_utils.commit_changes(
289
+ self.args.source_dir, f"{self.args.query}\nauto_coder_{file_name}_{md5}"
290
+ )
289
291
  git_utils.print_commit_info(commit_result=commit_result)
290
292
  else:
291
293
  # Print diff blocks for review
@@ -16,6 +16,7 @@ def _generate_shell_script(user_input: str) -> str:
16
16
  Python版本: {{ env_info.python_version }}
17
17
  终端类型: {{ env_info.shell_type }}
18
18
  终端编码: {{ env_info.shell_encoding }}
19
+ 当前用户: {{ current_user }}
19
20
 
20
21
  {%- if shell_type %}
21
22
  脚本类型:{{ shell_type }}
@@ -51,7 +52,8 @@ def _generate_shell_script(user_input: str) -> str:
51
52
  "env_info": env_info,
52
53
  "shell_type": shell_type,
53
54
  "shell_encoding": shells.get_terminal_encoding(),
54
- "os_distribution": shells.get_os_distribution()
55
+ "os_distribution": shells.get_os_distribution(),
56
+ "current_user": shells.get_current_username()
55
57
  }
56
58
 
57
59
 
@@ -118,7 +118,8 @@ def revert_changes(repo_path: str, message: str) -> bool:
118
118
  return False
119
119
 
120
120
  # 通过message定位到commit_hash
121
- commit = repo.git.log("--all", f"--grep={message}", "--format=%H", "-n", "1")
121
+ # --grep 默认只搜索第一行 -F 参数将搜索模式视为固定字符串而非正则表达式
122
+ commit = repo.git.log("--all", f"--grep={message}", "-F", "--format=%H", "-n", "1")
122
123
  if not commit:
123
124
  logger.warning(f"No commit found with message: {message}")
124
125
  return False
@@ -170,7 +171,8 @@ def revert_change(repo_path: str, message: str) -> bool:
170
171
  repo = get_repo(repo_path)
171
172
  if repo is None:
172
173
  return False
173
- commit = repo.git.log("--all", f"--grep={message}", "--format=%H", "-n", "1")
174
+ # --grep 默认只搜索第一行 -F 参数将搜索模式视为固定字符串而非正则表达式
175
+ commit = repo.git.log("--all", f"--grep={message}", "-F", "--format=%H", "-n", "1")
174
176
  if commit:
175
177
  repo.git.revert(commit, no_edit=True)
176
178
  logger.info(f"Reverted changes with commit message: {message}")
@@ -618,7 +620,9 @@ def generate_commit_message(changes_report: str) -> str:
618
620
  def get_commit_by_message(repo_path: str, message: str):
619
621
  repo = get_repo(repo_path)
620
622
  try:
621
- commit_hash = repo.git.log("--all", f"--grep={message}", "--format=%H", "-n", "1")
623
+ commit_hash = repo.git.log(
624
+ "--all", f"--grep={message}", "-F", "--format=%H", "-n", "1"
625
+ )
622
626
  if not commit_hash:
623
627
  return None
624
628
  return repo.commit(commit_hash.strip())
@@ -10,6 +10,7 @@ from rich.console import Console
10
10
  from rich.panel import Panel
11
11
  from rich.text import Text
12
12
  from rich.live import Live
13
+ import getpass
13
14
 
14
15
  from autocoder.common.result_manager import ResultManager
15
16
 
@@ -547,4 +548,25 @@ set PYTHONIOENCODING=utf-8
547
548
  try:
548
549
  os.unlink(temp_file.name)
549
550
  except Exception:
550
- pass
551
+ pass
552
+
553
+ def get_current_username():
554
+ """
555
+ Get the current username across different operating systems.
556
+
557
+ Returns:
558
+ str: The current username.
559
+ """
560
+ try:
561
+ # getpass.getuser() works on Windows, macOS, and Linux
562
+ username = getpass.getuser()
563
+ return username
564
+ except Exception:
565
+ # Fallback methods if getpass.getuser() fails
566
+ try:
567
+ if platform.system() == 'Windows':
568
+ return os.environ.get('USERNAME', '')
569
+ else: # macOS/Linux
570
+ return os.environ.get('USER', '')
571
+ except Exception:
572
+ return ''
@@ -0,0 +1,29 @@
1
+ from pydantic import BaseModel
2
+ from typing import List, Tuple,Dict,Optional,Any
3
+ from abc import ABC, abstractmethod
4
+
5
+ # New model class for file information
6
+ class FileInfo(BaseModel):
7
+ file_path: str
8
+ relative_path: str
9
+ modify_time: float
10
+ file_md5: str
11
+
12
+ # New model class for cache items
13
+ class CacheItem(BaseModel):
14
+ file_path: str
15
+ relative_path: str
16
+ content: List[Dict[str, Any]] # Serialized SourceCode objects
17
+ modify_time: float
18
+ md5: str
19
+
20
+ class DeleteEvent(BaseModel):
21
+ file_paths: List[str]
22
+
23
+ class AddOrUpdateEvent(BaseModel):
24
+ file_infos: List[FileInfo]
25
+
26
+ class BaseCacheManager(ABC):
27
+ @abstractmethod
28
+ def get_cache(self,options:Optional[Dict[str,Any]]=None) -> Dict[str, Dict]:
29
+ pass
@@ -2,6 +2,8 @@ from autocoder.rag.cache.base_cache import (
2
2
  BaseCacheManager,
3
3
  DeleteEvent,
4
4
  AddOrUpdateEvent,
5
+ FileInfo,
6
+ CacheItem
5
7
  )
6
8
  from typing import Generator, List, Dict, Any, Optional, Tuple
7
9
  from autocoder.common import SourceCode
@@ -25,12 +27,15 @@ from autocoder.rag.variable_holder import VariableHolder
25
27
  import platform
26
28
  import hashlib
27
29
  from typing import Union
30
+ from pydantic import BaseModel
28
31
 
29
32
  if platform.system() != "Windows":
30
33
  import fcntl
31
34
  else:
32
35
  fcntl = None
33
36
 
37
+
38
+
34
39
  def generate_file_md5(file_path: str) -> str:
35
40
  md5_hash = hashlib.md5()
36
41
  with open(file_path, "rb") as f:
@@ -62,7 +67,8 @@ class ByzerStorageCache(BaseCacheManager):
62
67
  self.path = path
63
68
  self.ignore_spec = ignore_spec
64
69
  self.required_exts = required_exts
65
- self.storage = ByzerStorage("byzerai_store", "rag", "files")
70
+ self.rag_build_name = extra_params.rag_build_name
71
+ self.storage = ByzerStorage("byzerai_store", "rag", self.rag_build_name)
66
72
  self.queue = []
67
73
  self.chunk_size = 1000
68
74
  self._init_schema()
@@ -71,11 +77,12 @@ class ByzerStorageCache(BaseCacheManager):
71
77
  raise ValueError("extra_params is required for ByzerStorageCache")
72
78
 
73
79
  self.max_output_tokens = extra_params.hybrid_index_max_output_tokens
80
+
74
81
 
75
82
  # 设置缓存文件路径
76
83
  self.cache_dir = os.path.join(self.path, ".cache")
77
84
  self.cache_file = os.path.join(self.cache_dir, "byzer_storage_speedup.jsonl")
78
- self.cache = {}
85
+ self.cache: Dict[str, CacheItem] = {}
79
86
 
80
87
  self.lock = threading.Lock()
81
88
  self.stop_event = threading.Event()
@@ -122,18 +129,20 @@ class ByzerStorageCache(BaseCacheManager):
122
129
  .execute()
123
130
  )
124
131
 
125
- def _load_cache(self) -> dict:
132
+ def _load_cache(self) -> Dict[str, CacheItem]:
126
133
  """Load cache from file"""
127
134
  if os.path.exists(self.cache_file):
128
135
  try:
129
- with open(self.cache_file, "r",encoding="utf-8") as f:
136
+ with open(self.cache_file, "r", encoding="utf-8") as f:
130
137
  lines = f.readlines()
131
138
  cache = {}
132
139
  for line in lines:
133
140
  try:
134
141
  data = json.loads(line.strip())
135
142
  if isinstance(data, dict) and "file_path" in data:
136
- cache[data["file_path"]] = data
143
+ # 转换为 CacheItem 对象
144
+ cache_item = CacheItem.model_validate(data)
145
+ cache[data["file_path"]] = cache_item
137
146
  except json.JSONDecodeError:
138
147
  continue
139
148
  return cache
@@ -147,38 +156,42 @@ class ByzerStorageCache(BaseCacheManager):
147
156
 
148
157
  if not fcntl:
149
158
  try:
150
- with open(cache_file, "w",encoding="utf-8") as f:
151
- for data in self.cache.values():
152
- json.dump(data, f, ensure_ascii=False)
159
+ with open(cache_file, "w", encoding="utf-8") as f:
160
+ for cache_item in self.cache.values():
161
+ # 确保序列化 Pydantic 模型
162
+ json.dump(cache_item.model_dump(), f, ensure_ascii=False)
153
163
  f.write("\n")
154
164
  except IOError as e:
155
165
  logger.error(f"Error writing cache file: {str(e)}")
156
166
  else:
157
167
  lock_file = cache_file + ".lock"
158
- with open(lock_file, "w",encoding="utf-8") as lockf:
168
+ with open(lock_file, "w", encoding="utf-8") as lockf:
159
169
  try:
160
170
  # 获取文件锁
161
171
  fcntl.flock(lockf, fcntl.LOCK_EX | fcntl.LOCK_NB)
162
172
  # 写入缓存文件
163
- with open(cache_file, "w",encoding="utf-8") as f:
164
- for data in self.cache.values():
165
- json.dump(data, f, ensure_ascii=False)
173
+ with open(cache_file, "w", encoding="utf-8") as f:
174
+ for cache_item in self.cache.values():
175
+ # 确保序列化 Pydantic 模型
176
+ json.dump(cache_item.model_dump(), f, ensure_ascii=False)
166
177
  f.write("\n")
167
178
 
168
179
  finally:
169
180
  # 释放文件锁
170
181
  fcntl.flock(lockf, fcntl.LOCK_UN)
171
182
 
183
+ def fileinfo_to_tuple(self, file_info: FileInfo) -> Tuple[str, str, float, str]:
184
+ return (file_info.file_path, file_info.relative_path, file_info.modify_time, file_info.file_md5)
185
+
172
186
  def build_cache(self):
173
187
  """Build the cache by reading files and storing in Byzer Storage"""
174
188
  logger.info(f"Building cache for path: {self.path}")
175
189
 
176
190
  files_to_process = []
177
- for file_info in self.get_all_files():
178
- file_path, _, modify_time, file_md5 = file_info
191
+ for file_info in self.get_all_files():
179
192
  if (
180
- file_path not in self.cache
181
- or self.cache[file_path]["md5"] != file_md5
193
+ file_info.file_path not in self.cache
194
+ or self.cache[file_info.file_path].md5 != file_info.file_md5
182
195
  ):
183
196
  files_to_process.append(file_info)
184
197
 
@@ -192,19 +205,21 @@ class ByzerStorageCache(BaseCacheManager):
192
205
  initializer=initialize_tokenizer,
193
206
  initargs=(VariableHolder.TOKENIZER_PATH,),
194
207
  ) as pool:
195
- results = pool.map(process_file_in_multi_process, files_to_process)
208
+ target_files_to_process = []
209
+ for file_info in files_to_process:
210
+ target_files_to_process.append(self.fileinfo_to_tuple(file_info))
211
+ results = pool.map(process_file_in_multi_process, target_files_to_process)
196
212
 
197
213
  items = []
198
214
  for file_info, result in zip(files_to_process, results):
199
- file_path, relative_path, modify_time, file_md5 = file_info
200
215
  content: List[SourceCode] = result
201
- self.cache[file_path] = {
202
- "file_path": file_path,
203
- "relative_path": relative_path,
204
- "content": [c.model_dump() for c in content],
205
- "modify_time": modify_time,
206
- "md5": file_md5,
207
- }
216
+ self.cache[file_info.file_path] = CacheItem(
217
+ file_path=file_info.file_path,
218
+ relative_path=file_info.relative_path,
219
+ content=[c.model_dump() for c in content],
220
+ modify_time=file_info.modify_time,
221
+ md5=file_info.file_md5,
222
+ )
208
223
 
209
224
  for doc in content:
210
225
  logger.info(f"Processing file: {doc.module_name}")
@@ -213,11 +228,11 @@ class ByzerStorageCache(BaseCacheManager):
213
228
  for chunk_idx, chunk in enumerate(chunks):
214
229
  chunk_item = {
215
230
  "_id": f"{doc.module_name}_{chunk_idx}",
216
- "file_path": file_path,
231
+ "file_path": file_info.file_path,
217
232
  "content": chunk,
218
233
  "raw_content": chunk,
219
234
  "vector": chunk,
220
- "mtime": modify_time,
235
+ "mtime": file_info.modify_time,
221
236
  }
222
237
  items.append(chunk_item)
223
238
 
@@ -260,9 +275,9 @@ class ByzerStorageCache(BaseCacheManager):
260
275
 
261
276
  self.storage.commit()
262
277
 
263
- def update_storage(self, file_path, is_delete: bool):
278
+ def update_storage(self, file_info: FileInfo, is_delete: bool):
264
279
  query = self.storage.query_builder()
265
- query.and_filter().add_condition("file_path", file_path).build()
280
+ query.and_filter().add_condition("file_path", file_info.file_path).build()
266
281
  results = query.execute()
267
282
  if results:
268
283
  for result in results:
@@ -272,9 +287,9 @@ class ByzerStorageCache(BaseCacheManager):
272
287
  if not is_delete:
273
288
  content = [
274
289
  SourceCode.model_validate(doc)
275
- for doc in self.cache[file_path]["content"]
290
+ for doc in self.cache[file_info.file_path].content
276
291
  ]
277
- modify_time = self.cache[file_path]["modify_time"]
292
+ modify_time = self.cache[file_info.file_path].modify_time
278
293
  for doc in content:
279
294
  logger.info(f"Processing file: {doc.module_name}")
280
295
  doc.module_name
@@ -282,7 +297,7 @@ class ByzerStorageCache(BaseCacheManager):
282
297
  for chunk_idx, chunk in enumerate(chunks):
283
298
  chunk_item = {
284
299
  "_id": f"{doc.module_name}_{chunk_idx}",
285
- "file_path": file_path,
300
+ "file_path": file_info.file_path,
286
301
  "content": chunk,
287
302
  "raw_content": chunk,
288
303
  "vector": chunk,
@@ -302,26 +317,34 @@ class ByzerStorageCache(BaseCacheManager):
302
317
  for item in file_list.file_paths:
303
318
  logger.info(f"{item} is detected to be removed")
304
319
  del self.cache[item]
305
- self.update_storage(item, is_delete=True)
320
+ # 创建一个临时的 FileInfo 对象
321
+ file_info = FileInfo(file_path=item, relative_path="", modify_time=0, file_md5="")
322
+ self.update_storage(file_info, is_delete=True)
306
323
 
307
324
  elif isinstance(file_list, AddOrUpdateEvent):
308
325
  for file_info in file_list.file_infos:
309
- logger.info(f"{file_info[0]} is detected to be updated")
310
- result = process_file_local(file_info[0])
311
- self.cache[file_info[0]] = result
312
- self.update_storage(file_info[0], is_delete=False)
326
+ logger.info(f"{file_info.file_path} is detected to be updated")
327
+ # 处理文件并创建 CacheItem
328
+ content = process_file_local(self.fileinfo_to_tuple(file_info))
329
+ self.cache[file_info.file_path] = CacheItem(
330
+ file_path=file_info.file_path,
331
+ relative_path=file_info.relative_path,
332
+ content=[c.model_dump() for c in content],
333
+ modify_time=file_info.modify_time,
334
+ md5=file_info.file_md5,
335
+ )
336
+ self.update_storage(file_info, is_delete=False)
313
337
  self.write_cache()
314
338
 
315
339
  def trigger_update(self):
316
340
  logger.info("检查文件是否有更新.....")
317
341
  files_to_process = []
318
342
  current_files = set()
319
- for file_info in self.get_all_files():
320
- file_path, _, _, file_md5 = file_info
321
- current_files.add(file_path)
343
+ for file_info in self.get_all_files():
344
+ current_files.add(file_info.file_path)
322
345
  if (
323
- file_path not in self.cache
324
- or self.cache[file_path]["md5"] != file_md5
346
+ file_info.file_path not in self.cache
347
+ or self.cache[file_info.file_path].md5 != file_info.file_md5
325
348
  ):
326
349
  files_to_process.append(file_info)
327
350
 
@@ -341,7 +364,7 @@ class ByzerStorageCache(BaseCacheManager):
341
364
  self.trigger_update()
342
365
 
343
366
  if options is None or "query" not in options:
344
- return self.cache
367
+ return {file_path: self.cache[file_path].model_dump() for file_path in self.cache}
345
368
 
346
369
  query = options.get("query", "")
347
370
  total_tokens = 0
@@ -361,6 +384,7 @@ class ByzerStorageCache(BaseCacheManager):
361
384
  results = query_builder.execute()
362
385
 
363
386
  # Group results by file_path and reconstruct documents while preserving order
387
+ # 这里还可以有排序优化,综合考虑一篇内容出现的次数以及排序位置
364
388
  file_paths = []
365
389
  seen = set()
366
390
  for result in results:
@@ -374,17 +398,17 @@ class ByzerStorageCache(BaseCacheManager):
374
398
  for file_path in file_paths:
375
399
  if file_path in self.cache:
376
400
  cached_data = self.cache[file_path]
377
- for doc in cached_data["content"]:
401
+ for doc in cached_data.content:
378
402
  if total_tokens + doc["tokens"] > self.max_output_tokens:
379
403
  return result
380
404
  total_tokens += doc["tokens"]
381
- result[file_path] = cached_data
405
+ result[file_path] = cached_data.model_dump()
382
406
 
383
407
  return result
384
408
 
385
409
 
386
410
 
387
- def get_all_files(self) -> List[Tuple[str, str, float, str]]:
411
+ def get_all_files(self) -> List[FileInfo]:
388
412
  all_files = []
389
413
  for root, dirs, files in os.walk(self.path,followlinks=True):
390
414
  dirs[:] = [d for d in dirs if not d.startswith(".") and d not in default_ignore_dirs]
@@ -412,6 +436,9 @@ class ByzerStorageCache(BaseCacheManager):
412
436
  relative_path = os.path.relpath(file_path, self.path)
413
437
  modify_time = os.path.getmtime(file_path)
414
438
  file_md5 = generate_file_md5(file_path)
415
- all_files.append((file_path, relative_path, modify_time, file_md5))
439
+ all_files.append(FileInfo(file_path=file_path,
440
+ relative_path=relative_path,
441
+ modify_time=modify_time,
442
+ file_md5=file_md5))
416
443
 
417
444
  return all_files
@@ -11,7 +11,7 @@ import traceback
11
11
 
12
12
 
13
13
  def process_file_in_multi_process(
14
- file_info: Tuple[str, str, float]
14
+ file_info: Tuple[str, str, float, str]
15
15
  ) -> List[SourceCode]:
16
16
  start_time = time.time()
17
17
  file_path, relative_path, _, _ = file_info
@@ -0,0 +1 @@
1
+ __version__ = "0.1.275"
@@ -1,14 +0,0 @@
1
- from pydantic import BaseModel
2
- from typing import List, Tuple,Dict,Optional,Any
3
- from abc import ABC, abstractmethod
4
-
5
- class DeleteEvent(BaseModel):
6
- file_paths: List[str]
7
-
8
- class AddOrUpdateEvent(BaseModel):
9
- file_infos: List[Tuple[str, str, float, str]]
10
-
11
- class BaseCacheManager(ABC):
12
- @abstractmethod
13
- def get_cache(self,options:Optional[Dict[str,Any]]=None) -> Dict[str, Dict]:
14
- pass
@@ -1 +0,0 @@
1
- __version__ = "0.1.274"
File without changes
File without changes
File without changes
File without changes