auto-coder 0.1.244__tar.gz → 0.1.245__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 (159) hide show
  1. {auto_coder-0.1.244 → auto_coder-0.1.245}/PKG-INFO +2 -2
  2. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/auto_coder.egg-info/PKG-INFO +2 -2
  3. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/auto_coder.egg-info/SOURCES.txt +1 -0
  4. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/auto_coder.egg-info/requires.txt +1 -1
  5. auto_coder-0.1.245/src/autocoder/agent/auto_review_commit.py +207 -0
  6. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/auto_coder.py +17 -6
  7. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/chat_auto_coder.py +25 -15
  8. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/chat_auto_coder_lang.py +4 -2
  9. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/auto_coder_lang.py +11 -1
  10. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/entry.py +6 -6
  11. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/filter/normal_filter.py +2 -1
  12. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/filter/quick_filter.py +1 -1
  13. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/models.py +2 -2
  14. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/auto_coder_utils/chat_stream_out.py +2 -0
  15. auto_coder-0.1.245/src/autocoder/version.py +1 -0
  16. auto_coder-0.1.244/src/autocoder/version.py +0 -1
  17. {auto_coder-0.1.244 → auto_coder-0.1.245}/LICENSE +0 -0
  18. {auto_coder-0.1.244 → auto_coder-0.1.245}/README.md +0 -0
  19. {auto_coder-0.1.244 → auto_coder-0.1.245}/setup.cfg +0 -0
  20. {auto_coder-0.1.244 → auto_coder-0.1.245}/setup.py +0 -0
  21. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/auto_coder.egg-info/dependency_links.txt +0 -0
  22. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/auto_coder.egg-info/entry_points.txt +0 -0
  23. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/auto_coder.egg-info/top_level.txt +0 -0
  24. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/__init__.py +0 -0
  25. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/__init__.py +0 -0
  26. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/auto_demand_organizer.py +0 -0
  27. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/auto_filegroup.py +0 -0
  28. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/auto_guess_query.py +0 -0
  29. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/auto_tool.py +0 -0
  30. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/coder.py +0 -0
  31. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/designer.py +0 -0
  32. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/planner.py +0 -0
  33. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/agent/project_reader.py +0 -0
  34. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/auto_coder_rag.py +0 -0
  35. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/auto_coder_rag_client_mcp.py +0 -0
  36. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/auto_coder_rag_mcp.py +0 -0
  37. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/auto_coder_server.py +0 -0
  38. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/benchmark.py +0 -0
  39. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/chat/__init__.py +0 -0
  40. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/command_args.py +0 -0
  41. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/JupyterClient.py +0 -0
  42. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/ShellClient.py +0 -0
  43. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/__init__.py +0 -0
  44. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/anything2images.py +0 -0
  45. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/anything2img.py +0 -0
  46. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/audio.py +0 -0
  47. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/buildin_tokenizer.py +0 -0
  48. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/chunk_validation.py +0 -0
  49. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/cleaner.py +0 -0
  50. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_execute.py +0 -0
  51. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_generate.py +0 -0
  52. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_generate_diff.py +0 -0
  53. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_generate_editblock.py +0 -0
  54. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_generate_strict_diff.py +0 -0
  55. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_merge.py +0 -0
  56. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_merge_diff.py +0 -0
  57. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_merge_editblock.py +0 -0
  58. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_auto_merge_strict_diff.py +0 -0
  59. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/code_modification_ranker.py +0 -0
  60. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/command_completer.py +0 -0
  61. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/command_generator.py +0 -0
  62. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/command_templates.py +0 -0
  63. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/const.py +0 -0
  64. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/files.py +0 -0
  65. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/git_utils.py +0 -0
  66. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/image_to_page.py +0 -0
  67. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/interpreter.py +0 -0
  68. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/llm_rerank.py +0 -0
  69. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/mcp_hub.py +0 -0
  70. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/mcp_server.py +0 -0
  71. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/mcp_servers/__init__.py +0 -0
  72. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/mcp_servers/mcp_server_perplexity.py +0 -0
  73. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/mcp_tools.py +0 -0
  74. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/memory_manager.py +0 -0
  75. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/printer.py +0 -0
  76. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/recall_validation.py +0 -0
  77. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/screenshots.py +0 -0
  78. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/search.py +0 -0
  79. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/search_replace.py +0 -0
  80. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/sys_prompt.py +0 -0
  81. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/text.py +0 -0
  82. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/types.py +0 -0
  83. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/common/utils_code_auto_generate.py +0 -0
  84. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/data/tokenizer.json +0 -0
  85. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/db/__init__.py +0 -0
  86. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/db/store.py +0 -0
  87. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/dispacher/__init__.py +0 -0
  88. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/dispacher/actions/__init__.py +0 -0
  89. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/dispacher/actions/action.py +0 -0
  90. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/dispacher/actions/copilot.py +0 -0
  91. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
  92. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +0 -0
  93. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
  94. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/__init__.py +0 -0
  95. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/filter/__init__.py +0 -0
  96. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/for_command.py +0 -0
  97. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/index.py +0 -0
  98. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/symbols_utils.py +0 -0
  99. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/index/types.py +0 -0
  100. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/lang.py +0 -0
  101. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/pyproject/__init__.py +0 -0
  102. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/__init__.py +0 -0
  103. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/api_server.py +0 -0
  104. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/cache/__init__.py +0 -0
  105. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/cache/base_cache.py +0 -0
  106. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/cache/byzer_storage_cache.py +0 -0
  107. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
  108. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/cache/simple_cache.py +0 -0
  109. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/doc_filter.py +0 -0
  110. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/document_retriever.py +0 -0
  111. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/llm_wrapper.py +0 -0
  112. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/loaders/__init__.py +0 -0
  113. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/loaders/docx_loader.py +0 -0
  114. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/loaders/excel_loader.py +0 -0
  115. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
  116. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
  117. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/long_context_rag.py +0 -0
  118. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/rag_config.py +0 -0
  119. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/rag_entry.py +0 -0
  120. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/raw_rag.py +0 -0
  121. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/relevant_utils.py +0 -0
  122. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/simple_directory_reader.py +0 -0
  123. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/simple_rag.py +0 -0
  124. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/stream_event/__init__.py +0 -0
  125. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/stream_event/event_writer.py +0 -0
  126. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/stream_event/types.py +0 -0
  127. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/token_checker.py +0 -0
  128. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/token_counter.py +0 -0
  129. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/token_limiter.py +0 -0
  130. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/types.py +0 -0
  131. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/utils.py +0 -0
  132. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/rag/variable_holder.py +0 -0
  133. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/regexproject/__init__.py +0 -0
  134. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/suffixproject/__init__.py +0 -0
  135. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/tsproject/__init__.py +0 -0
  136. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/__init__.py +0 -0
  137. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/_markitdown.py +0 -0
  138. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/auto_coder_utils/__init__.py +0 -0
  139. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/chat_auto_coder_utils/__init__.py +0 -0
  140. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/conversation_store.py +0 -0
  141. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/llm_client_interceptors.py +0 -0
  142. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/llms.py +0 -0
  143. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/log_capture.py +0 -0
  144. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/multi_turn.py +0 -0
  145. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/operate_config_api.py +0 -0
  146. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/print_table.py +0 -0
  147. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/queue_communicate.py +0 -0
  148. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/request_event_queue.py +0 -0
  149. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/request_queue.py +0 -0
  150. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/rest.py +0 -0
  151. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/tests.py +0 -0
  152. {auto_coder-0.1.244 → auto_coder-0.1.245}/src/autocoder/utils/types.py +0 -0
  153. {auto_coder-0.1.244 → auto_coder-0.1.245}/tests/test_action_regex_project.py +0 -0
  154. {auto_coder-0.1.244 → auto_coder-0.1.245}/tests/test_chat_auto_coder.py +0 -0
  155. {auto_coder-0.1.244 → auto_coder-0.1.245}/tests/test_code_auto_merge_editblock.py +0 -0
  156. {auto_coder-0.1.244 → auto_coder-0.1.245}/tests/test_command_completer.py +0 -0
  157. {auto_coder-0.1.244 → auto_coder-0.1.245}/tests/test_planner.py +0 -0
  158. {auto_coder-0.1.244 → auto_coder-0.1.245}/tests/test_queue_communicate.py +0 -0
  159. {auto_coder-0.1.244 → auto_coder-0.1.245}/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.244
3
+ Version: 0.1.245
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -26,7 +26,7 @@ Requires-Dist: tabulate
26
26
  Requires-Dist: jupyter_client
27
27
  Requires-Dist: prompt-toolkit
28
28
  Requires-Dist: tokenizers
29
- Requires-Dist: byzerllm[saas]>=0.1.160
29
+ Requires-Dist: byzerllm[saas]>=0.1.161
30
30
  Requires-Dist: patch
31
31
  Requires-Dist: diff_match_patch
32
32
  Requires-Dist: GitPython
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.244
3
+ Version: 0.1.245
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -26,7 +26,7 @@ Requires-Dist: tabulate
26
26
  Requires-Dist: jupyter_client
27
27
  Requires-Dist: prompt-toolkit
28
28
  Requires-Dist: tokenizers
29
- Requires-Dist: byzerllm[saas]>=0.1.160
29
+ Requires-Dist: byzerllm[saas]>=0.1.161
30
30
  Requires-Dist: patch
31
31
  Requires-Dist: diff_match_patch
32
32
  Requires-Dist: GitPython
@@ -24,6 +24,7 @@ src/autocoder/agent/__init__.py
24
24
  src/autocoder/agent/auto_demand_organizer.py
25
25
  src/autocoder/agent/auto_filegroup.py
26
26
  src/autocoder/agent/auto_guess_query.py
27
+ src/autocoder/agent/auto_review_commit.py
27
28
  src/autocoder/agent/auto_tool.py
28
29
  src/autocoder/agent/coder.py
29
30
  src/autocoder/agent/designer.py
@@ -16,7 +16,7 @@ tabulate
16
16
  jupyter_client
17
17
  prompt-toolkit
18
18
  tokenizers
19
- byzerllm[saas]>=0.1.160
19
+ byzerllm[saas]>=0.1.161
20
20
  patch
21
21
  diff_match_patch
22
22
  GitPython
@@ -0,0 +1,207 @@
1
+ from typing import Generator, List, Dict, Union, Tuple, Optional
2
+ import os
3
+ import yaml
4
+ import byzerllm
5
+ import pydantic
6
+ import git
7
+ from rich.console import Console
8
+ from autocoder.utils.auto_coder_utils.chat_stream_out import stream_out
9
+ from autocoder.common.printer import Printer
10
+ from autocoder.common import AutoCoderArgs
11
+ from autocoder.common.utils_code_auto_generate import stream_chat_with_continue
12
+
13
+
14
+ def load_yaml_config(yaml_file: str) -> Dict:
15
+ """加载YAML配置文件"""
16
+ try:
17
+ with open(yaml_file, 'r', encoding='utf-8') as f:
18
+ return yaml.safe_load(f)
19
+ except Exception as e:
20
+ printer = Printer()
21
+ printer.print_in_terminal("yaml_load_error", style="red", yaml_file=yaml_file, error=str(e))
22
+ return {}
23
+
24
+
25
+ class AutoReviewCommit:
26
+ def __init__(self, llm: Union[byzerllm.ByzerLLM,byzerllm.SimpleByzerLLM],
27
+ args:AutoCoderArgs,
28
+ skip_diff: bool = False,
29
+ console: Optional[Console] = None):
30
+ """
31
+ 初始化 AutoReviewCommit
32
+
33
+ Args:
34
+ llm: ByzerLLM 实例,用于代码审查
35
+ project_dir: 项目根目录
36
+ skip_diff: 是否跳过获取 diff 信息
37
+ """
38
+ self.project_dir = args.source_dir
39
+ self.actions_dir = os.path.join(args.source_dir, "actions")
40
+ self.llm = llm
41
+ self.skip_diff = skip_diff
42
+ self.console = console or Console()
43
+
44
+ @byzerllm.prompt()
45
+ def review(self, querie_with_urls_and_diffs: List[Tuple[str, List[str], str]], query: str) -> Generator[str,None,None]:
46
+ """
47
+ 如果前面我们对话提供了文档,请参考上面的文档对提交的代码变更进行审查,提供改进建议。
48
+
49
+ 下面包含最新一次提交的信息:
50
+ <commit>
51
+ {% for query,urls,diff in querie_with_urls_and_diffs %}
52
+ ## 任务需求
53
+ {{ query }}
54
+
55
+ 修改的文件:
56
+ {% for url in urls %}
57
+ - {{ url }}
58
+ {% endfor %}
59
+
60
+ 代码变更:
61
+ ```diff
62
+ {{ diff }}
63
+ ```
64
+ {% endfor %}
65
+ </commit>
66
+
67
+ 审查要求:
68
+ 1. 代码质量评估
69
+ - 代码可读性:命名、注释、代码结构是否清晰
70
+ - 代码风格:是否符合项目规范
71
+ - 实现逻辑:算法和数据结构的选择是否合适
72
+
73
+ 2. 潜在问题检查
74
+ - 常见错误:是否存在空指针,数组越界,类型转换,未声明变量,typo等低级错误
75
+ - 安全性:是否存在安全隐患
76
+ - 性能:是否有性能问题
77
+ - 并发:是否有并发安全问题
78
+ - 异常处理:错误处理是否完善
79
+ - 资源管理:是否有资源泄露风险
80
+
81
+ 3. 架构合理性
82
+ - 模块化:职责划分是否合理
83
+ - 可扩展性:是否方便未来扩展
84
+ - 依赖关系:组件耦合是否合理
85
+ - 复用性:是否有重复代码
86
+
87
+ 返回格式说明:
88
+ 返回 markdown 格式,包含以下内容:
89
+ 1. issues: 发现的具体问题列表
90
+ 2. suggestions: 对应的改进建议列表
91
+ 3. severity: 问题的严重程度(low/medium/high)
92
+ 4. affected_files: 受影响的文件列表
93
+ 5. summary: 总体评价
94
+
95
+ {% if query %}
96
+ 用户额外 review 需求:
97
+ <user_review_requirement>
98
+ {{ query }}
99
+ </user_review_requirement>
100
+ {% endif %}
101
+
102
+ 注意:
103
+ 1. 评审意见应该具体且可操作,而不是泛泛而谈
104
+ 2. 对于每个问题都应该提供明确的改进建议
105
+ 3. 严重程度的判断要考虑问题对系统的潜在影响
106
+ 4. 建议应该符合项目的技术栈和开发规范
107
+ """
108
+ pass
109
+
110
+
111
+ def parse_history_tasks(self) -> List[Dict]:
112
+ """
113
+ 解析历史任务信息
114
+
115
+ Returns:
116
+ List[Dict]: 每个字典包含一个历史任务的信息
117
+ """
118
+ # 获取所有YAML文件
119
+ action_files = [
120
+ f for f in os.listdir(self.actions_dir)
121
+ if f[:3].isdigit() and "_" in f and f.endswith('.yml')
122
+ ]
123
+
124
+ # 按序号排序
125
+ def get_seq(name):
126
+ return int(name.split("_")[0])
127
+
128
+ # 获取最新的action文件列表
129
+ action_files = sorted(action_files, key=get_seq)
130
+ action_files.reverse()
131
+
132
+ action_file = action_files[0]
133
+
134
+ querie_with_urls_and_diffs = []
135
+ repo = git.Repo(self.project_dir)
136
+
137
+ # 收集所有query、urls和对应的commit diff
138
+ for yaml_file in [action_file]:
139
+ yaml_path = os.path.join(self.actions_dir, yaml_file)
140
+ config = load_yaml_config(yaml_path)
141
+
142
+ if not config:
143
+ continue
144
+
145
+ query = config.get('query', '')
146
+ urls = config.get('urls', [])
147
+
148
+ if query and urls:
149
+ commit_diff = ""
150
+ if not self.skip_diff:
151
+ # 计算文件的MD5用于匹配commit
152
+ import hashlib
153
+ file_md5 = hashlib.md5(open(yaml_path, 'rb').read()).hexdigest()
154
+ response_id = f"auto_coder_{yaml_file}_{file_md5}"
155
+ # 查找对应的commit
156
+ try:
157
+ for commit in repo.iter_commits():
158
+ if response_id in commit.message:
159
+ if commit.parents:
160
+ parent = commit.parents[0]
161
+ commit_diff = repo.git.diff(
162
+ parent.hexsha, commit.hexsha)
163
+ else:
164
+ commit_diff = repo.git.show(commit.hexsha)
165
+ break
166
+ except git.exc.GitCommandError as e:
167
+ printer = Printer()
168
+ printer.print_in_terminal("git_command_error", style="red", error=str(e))
169
+ except Exception as e:
170
+ printer = Printer()
171
+ printer.print_in_terminal("get_commit_diff_error", style="red", error=str(e))
172
+
173
+ querie_with_urls_and_diffs.append((query, urls, commit_diff))
174
+
175
+ return querie_with_urls_and_diffs
176
+
177
+
178
+ def review_commit(self,query: str, conversations: List[Dict]) -> Generator[str,None,None]:
179
+ """
180
+ 审查最新的代码提交
181
+
182
+ Returns:
183
+ Optional[ReviewResult]: 审查结果,如果出错则返回None
184
+ """
185
+ printer = Printer()
186
+ # 获取最新的提交信息
187
+ commits = self.parse_history_tasks()
188
+ if not commits:
189
+ printer.print_in_terminal("no_latest_commit", style="red")
190
+ return None
191
+
192
+ # 调用LLM进行代码审查
193
+ try:
194
+ # 获取 prompt 内容
195
+ query = self.review.prompt(commits, query)
196
+ new_conversations = conversations.copy()[0:-1]
197
+ new_conversations.append({"role": "user", "content": query})
198
+ # 构造对话消息
199
+ v = stream_chat_with_continue(
200
+ llm=self.llm,
201
+ conversations=new_conversations,
202
+ llm_config={}
203
+ )
204
+ return v
205
+ except Exception as e:
206
+ printer.print_in_terminal("code_review_error", style="red", error=str(e))
207
+ return None
@@ -278,8 +278,13 @@ def main(input_args: Optional[List[str]] = None):
278
278
 
279
279
  llm = byzerllm.ByzerLLM(verbose=args.print_request)
280
280
 
281
+ # code_model,index_filter_model,generate_rerank_model,chat_model
282
+ # 这四个模型如果用户没有设置,就会使用默认的
283
+ # 如果用户随便填写 deepseek 官方key,就会导致 Authentic(No User) 的错误
284
+ # 或者 Insuffient Balance 之类的错误
285
+
281
286
  code_model = byzerllm.ByzerLLM()
282
- code_model.setup_default_model_name("deepseek_chat")
287
+ code_model.setup_default_model_name(args.model)
283
288
  llm.setup_sub_client("code_model", code_model)
284
289
 
285
290
  index_filter_model = byzerllm.ByzerLLM()
@@ -295,7 +300,8 @@ def main(input_args: Optional[List[str]] = None):
295
300
  llm.setup_sub_client("chat_model", chat_model)
296
301
 
297
302
  if args.product_mode == "lite":
298
- llm = byzerllm.SimpleByzerLLM(default_model_name="deepseek_chat")
303
+ default_model = args.model
304
+ llm = byzerllm.SimpleByzerLLM(default_model_name=default_model)
299
305
  api_key_dir = os.path.expanduser("~/.auto-coder/keys")
300
306
  api_key_file = os.path.join(api_key_dir, "api.deepseek.com")
301
307
 
@@ -308,7 +314,7 @@ def main(input_args: Optional[List[str]] = None):
308
314
  llm.deploy(
309
315
  model_path="",
310
316
  pretrained_model_type="saas/openai",
311
- udf_name="deepseek_chat",
317
+ udf_name=default_model,
312
318
  infer_params={
313
319
  "saas.base_url": "https://api.deepseek.com/v1",
314
320
  "saas.api_key": api_key,
@@ -317,11 +323,11 @@ def main(input_args: Optional[List[str]] = None):
317
323
  }
318
324
  )
319
325
 
320
- code_llm = byzerllm.SimpleByzerLLM(default_model_name="deepseek_chat")
326
+ code_llm = byzerllm.SimpleByzerLLM(default_model)
321
327
  code_llm.deploy(
322
328
  model_path="",
323
329
  pretrained_model_type="saas/openai",
324
- udf_name="deepseek_chat",
330
+ udf_name=default_model,
325
331
  infer_params={
326
332
  "saas.base_url": "https://api.deepseek.com/v1",
327
333
  "saas.api_key": api_key,
@@ -368,7 +374,8 @@ def main(input_args: Optional[List[str]] = None):
368
374
  "saas.is_reasoning": True
369
375
  }
370
376
  )
371
-
377
+
378
+ # 这四个模型如果用户没有设置,就会使用默认的
372
379
  llm.setup_sub_client("code_model", code_llm)
373
380
  llm.setup_sub_client("chat_model", chat_llm)
374
381
  llm.setup_sub_client("generate_rerank_model", generate_rerank_llm)
@@ -1349,6 +1356,10 @@ def main(input_args: Optional[List[str]] = None):
1349
1356
  )
1350
1357
  )
1351
1358
  v = [[response.result,None]]
1359
+ elif "review_commit" in args.action:
1360
+ from autocoder.agent.auto_review_commit import AutoReviewCommit
1361
+ reviewer = AutoReviewCommit(llm=chat_llm, args=args)
1362
+ v = reviewer.review_commit(args.query)
1352
1363
  else:
1353
1364
  v = stream_chat_with_continue(
1354
1365
  llm=chat_llm,
@@ -1937,14 +1937,18 @@ def chat(query: str):
1937
1937
  if "/save" in query:
1938
1938
  yaml_config["action"].append("save")
1939
1939
  query = query.replace("/save", "", 1).strip()
1940
-
1941
- is_review = query.strip().startswith("/review")
1942
- if is_review:
1943
- query = query.replace("/review", "", 1).strip()
1944
- if "prompt_review" in conf:
1945
- query = format_str_jinja2(conf["prompt_review"], query=query)
1946
- else:
1947
- query = code_review.prompt(query)
1940
+
1941
+ if "/review" in query and "/commit" in query:
1942
+ yaml_config["action"].append("review_commit")
1943
+ query = query.replace("/review", "", 1).replace("/commit", "", 1).strip()
1944
+ else:
1945
+ is_review = query.strip().startswith("/review")
1946
+ if is_review:
1947
+ query = query.replace("/review", "", 1).strip()
1948
+ if "prompt_review" in conf:
1949
+ query = format_str_jinja2(conf["prompt_review"], query=query)
1950
+ else:
1951
+ query = code_review.prompt(query)
1948
1952
 
1949
1953
  is_no_context = query.strip().startswith("/no_context")
1950
1954
  if is_no_context:
@@ -2194,13 +2198,14 @@ def manage_models(params, query: str):
2194
2198
  table.add_column("Base URL", style="white", width=50, overflow="fold")
2195
2199
  for m in models_data:
2196
2200
  # Check if api_key_path exists and file exists
2197
- api_key_path = m.get("api_key_path", "")
2198
- name = m.get("name", "")
2199
- if api_key_path:
2200
- api_key_file = os.path.expanduser(f"~/.auto-coder/keys/{api_key_path}")
2201
- if os.path.exists(api_key_file):
2202
- name = f"{name}*"
2203
-
2201
+ is_api_key_set = "api_key" in m
2202
+ name = m.get("name", "")
2203
+ if is_api_key_set:
2204
+ api_key = m.get("api_key", "").strip()
2205
+ if not api_key:
2206
+ printer.print_in_terminal("models_api_key_empty", style="yellow", name=name)
2207
+ name = f"{name} *"
2208
+
2204
2209
  table.add_row(
2205
2210
  name,
2206
2211
  m.get("model_name", ""),
@@ -2700,6 +2705,11 @@ def main():
2700
2705
  if "mode" not in memory:
2701
2706
  memory["mode"] = "normal"
2702
2707
 
2708
+ # 处理 user_input 的空格
2709
+ temp_user_input = user_input.lstrip() # 去掉左侧空格
2710
+ if temp_user_input.startswith('/'):
2711
+ user_input = temp_user_input
2712
+
2703
2713
  if (
2704
2714
  memory["mode"] == "auto_detect"
2705
2715
  and user_input
@@ -111,7 +111,8 @@ MESSAGES = {
111
111
  "remove_files_all": "Removed all files.",
112
112
  "remove_files_removed": "Removed Files",
113
113
  "remove_files_none": "No files were removed.",
114
- "files_removed": "Files Removed"
114
+ "files_removed": "Files Removed",
115
+ "models_api_key_empty": "Warning : {{name}} API key is empty. Please set a valid API key.",
115
116
  },
116
117
  "zh": {
117
118
  "mcp_remove_error": "移除 MCP 服务器时出错:{error}",
@@ -222,7 +223,8 @@ MESSAGES = {
222
223
  "remove_files_all": "已移除所有文件。",
223
224
  "remove_files_removed": "已移除的文件",
224
225
  "remove_files_none": "没有文件被移除。",
225
- "files_removed": "移除的文件"
226
+ "files_removed": "移除的文件",
227
+ "models_api_key_empty": "警告: {{name}} API key 为空。请设置一个有效的 API key。",
226
228
  }
227
229
  }
228
230
 
@@ -8,6 +8,11 @@ MESSAGES = {
8
8
  "memory_save_success": "✅ Saved to your memory",
9
9
  "file_decode_error": "Failed to decode file: {{file_path}}. Tried encodings: {{encodings}}",
10
10
  "file_write_error": "Failed to write file: {{file_path}}. Error: {{error}}",
11
+ "yaml_load_error": "Error loading yaml file {{yaml_file}}: {{error}}",
12
+ "git_command_error": "Git command execution error: {{error}}",
13
+ "get_commit_diff_error": "Error getting commit diff: {{error}}",
14
+ "no_latest_commit": "Unable to get latest commit information",
15
+ "code_review_error": "Code review process error: {{error}}",
11
16
  "index_file_too_large": "⚠️ File {{ file_path }} is too large ({{ file_size }} > {{ max_length }}), splitting into chunks...",
12
17
  "index_update_success": "✅ Successfully updated index for {{ file_path }} (md5: {{ md5 }}) in {{ duration }}s",
13
18
  "index_build_error": "❌ Error building index for {{ file_path }}: {{ error }}",
@@ -82,6 +87,11 @@ MESSAGES = {
82
87
  "memory_save_success": "✅ 已保存到您的记忆中",
83
88
  "file_decode_error": "无法解码文件: {{file_path}}。尝试的编码: {{encodings}}",
84
89
  "file_write_error": "无法写入文件: {{file_path}}. 错误: {{error}}",
90
+ "yaml_load_error": "加载YAML文件出错 {{yaml_file}}: {{error}}",
91
+ "git_command_error": "Git命令执行错误: {{error}}",
92
+ "get_commit_diff_error": "获取commit diff时出错: {{error}}",
93
+ "no_latest_commit": "无法获取最新的提交信息",
94
+ "code_review_error": "代码审查过程出错: {{error}}",
85
95
  "index_file_too_large": "⚠️ 文件 {{ file_path }} 过大 ({{ file_size }} > {{ max_length }}), 正在分块处理...",
86
96
  "index_update_success": "✅ 成功更新 {{ file_path }} 的索引 (md5: {{ md5 }}), 耗时 {{ duration }} 秒",
87
97
  "index_build_error": "❌ 构建 {{ file_path }} 索引时出错: {{ error }}",
@@ -132,7 +142,7 @@ MESSAGES = {
132
142
  "merge_success": "✅ 成功合并了 {{ num_files }} 个文件中的更改 {{ num_changes }}/{{ total_blocks }} 个代码块。",
133
143
  "no_changes_made": "⚠️ 未对任何文件进行更改。",
134
144
  "unmerged_blocks_title": "未合并代码块",
135
- "unmerged_file_path": "文件: {file_path}",
145
+ "unmerged_file_path": "文件: {{file_path}}",
136
146
  "unmerged_search_block": "Search Block({{similarity}}):",
137
147
  "unmerged_replace_block": "Replace Block:",
138
148
  "unmerged_blocks_total": "未合并代码块数量: {{num_blocks}}",
@@ -100,13 +100,13 @@ def build_index_and_filter_files(
100
100
  })
101
101
  )
102
102
  )
103
+
104
+ if not args.skip_filter_index and args.index_filter_model:
105
+ printer.print_in_terminal("quick_filter_start", style="blue")
106
+ quick_filter = QuickFilter(index_manager,stats,sources)
107
+ final_files = quick_filter.filter(index_manager.read_index(),args.query)
103
108
 
104
- #MARK
105
- printer.print_in_terminal("quick_filter_start", style="blue")
106
- quick_filter = QuickFilter(index_manager,stats,sources)
107
- final_files = quick_filter.filter(index_manager.read_index(),args.query)
108
-
109
- if not final_files:
109
+ if not args.skip_filter_index and not args.index_filter_model:
110
110
  printer.print_in_terminal("normal_filter_start", style="blue")
111
111
  normal_filter = NormalFilter(index_manager,stats,sources)
112
112
  final_files = normal_filter.filter(index_manager.read_index(),args.query)
@@ -34,6 +34,7 @@ class NormalFilter():
34
34
  self.sources = sources
35
35
 
36
36
  def filter(self, index_items: List[IndexItem], query: str) -> Dict[str, TargetFile]:
37
+
37
38
  final_files: Dict[str, TargetFile] = {}
38
39
  if not self.args.skip_filter_index:
39
40
  if self.args.request_id and not self.args.skip_events:
@@ -125,7 +126,7 @@ class NormalFilter():
125
126
  if source.module_name == file.file_path:
126
127
  file_content = source.source_code
127
128
  try:
128
- result = self.index_manager.verify_file_relevance.with_llm(llm).with_return_type(VerifyFileRelevance).run(
129
+ result = self.index_manager.verify_file_relevance.with_llm(self.index_manager.llm).with_return_type(VerifyFileRelevance).run(
129
130
  file_content=file_content,
130
131
  query=self.args.query
131
132
  )
@@ -69,7 +69,7 @@ class QuickFilter():
69
69
 
70
70
  def filter(self, index_items: List[IndexItem], query: str) -> Dict[str, TargetFile]:
71
71
  final_files: Dict[str, TargetFile] = {}
72
- if not self.args.skip_filter_index and self.index_manager.llm.get_sub_client("index_filter_model"):
72
+ if not self.args.skip_filter_index and self.args.index_filter_model:
73
73
  start_time = time.monotonic()
74
74
  index_items = self.index_manager.read_index()
75
75
 
@@ -2,6 +2,7 @@ import os
2
2
  import json
3
3
  from typing import List, Dict
4
4
  from urllib.parse import urlparse
5
+ from autocoder.common.auto_coder_lang import get_message_with_format
5
6
 
6
7
  MODELS_JSON = os.path.expanduser("~/.auto-coder/keys/models.json")
7
8
 
@@ -108,8 +109,7 @@ def get_model_by_name(name: str) -> Dict:
108
109
  models = load_models()
109
110
  v = [m for m in models if m["name"] == name.strip()]
110
111
 
111
- if len(v) == 0:
112
- from autocoder.common.auto_coder_lang import get_message_with_format
112
+ if len(v) == 0:
113
113
  raise Exception(get_message_with_format("model_not_found", model_name=name))
114
114
  return v[0]
115
115
 
@@ -234,6 +234,8 @@ def stream_out(
234
234
  title="Error",
235
235
  border_style="red"
236
236
  ))
237
+ # import traceback
238
+ # traceback.print_exc()
237
239
 
238
240
  if request_id and request_queue:
239
241
  request_queue.add_request(
@@ -0,0 +1 @@
1
+ __version__ = "0.1.245"
@@ -1 +0,0 @@
1
- __version__ = "0.1.244"
File without changes
File without changes
File without changes
File without changes