MeUtils 2025.3.21.17.22.17__py3-none-any.whl → 2025.3.26.18.50.26__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.
Files changed (36) hide show
  1. {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/METADATA +263 -263
  2. {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/RECORD +36 -28
  3. examples/_openaisdk/openai_google.py +49 -0
  4. meutils/apis/common.py +12 -10
  5. meutils/apis/dashscope/__init__.py +11 -0
  6. meutils/apis/dashscope/audio.py +37 -0
  7. meutils/apis/images/recraft.py +6 -1
  8. meutils/apis/jina/common.py +3 -2
  9. meutils/apis/siliconflow/videos.py +40 -21
  10. meutils/apis/textin_apis/__init__.py +13 -0
  11. meutils/apis/textin_apis/common.py +66 -0
  12. meutils/apis/textin_apis/utils.py +42 -0
  13. meutils/apis/textin_apis/watermark_remove.py +58 -0
  14. meutils/apis/utils.py +1 -1
  15. meutils/caches/common.py +1 -0
  16. meutils/common.py +8 -0
  17. meutils/data/VERSION +1 -1
  18. meutils/data/oneapi/NOTICE.html +4 -1
  19. meutils/io/files_utils.py +4 -2
  20. meutils/io/openai_files.py +2 -5
  21. meutils/io/x.py +12 -58
  22. meutils/llm/completions/chat_gemini.py +2 -2
  23. meutils/llm/completions/chat_plus.py +24 -11
  24. meutils/llm/completions/chat_spark.py +4 -2
  25. meutils/llm/completions/yuanbao.py +12 -6
  26. meutils/notice/feishu.py +3 -0
  27. meutils/request_utils/crawler.py +3 -2
  28. meutils/schemas/image_types.py +1 -5
  29. meutils/schemas/oneapi/common.py +37 -5
  30. meutils/schemas/siliconflow_types.py +24 -2
  31. meutils/schemas/textin_types.py +64 -0
  32. meutils/serving/fastapi/exceptions/http_error.py +29 -9
  33. {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/LICENSE +0 -0
  34. {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/WHEEL +0 -0
  35. {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/entry_points.txt +0 -0
  36. {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : textin_types
5
+ # @Time : 2025/3/23 11:07
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
12
+
13
+ # BASE_URL = "https://api.textin.com"
14
+ BASE_URL = "https://api.textin.com/ai/service/v1"
15
+
16
+
17
+ # dict_to_model(d)
18
+
19
+ class DynamicModel(BaseModel):
20
+ pdf_pwd: Optional[str] = 'None'
21
+ dpi: int = '144'
22
+ page_start: int = '0'
23
+ page_count: int = '1000'
24
+ apply_document_tree: int = '0'
25
+ markdown_details: int = '1'
26
+ page_details: int = '0'
27
+ table_flavor: str = 'md'
28
+ get_image: str = 'none'
29
+ parse_mode: str = 'scan'
30
+
31
+
32
+ class WatermarkRemove(BaseModel):
33
+ image: str # path url base64 # from pydantic import HttpUrl
34
+ response_format: Literal["url", "b64_json"] = 'b64_json'
35
+
36
+ class Config:
37
+ extra = "allow"
38
+
39
+ json_schema_extra = {
40
+ "examples": [
41
+ {
42
+ "image": "https://oss.ffire.cc/files/sese1.jpg",
43
+ "response_format": "url"
44
+
45
+ },
46
+ ]
47
+ }
48
+
49
+
50
+ class WatermarkRemoveResponse(BaseModel):
51
+ """{'code': 200,
52
+ 'duration': 375,
53
+ 'has_watermark': 1,
54
+ 'message': 'success',
55
+ 'result': {'image': },'version': '0.2.1'}
56
+ """
57
+ pass
58
+
59
+ class Config:
60
+ extra = "allow"
61
+
62
+
63
+ if __name__ == '__main__':
64
+ pass
@@ -10,13 +10,7 @@ from starlette.responses import JSONResponse
10
10
 
11
11
  from fastapi.exceptions import RequestValidationError, HTTPException
12
12
 
13
- from meutils.notice.feishu import send_message as _send_message
14
-
15
- send_message = partial(
16
- _send_message,
17
- title=__name__,
18
- url="https://open.feishu.cn/open-apis/bot/v2/hook/d1c7b67d-b0f8-4067-a2f5-109f20eeb696"
19
- )
13
+ from meutils.notice.feishu import send_message_for_httpexception as send_message
20
14
 
21
15
 
22
16
  async def http_error_handler(_: Request, exc: HTTPException) -> JSONResponse:
@@ -42,7 +36,6 @@ async def general_exception_handler(request: Request, exc: Exception):
42
36
 
43
37
 
44
38
  async def chatfire_api_exception_handler(request: Request, exc: Exception):
45
-
46
39
  content = {
47
40
  "error":
48
41
  {
@@ -68,10 +61,37 @@ async def chatfire_api_exception_handler(request: Request, exc: Exception):
68
61
 
69
62
  # send_message
70
63
  content_detail = f"{traceback.format_exc()}"
64
+ #
65
+ # from meutils.pipe import logger
66
+ # logger.debug(content_detail)
67
+
71
68
  if any(code in content_detail for code in {'451', }):
72
69
  content_detail = ""
73
70
 
74
- send_message([content, content_detail])
71
+ send_message([content, content_detail], title=__name__)
72
+
73
+ # from meutils.pipe import logger
74
+ #
75
+ # try:
76
+ #
77
+ # logger.debug(request.headers)
78
+ # logger.debug(request.url)
79
+ # logger.debug(request.method)
80
+ # logger.debug(request.query_params._dict)
81
+ #
82
+ # logger.debug(request.client)
83
+ # logger.debug(request.cookies)
84
+ #
85
+ # payload = await request.body()
86
+ #
87
+ # # send_message(payload, title=__name__)
88
+ #
89
+ # logger.debug(payload)
90
+ # logger.debug(payload)
91
+ #
92
+ #
93
+ # except Exception as e:
94
+ # logger.debug(e)
75
95
 
76
96
  return reps or JSONResponse(
77
97
  content=content,