auto-coder 0.1.312__py3-none-any.whl → 0.1.313__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of auto-coder might be problematic. Click here for more details.
- {auto_coder-0.1.312.dist-info → auto_coder-0.1.313.dist-info}/METADATA +1 -1
- {auto_coder-0.1.312.dist-info → auto_coder-0.1.313.dist-info}/RECORD +10 -10
- autocoder/commands/tools.py +94 -13
- autocoder/common/action_yml_file_manager.py +2 -2
- autocoder/rag/lang.py +50 -28
- autocoder/version.py +1 -1
- {auto_coder-0.1.312.dist-info → auto_coder-0.1.313.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.312.dist-info → auto_coder-0.1.313.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.312.dist-info → auto_coder-0.1.313.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.312.dist-info → auto_coder-0.1.313.dist-info}/top_level.txt +0 -0
|
@@ -14,7 +14,7 @@ autocoder/command_parser.py,sha256=fx1g9E6GaM273lGTcJqaFQ-hoksS_Ik2glBMnVltPCE,1
|
|
|
14
14
|
autocoder/lang.py,sha256=U6AjVV8Rs1uLyjFCZ8sT6WWuNUxMBqkXXIOs4S120uk,14511
|
|
15
15
|
autocoder/models.py,sha256=AyoZ-Pzy0oyYUmWCxOIRiOImsqboSfRET7LO9-UOuxI,11172
|
|
16
16
|
autocoder/run_context.py,sha256=IUfSO6_gp2Wt1blFWAmOpN0b0nDrTTk4LmtCYUBIoro,1643
|
|
17
|
-
autocoder/version.py,sha256=
|
|
17
|
+
autocoder/version.py,sha256=O3BsbD2rT7pC9_mUbayTS658pf_QJpU1V9cCPbAITT0,23
|
|
18
18
|
autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
autocoder/agent/auto_demand_organizer.py,sha256=URAq0gSEiHeV_W4zwhOI_83kHz0Ryfj1gcfh5jwCv_w,6501
|
|
20
20
|
autocoder/agent/auto_filegroup.py,sha256=pBsAkBcpFTff-9L5OwI8xhf2xPKpl-aZwz-skF2B6dc,6296
|
|
@@ -30,11 +30,11 @@ autocoder/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
30
30
|
autocoder/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
31
|
autocoder/commands/auto_command.py,sha256=fZ4TNU4YA9qdoVHmZX0rb6sV_N-DEcgSLaC5s3PGSHA,64200
|
|
32
32
|
autocoder/commands/auto_web.py,sha256=Cc0eb6JN3SvFy3GD_lpSLvIqj7F1eFDTcwg1t-zDcKg,39024
|
|
33
|
-
autocoder/commands/tools.py,sha256
|
|
33
|
+
autocoder/commands/tools.py,sha256=nLXzcmwwOaMjgTUjad4usq1W0VH79jard1irxsNrRLk,31576
|
|
34
34
|
autocoder/common/JupyterClient.py,sha256=O-wi6pXeAEYhAY24kDa0BINrLYvKS6rKyWe98pDClS0,2816
|
|
35
35
|
autocoder/common/ShellClient.py,sha256=fM1q8t_XMSbLBl2zkCNC2J9xuyKN3eXzGm6hHhqL2WY,2286
|
|
36
36
|
autocoder/common/__init__.py,sha256=sIbE0Gm30MkCmZ9ClQeKx1Hw-vjdcVF65hO5TschS1Y,14070
|
|
37
|
-
autocoder/common/action_yml_file_manager.py,sha256
|
|
37
|
+
autocoder/common/action_yml_file_manager.py,sha256=-bbTB8nyxgzf_GNa_TCL21TV87b_9ENmDmybZWVrwSA,17371
|
|
38
38
|
autocoder/common/anything2images.py,sha256=0ILBbWzY02M-CiWB-vzuomb_J1hVdxRcenAfIrAXq9M,25283
|
|
39
39
|
autocoder/common/anything2img.py,sha256=iZQmg8srXlD7N5uGl5b_ONKJMBjYoW8kPmokkG6ISF0,10118
|
|
40
40
|
autocoder/common/audio.py,sha256=Kn9nWKQddWnUrAz0a_ZUgjcu4VUU_IcZBigT7n3N3qc,7439
|
|
@@ -137,7 +137,7 @@ autocoder/rag/api_server.py,sha256=StGyxrM-7-W2vYHJq-i_Fv-MHrl9UgVWY272Hd-6VJ4,1
|
|
|
137
137
|
autocoder/rag/conversation_to_queries.py,sha256=xwmErn4WbdADnhK1me-h_6fV3KYrl_y1qPNQl1aoI6o,4810
|
|
138
138
|
autocoder/rag/doc_filter.py,sha256=UduVO2mlrngwJICrefjDJTYfdmQ4GcRXrfWDQ7xXksk,14206
|
|
139
139
|
autocoder/rag/document_retriever.py,sha256=5BDqKVJqLPScEnua5S5suXhWuCaALIfPf5obXeJoWfs,8461
|
|
140
|
-
autocoder/rag/lang.py,sha256=
|
|
140
|
+
autocoder/rag/lang.py,sha256=HvcMeu6jReEJOGxyLMn4rwBoD-myFwmykS3VLceBJLs,3364
|
|
141
141
|
autocoder/rag/llm_wrapper.py,sha256=Ht5GF5yJtrztoliujsZzx_ooWZmHkd5xLZKcGEiicZw,4303
|
|
142
142
|
autocoder/rag/long_context_rag.py,sha256=RE4xse3XxSC_HQA5erqrx6MhanP_29mBRdYOTJQZYGc,42106
|
|
143
143
|
autocoder/rag/qa_conversation_strategy.py,sha256=1AcHV0MU00yTls20LlCPO-Un_OhSrr_p-H5lxLleAq4,6060
|
|
@@ -200,9 +200,9 @@ autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
200
200
|
autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
201
201
|
autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=xuBeWD0YOckqRo8JB1WkVIMOYH6c24m7JfV4svBfPDo,15113
|
|
202
202
|
autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
203
|
-
auto_coder-0.1.
|
|
204
|
-
auto_coder-0.1.
|
|
205
|
-
auto_coder-0.1.
|
|
206
|
-
auto_coder-0.1.
|
|
207
|
-
auto_coder-0.1.
|
|
208
|
-
auto_coder-0.1.
|
|
203
|
+
auto_coder-0.1.313.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
204
|
+
auto_coder-0.1.313.dist-info/METADATA,sha256=-QD-1xqhvWFPOYOyHkK8QQCD8N6ocoSb2Qm1w3-b_pQ,2747
|
|
205
|
+
auto_coder-0.1.313.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
206
|
+
auto_coder-0.1.313.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
|
|
207
|
+
auto_coder-0.1.313.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
|
|
208
|
+
auto_coder-0.1.313.dist-info/RECORD,,
|
autocoder/commands/tools.py
CHANGED
|
@@ -40,6 +40,8 @@ from autocoder.index.symbols_utils import (
|
|
|
40
40
|
from autocoder.run_context import get_run_context
|
|
41
41
|
from autocoder.events.event_manager_singleton import get_event_manager
|
|
42
42
|
from autocoder.events import event_content as EventContentCreator
|
|
43
|
+
from autocoder.linters.linter_factory import LinterFactory, lint_file, lint_project, format_lint_result
|
|
44
|
+
import traceback
|
|
43
45
|
|
|
44
46
|
|
|
45
47
|
@byzerllm.prompt()
|
|
@@ -159,23 +161,31 @@ class AutoCommandTools:
|
|
|
159
161
|
return answer
|
|
160
162
|
|
|
161
163
|
def response_user(self, response: str):
|
|
162
|
-
|
|
163
164
|
# 如果是在web模式下,则使用event_manager事件来询问用户
|
|
164
165
|
if get_run_context().is_web():
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
EventContentCreator.
|
|
169
|
-
|
|
166
|
+
try:
|
|
167
|
+
answer = get_event_manager(
|
|
168
|
+
self.args.event_file).write_result(
|
|
169
|
+
EventContentCreator.create_result(
|
|
170
|
+
EventContentCreator.ResultSummaryContent(
|
|
171
|
+
summary=response
|
|
172
|
+
)
|
|
170
173
|
)
|
|
171
174
|
)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
175
|
+
self.result_manager.append(content=response, meta={
|
|
176
|
+
"action": "response_user",
|
|
177
|
+
"input": {
|
|
178
|
+
"response": response
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
except Exception as e:
|
|
182
|
+
error_message = f"Error: {str(e)}\n\n完整异常堆栈信息:\n{traceback.format_exc()}"
|
|
183
|
+
self.result_manager.append(content=f"Error: {error_message}", meta={
|
|
184
|
+
"action": "response_user",
|
|
185
|
+
"input": {
|
|
186
|
+
"response": response
|
|
187
|
+
}
|
|
188
|
+
})
|
|
179
189
|
return answer
|
|
180
190
|
|
|
181
191
|
console = Console()
|
|
@@ -764,3 +774,74 @@ class AutoCommandTools:
|
|
|
764
774
|
}
|
|
765
775
|
})
|
|
766
776
|
return v
|
|
777
|
+
|
|
778
|
+
def lint_code(self, path: str, language: Optional[str] = None, fix: bool = False, verbose: bool = False) -> str:
|
|
779
|
+
"""
|
|
780
|
+
对代码进行质量检查,支持多种编程语言。
|
|
781
|
+
|
|
782
|
+
参数说明:
|
|
783
|
+
path (str): 要检查的文件路径或项目目录
|
|
784
|
+
language (str, optional): 明确指定语言类型,如'python', 'javascript', 'typescript', 'react', 'vue'等
|
|
785
|
+
如果不指定,将尝试根据文件扩展名或项目结构自动检测
|
|
786
|
+
fix (bool): 是否自动修复可修复的问题,默认为False
|
|
787
|
+
verbose (bool): 是否显示详细输出,默认为False
|
|
788
|
+
|
|
789
|
+
返回值:
|
|
790
|
+
格式化后的lint结果,包含错误和警告信息
|
|
791
|
+
|
|
792
|
+
支持的语言:
|
|
793
|
+
- 前端: JavaScript, TypeScript, React, Vue (使用ESLint)
|
|
794
|
+
- Python: 使用pylint, flake8, black
|
|
795
|
+
|
|
796
|
+
说明:
|
|
797
|
+
- 对于前端代码,需要Node.js环境
|
|
798
|
+
- 对于Python代码,需要pylint/flake8/black
|
|
799
|
+
- 工具会尝试自动安装缺少的依赖
|
|
800
|
+
- 如果路径是文件,则只检查该文件
|
|
801
|
+
- 如果路径是目录,则检查整个项目
|
|
802
|
+
- fix=True时会尝试自动修复问题
|
|
803
|
+
"""
|
|
804
|
+
try:
|
|
805
|
+
# 检查是否是目录或文件
|
|
806
|
+
is_directory = os.path.isdir(path)
|
|
807
|
+
|
|
808
|
+
# 根据路径类型执行相应的lint操作
|
|
809
|
+
if is_directory:
|
|
810
|
+
# 对整个项目进行lint
|
|
811
|
+
result = lint_project(path, language=language, fix=fix, verbose=verbose)
|
|
812
|
+
else:
|
|
813
|
+
# 对单个文件进行lint
|
|
814
|
+
result = lint_file(path, fix=fix, verbose=verbose)
|
|
815
|
+
|
|
816
|
+
# 格式化结果
|
|
817
|
+
formatted_result = format_lint_result(result, language=language)
|
|
818
|
+
|
|
819
|
+
# 记录操作结果
|
|
820
|
+
self.result_manager.add_result(content=formatted_result, meta={
|
|
821
|
+
"action": "lint_code",
|
|
822
|
+
"input": {
|
|
823
|
+
"path": path,
|
|
824
|
+
"language": language,
|
|
825
|
+
"fix": fix,
|
|
826
|
+
"verbose": verbose
|
|
827
|
+
},
|
|
828
|
+
"result": result
|
|
829
|
+
})
|
|
830
|
+
|
|
831
|
+
return formatted_result
|
|
832
|
+
|
|
833
|
+
except Exception as e:
|
|
834
|
+
error_message = f"Linting failed: {str(e)}\n\n完整异常堆栈信息:\n{traceback.format_exc()}"
|
|
835
|
+
|
|
836
|
+
self.result_manager.add_result(content=error_message, meta={
|
|
837
|
+
"action": "lint_code",
|
|
838
|
+
"input": {
|
|
839
|
+
"path": path,
|
|
840
|
+
"language": language,
|
|
841
|
+
"fix": fix,
|
|
842
|
+
"verbose": verbose
|
|
843
|
+
},
|
|
844
|
+
"error": error_message
|
|
845
|
+
})
|
|
846
|
+
|
|
847
|
+
return error_message
|
|
@@ -63,7 +63,7 @@ class ActionYmlFileManager:
|
|
|
63
63
|
|
|
64
64
|
action_files = [
|
|
65
65
|
f for f in os.listdir(self.actions_dir)
|
|
66
|
-
if f[:3].isdigit() and "_" in f and f.endswith('.yml')
|
|
66
|
+
if f[:3].isdigit() and "_" in f and f.endswith('_chat_action.yml')
|
|
67
67
|
]
|
|
68
68
|
|
|
69
69
|
if filter_prefix:
|
|
@@ -185,7 +185,7 @@ class ActionYmlFileManager:
|
|
|
185
185
|
Returns:
|
|
186
186
|
Dict: YAML 内容,如果加载失败返回空字典
|
|
187
187
|
"""
|
|
188
|
-
yaml_path = os.path.join(self.actions_dir, file_name)
|
|
188
|
+
yaml_path = os.path.join(self.actions_dir, file_name)
|
|
189
189
|
try:
|
|
190
190
|
with open(yaml_path, 'r', encoding='utf-8') as f:
|
|
191
191
|
content = yaml.safe_load(f) or {}
|
autocoder/rag/lang.py
CHANGED
|
@@ -2,33 +2,53 @@ import locale
|
|
|
2
2
|
from byzerllm.utils import format_str_jinja2
|
|
3
3
|
|
|
4
4
|
MESSAGES = {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
5
|
+
"rag_error_title": {
|
|
6
|
+
"en": "RAG Error",
|
|
7
|
+
"zh": "RAG 错误"
|
|
8
|
+
},
|
|
9
|
+
"rag_error_message": {
|
|
10
|
+
"en": "Failed to generate response: {{error}}",
|
|
11
|
+
"zh": "生成响应失败: {{error}}"
|
|
12
|
+
},
|
|
13
|
+
"rag_searching_docs": {
|
|
14
|
+
"en": "Searching documents with {{model}}...",
|
|
15
|
+
"zh": "正在使用 {{model}} 搜索文档..."
|
|
16
|
+
},
|
|
17
|
+
"rag_docs_filter_result": {
|
|
18
|
+
"en": "{{model}} processed {{docs_num}} documents, cost {{filter_time}} seconds, input tokens: {{input_tokens}}, output tokens: {{output_tokens}}",
|
|
19
|
+
"zh": "{{model}} 处理了 {{docs_num}} 个文档, 耗时 {{filter_time}} 秒, 输入 tokens: {{input_tokens}}, 输出 tokens: {{output_tokens}}"
|
|
20
|
+
},
|
|
21
|
+
"dynamic_chunking_start": {
|
|
22
|
+
"en": "Dynamic chunking start with {{model}}",
|
|
23
|
+
"zh": "使用 {{model}} 进行动态分块"
|
|
24
|
+
},
|
|
25
|
+
"dynamic_chunking_result": {
|
|
26
|
+
"en": "Dynamic chunking result with {{model}}, first round cost {{first_round_time}} seconds, second round cost {{sencond_round_time}} seconds, input tokens: {{input_tokens}}, output tokens: {{output_tokens}}, first round full docs: {{first_round_full_docs}}, second round extracted docs: {{second_round_extracted_docs}}",
|
|
27
|
+
"zh": "使用 {{model}} 进行动态分块, 第一轮耗时 {{first_round_time}} 秒, 第二轮耗时 {{sencond_round_time}} 秒, 输入 tokens: {{input_tokens}}, 输出 tokens: {{output_tokens}}, 第一轮全量文档: {{first_round_full_docs}}, 第二轮提取文档: {{second_round_extracted_docs}}"
|
|
28
|
+
},
|
|
29
|
+
"send_to_model": {
|
|
30
|
+
"en": "Send to model {{model}} with {{tokens}} tokens",
|
|
31
|
+
"zh": "发送给模型 {{model}} 的 tokens 数量预估为 {{tokens}}"
|
|
32
|
+
},
|
|
33
|
+
"doc_filter_start": {
|
|
34
|
+
"en": "Document filtering start, total {{total}} documents",
|
|
35
|
+
"zh": "开始过滤文档,共 {{total}} 个文档"
|
|
36
|
+
},
|
|
37
|
+
"doc_filter_progress": {
|
|
38
|
+
"en": "Document filtering progress: {{progress_percent}}% processed {{relevant_count}}/{{total}} documents",
|
|
39
|
+
"zh": "文档过滤进度:{{progress_percent}}%,处理了 {{relevant_count}}/{{total}} 个文档"
|
|
40
|
+
},
|
|
41
|
+
"doc_filter_error": {
|
|
42
|
+
"en": "Document filtering error: {{error}}",
|
|
43
|
+
"zh": "文档过滤错误:{{error}}"
|
|
44
|
+
},
|
|
45
|
+
"doc_filter_complete": {
|
|
46
|
+
"en": "Document filtering complete, cost {{total_time}} seconds, found {{relevant_count}} relevant documents",
|
|
47
|
+
"zh": "文档过滤完成,耗时 {{total_time}} 秒,找到 {{relevant_count}} 个相关文档"
|
|
48
|
+
},
|
|
49
|
+
"context_docs_names": {
|
|
50
|
+
"en": "The following are the documents related to the user's question: {{context_docs_names}}",
|
|
51
|
+
"zh": "以下是和用户问题相关的文档:{{context_docs_names}}"
|
|
32
52
|
}
|
|
33
53
|
}
|
|
34
54
|
|
|
@@ -42,7 +62,9 @@ def get_system_language():
|
|
|
42
62
|
|
|
43
63
|
def get_message(key):
|
|
44
64
|
lang = get_system_language()
|
|
45
|
-
|
|
65
|
+
if key in MESSAGES:
|
|
66
|
+
return MESSAGES[key].get(lang, MESSAGES[key].get("en", ""))
|
|
67
|
+
return ""
|
|
46
68
|
|
|
47
69
|
|
|
48
70
|
def get_message_with_format(msg_key: str, **kwargs):
|
autocoder/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.313"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|