auto-coder 0.1.289__py3-none-any.whl → 0.1.290__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.289
3
+ Version: 0.1.290
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.171
29
+ Requires-Dist: byzerllm[saas] >=0.1.174
30
30
  Requires-Dist: patch
31
31
  Requires-Dist: diff-match-patch
32
32
  Requires-Dist: GitPython
@@ -1,7 +1,7 @@
1
1
  autocoder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  autocoder/auto_coder.py,sha256=zKqfMdm2F419hrNGaosW4kYJ3IbaxBKlpTlVl6JFWmE,65563
3
3
  autocoder/auto_coder_lang.py,sha256=Rtupq6N3_HT7JRhDKdgCBcwRaiAnyCOR_Gsp4jUomrI,3229
4
- autocoder/auto_coder_rag.py,sha256=cwsCpudP6d2CHOUTD-RXw7CCgx-c7sG7_cKqnjzphlk,32973
4
+ autocoder/auto_coder_rag.py,sha256=NGg0X1E4RltWHDDvyfwPPv2DiaBP5cRr9FGBpzL85oo,33483
5
5
  autocoder/auto_coder_rag_client_mcp.py,sha256=QRxUbjc6A8UmDMQ8lXgZkjgqtq3lgKYeatJbDY6rSo0,6270
6
6
  autocoder/auto_coder_rag_mcp.py,sha256=-RrjNwFaS2e5v8XDIrKR-zlUNUE8UBaeOtojffBrvJo,8521
7
7
  autocoder/auto_coder_runner.py,sha256=w-4MCKhOFaoABcDfVoZoonF59UyRso3kghimQYLz3NA,100851
@@ -12,7 +12,7 @@ autocoder/chat_auto_coder_lang.py,sha256=CjsiJsUaWr-TJBCDDlDNnFpCDTd-itJhd9aid9D
12
12
  autocoder/command_args.py,sha256=9aYJ-AmPxP1sQh6ciw04FWHjSn31f2W9afXFwo8wgx4,30441
13
13
  autocoder/lang.py,sha256=U6AjVV8Rs1uLyjFCZ8sT6WWuNUxMBqkXXIOs4S120uk,14511
14
14
  autocoder/models.py,sha256=AyoZ-Pzy0oyYUmWCxOIRiOImsqboSfRET7LO9-UOuxI,11172
15
- autocoder/version.py,sha256=PdEYRA8P5PvpFJPJQZHtlPmy6VcHnHQCNoSmp3MGqsQ,23
15
+ autocoder/version.py,sha256=369_tLSRetHjzOMPJ7G1G6im3bfLm99qfAouBZtoMco,23
16
16
  autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  autocoder/agent/auto_demand_organizer.py,sha256=NWSAEsEk94vT3lGjfo25kKLMwYdPcpy9e-i21txPasQ,6942
18
18
  autocoder/agent/auto_filegroup.py,sha256=CW7bqp0FW1GIEMnl-blyAc2UGT7O9Mom0q66ITz1ckM,6635
@@ -31,7 +31,7 @@ autocoder/commands/auto_web.py,sha256=_449f4rCoRG7Sv0SB0hIBRFLPLPJ5DgWW4DlI22a3X
31
31
  autocoder/commands/tools.py,sha256=lanjoBGR6H8HDJSY3KrM6ibrtHZbgKX6mKJHSSE66dg,20493
32
32
  autocoder/common/JupyterClient.py,sha256=O-wi6pXeAEYhAY24kDa0BINrLYvKS6rKyWe98pDClS0,2816
33
33
  autocoder/common/ShellClient.py,sha256=fM1q8t_XMSbLBl2zkCNC2J9xuyKN3eXzGm6hHhqL2WY,2286
34
- autocoder/common/__init__.py,sha256=gW-3curQgP__wRSXg4hnl22VqwIBWJCZPe7piJt305M,13148
34
+ autocoder/common/__init__.py,sha256=zvNkIt388i0afI-Mt6ekwl406mllvxPgBEyzLYWh0vk,13265
35
35
  autocoder/common/anything2images.py,sha256=0ILBbWzY02M-CiWB-vzuomb_J1hVdxRcenAfIrAXq9M,25283
36
36
  autocoder/common/anything2img.py,sha256=iZQmg8srXlD7N5uGl5b_ONKJMBjYoW8kPmokkG6ISF0,10118
37
37
  autocoder/common/audio.py,sha256=Kn9nWKQddWnUrAz0a_ZUgjcu4VUU_IcZBigT7n3N3qc,7439
@@ -115,13 +115,14 @@ autocoder/privacy/__init__.py,sha256=LnIVvGu_K66zCE-yhN_-dPO8R80pQyedCsXJ7wRqQaI
115
115
  autocoder/privacy/model_filter.py,sha256=-N9ZvxxDKpxU7hkn-tKv-QHyXjvkCopUaKgvJwTOGQs,3369
116
116
  autocoder/pyproject/__init__.py,sha256=ms-A_pocgGv0oZPEW8JAdXi7G-VSVhkQ6CnWFe535Ec,14477
117
117
  autocoder/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
118
- autocoder/rag/api_server.py,sha256=xiypCkdbclY0Z3Cmq5FTvtKrfQUV7yKcDaFFUttA2n0,7242
118
+ autocoder/rag/api_server.py,sha256=6daDd5tF_Z69cogl-nz-8ogvtKn-BNUdnnpXXxFK0uo,9419
119
+ autocoder/rag/conversation_to_queries.py,sha256=xwmErn4WbdADnhK1me-h_6fV3KYrl_y1qPNQl1aoI6o,4810
119
120
  autocoder/rag/doc_filter.py,sha256=UduVO2mlrngwJICrefjDJTYfdmQ4GcRXrfWDQ7xXksk,14206
120
121
  autocoder/rag/document_retriever.py,sha256=MGn6oIPo49BbRC99xmLMFkZrpHfcDfKoGYqWxXF554U,8051
121
122
  autocoder/rag/lang.py,sha256=_jmUtxZDG1fmF4b2mhMJbYS1YQDb2ZE8nyAn5_vrvjA,3350
122
123
  autocoder/rag/llm_wrapper.py,sha256=Ht5GF5yJtrztoliujsZzx_ooWZmHkd5xLZKcGEiicZw,4303
123
- autocoder/rag/long_context_rag.py,sha256=lWgv8Z7h8NXzmmmg1AggYJwOlrM_tEcqcvsmWe1wtpk,41305
124
- autocoder/rag/qa_conversation_strategy.py,sha256=bWFSMcAsacEgvV7nTHtCroia2mstxqhWj8nz7k4HECI,4898
124
+ autocoder/rag/long_context_rag.py,sha256=THQakGbrr-kOn8Mu4PdJDMiiPq02FNZxZZUM8Du2YCw,41848
125
+ autocoder/rag/qa_conversation_strategy.py,sha256=_BFdgit2KkUkW_82jE67QLYS_d8BsGhU1pG73YhHJgE,5744
125
126
  autocoder/rag/rag_config.py,sha256=8LwFcTd8OJWWwi1_WY4IzjqgtT6RyE2j4PjxS5cCTDE,802
126
127
  autocoder/rag/rag_entry.py,sha256=6TKtErZ0Us9XSV6HgRKXA6yR3SiZGPHpynOKSaR1wgE,2463
127
128
  autocoder/rag/raw_rag.py,sha256=BOr0YGf3umjqXOIDVO1LXQ0bIHx8hzBdiubND2ezyxc,2946
@@ -138,10 +139,12 @@ autocoder/rag/utils.py,sha256=f21ybCAlYVgr3tJP9MkVoM9d82-uG5NHu2gsv2oaVBQ,4961
138
139
  autocoder/rag/variable_holder.py,sha256=PFvBjFcR7-fNDD4Vcsc8CpH2Te057vcpwJMxtrfUgKI,75
139
140
  autocoder/rag/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
140
141
  autocoder/rag/cache/base_cache.py,sha256=EaYYYbclMBvnlOUoM7qonnluwZX5oSvUjdvGvFun8_8,742
141
- autocoder/rag/cache/byzer_storage_cache.py,sha256=gK90pf741CgccCzQ73urBorCqVyAfwU1FAqMtSorWVk,17232
142
- autocoder/rag/cache/file_monitor_cache.py,sha256=2TnOW8Y81Zc0WA1upRrkmQH18IMdv40CeNccmnTvd3c,4981
143
- autocoder/rag/cache/local_byzer_storage_cache.py,sha256=kgGMYP4MIc4upXcwTmeGbWYW4dDnt-hhJKmnjsFPKU4,18977
144
- autocoder/rag/cache/simple_cache.py,sha256=8FMmBAfhAPcdSNUWC6Ga43LBFGXD-klwabVbzm_bciI,9347
142
+ autocoder/rag/cache/byzer_storage_cache.py,sha256=okmNUDRCDv81JOfBuTspmTxf8ltYmYctd4vrPdjUgOg,29239
143
+ autocoder/rag/cache/cache_result_merge.py,sha256=VnTdbT2OMBmWl_83bqds97d9_M33IhPNX8tF7KH2GMM,10556
144
+ autocoder/rag/cache/file_monitor_cache.py,sha256=OdSXTH3vo6inAzkN5d55I0RN03GUlSlnUEKmXpjFl78,9443
145
+ autocoder/rag/cache/local_byzer_storage_cache.py,sha256=7_6zCRY3BiCM0ec3U96i1G4l2SzmAedaTfkArNkMfQU,31925
146
+ autocoder/rag/cache/rag_file_meta.py,sha256=RQ3n4wfkHlB-1ljS3sFSi8ijbsUPeIqBSgjmmbRuwRI,20521
147
+ autocoder/rag/cache/simple_cache.py,sha256=uG2mJexA-6Zy__y1Q09_axYZ1xN9InXafr0X8nuSZFI,12622
145
148
  autocoder/rag/loaders/__init__.py,sha256=EQHEZ5Cmz-mGP2SllUTvcIbYCnF7W149dNpNItfs0yE,304
146
149
  autocoder/rag/loaders/docx_loader.py,sha256=ZswPqiiLngUEpzLhNNm1nmwEYV7ZHFEfIoXoG7c5GDU,614
147
150
  autocoder/rag/loaders/excel_loader.py,sha256=Ue8YB1z_kBs8SjIPuBskyM08Q1JiONs_BJZPrzi59oo,896
@@ -178,9 +181,9 @@ autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
178
181
  autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
179
182
  autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=lkJ_A-sYU36JMzjFWkk3pR6uos8oZHYt9GPsPe_CPAo,11766
180
183
  autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
181
- auto_coder-0.1.289.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
182
- auto_coder-0.1.289.dist-info/METADATA,sha256=QbVuNIrm32pG5R3e-JCgFvbjKjM1lFar0HsrwRkWKm8,2643
183
- auto_coder-0.1.289.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
184
- auto_coder-0.1.289.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
185
- auto_coder-0.1.289.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
186
- auto_coder-0.1.289.dist-info/RECORD,,
184
+ auto_coder-0.1.290.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
185
+ auto_coder-0.1.290.dist-info/METADATA,sha256=BREVeJdr-YetxjB57QQUjNdESLzfAdrNTavDG8XO7zQ,2643
186
+ auto_coder-0.1.290.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
187
+ auto_coder-0.1.290.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
188
+ auto_coder-0.1.290.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
189
+ auto_coder-0.1.290.dist-info/RECORD,,
@@ -262,6 +262,7 @@ def main(input_args: Optional[List[str]] = None):
262
262
  serve_parser.add_argument("--source_dir", default=".", help="")
263
263
  serve_parser.add_argument("--host", default="", help="")
264
264
  serve_parser.add_argument("--port", type=int, default=8000, help="")
265
+ serve_parser.add_argument("--workers", type=int, default=4, help="")
265
266
  serve_parser.add_argument("--uvicorn_log_level", default="info", help="")
266
267
  serve_parser.add_argument("--allow_credentials", action="store_true", help="")
267
268
  serve_parser.add_argument("--allowed_origins", default=["*"], help="")
@@ -274,6 +275,7 @@ def main(input_args: Optional[List[str]] = None):
274
275
  serve_parser.add_argument("--ssl_certfile", default="", help="")
275
276
  serve_parser.add_argument("--response_role", default="assistant", help="")
276
277
  serve_parser.add_argument("--doc_dir", default="", help="")
278
+ serve_parser.add_argument("--enable_local_image_host", action="store_true", help=" enable local image host for local Chat app")
277
279
  serve_parser.add_argument("--tokenizer_path", default=tokenizer_path, help="")
278
280
  serve_parser.add_argument(
279
281
  "--collections", default="", help="Collection name for indexing"
@@ -516,6 +518,14 @@ def main(input_args: Optional[List[str]] = None):
516
518
  if hasattr(args, arg)
517
519
  }
518
520
  )
521
+ # 设置本地图床的地址
522
+ if args.enable_local_image_host:
523
+ host = server_args.host or "127.0.0.1"
524
+ if host == "0.0.0.0":
525
+ host = "127.0.0.1"
526
+ port = str(server_args.port)
527
+ auto_coder_args.local_image_host = f"{host}:{port}"
528
+
519
529
 
520
530
  # Generate unique name for RAG build if doc_dir exists
521
531
  if server_args.doc_dir:
@@ -296,6 +296,10 @@ class AutoCoderArgs(pydantic.BaseModel):
296
296
  rag_params_max_tokens: Optional[int] = 4096
297
297
  rag_doc_filter_relevance: Optional[int] = 5
298
298
  rag_context_window_limit: Optional[int] = 120000
299
+ # rag 本地图床地址
300
+ local_image_host: Optional[str] = ""
301
+ rag_recall_max_queries: Optional[int] = 5
302
+
299
303
 
300
304
  # 回答用户问题时,使用哪种对话历史策略
301
305
  # single_round: 单轮对话
@@ -1,10 +1,14 @@
1
1
  import os
2
2
  import time
3
+ import aiofiles
3
4
  import uvicorn
4
5
  from fastapi import Request
5
6
  from fastapi import FastAPI
6
7
  from fastapi.middleware.cors import CORSMiddleware
7
8
  from fastapi.responses import JSONResponse, StreamingResponse, Response
9
+ from fastapi import HTTPException
10
+ import mimetypes
11
+ from urllib.parse import unquote
8
12
 
9
13
  from byzerllm.log import init_logger
10
14
  from byzerllm.utils import random_uuid
@@ -165,9 +169,52 @@ async def embed(body: EmbeddingCompletionRequest):
165
169
  id=embedding_id
166
170
  )
167
171
 
172
+ @router_app.get("/static/{full_path:path}")
173
+ async def serve_image(full_path: str, request: Request):
174
+
175
+ allowed_file_type = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.webp']
176
+
177
+ if any(full_path.endswith(ext) for ext in allowed_file_type):
178
+ try:
179
+ # 获取文件的完整路径,并进行URL解码
180
+ file_path = unquote(full_path)
181
+ # 使用 os.path.normpath 来标准化路径,自动处理不同操作系统的路径分隔符
182
+ file_path = os.path.normpath(file_path)
183
+ if not os.path.isabs(file_path):
184
+ file_path = os.path.join("/", file_path)
185
+
186
+ # 检查文件是否存在
187
+ if not os.path.exists(file_path):
188
+ raise FileNotFoundError(f"File not found: {file_path}")
189
+
190
+ # 异步读取文件内容
191
+ async with aiofiles.open(file_path, "rb") as f:
192
+ content = await f.read()
193
+
194
+ # 获取文件的 MIME 类型
195
+ content_type = mimetypes.guess_type(file_path)[0]
196
+ if not content_type:
197
+ content_type = "application/octet-stream"
198
+
199
+ # 返回文件内容
200
+ return Response(content=content, media_type=content_type)
201
+ except FileNotFoundError as e:
202
+ logger.error(f"Image not found: {str(e)}")
203
+ raise HTTPException(status_code=404, detail=f"Image not found: {str(e)}")
204
+ except PermissionError as e:
205
+ logger.error(f"Permission denied: {str(e)}")
206
+ raise HTTPException(status_code=403, detail=f"Permission denied: {str(e)}")
207
+ except Exception as e:
208
+ logger.error(f"Error serving image: {str(e)}")
209
+ raise HTTPException(status_code=500, detail=f"Error serving image: {str(e)}")
210
+
211
+ # 如果路径中没有图片, 返回 404
212
+ raise HTTPException(status_code=404, detail="Only images are supported")
213
+
168
214
  class ServerArgs(BaseModel):
169
215
  host: str = None
170
216
  port: int = 8000
217
+ workers: int = 4
171
218
  uvicorn_log_level: str = "info"
172
219
  allow_credentials: bool = False
173
220
  allowed_origins: List[str] = ["*"]
@@ -227,6 +274,7 @@ def serve(llm:ByzerLLM, args: ServerArgs):
227
274
  prompt_template=args.prompt_template
228
275
  )
229
276
 
277
+ # 如果使用workers>1或reload=True,必须使用导入字符串而不是应用实例
230
278
  uvicorn.run(
231
279
  router_app,
232
280
  host=args.host,