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.
- {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/METADATA +263 -263
- {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/RECORD +36 -28
- examples/_openaisdk/openai_google.py +49 -0
- meutils/apis/common.py +12 -10
- meutils/apis/dashscope/__init__.py +11 -0
- meutils/apis/dashscope/audio.py +37 -0
- meutils/apis/images/recraft.py +6 -1
- meutils/apis/jina/common.py +3 -2
- meutils/apis/siliconflow/videos.py +40 -21
- meutils/apis/textin_apis/__init__.py +13 -0
- meutils/apis/textin_apis/common.py +66 -0
- meutils/apis/textin_apis/utils.py +42 -0
- meutils/apis/textin_apis/watermark_remove.py +58 -0
- meutils/apis/utils.py +1 -1
- meutils/caches/common.py +1 -0
- meutils/common.py +8 -0
- meutils/data/VERSION +1 -1
- meutils/data/oneapi/NOTICE.html +4 -1
- meutils/io/files_utils.py +4 -2
- meutils/io/openai_files.py +2 -5
- meutils/io/x.py +12 -58
- meutils/llm/completions/chat_gemini.py +2 -2
- meutils/llm/completions/chat_plus.py +24 -11
- meutils/llm/completions/chat_spark.py +4 -2
- meutils/llm/completions/yuanbao.py +12 -6
- meutils/notice/feishu.py +3 -0
- meutils/request_utils/crawler.py +3 -2
- meutils/schemas/image_types.py +1 -5
- meutils/schemas/oneapi/common.py +37 -5
- meutils/schemas/siliconflow_types.py +24 -2
- meutils/schemas/textin_types.py +64 -0
- meutils/serving/fastapi/exceptions/http_error.py +29 -9
- {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/LICENSE +0 -0
- {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/WHEEL +0 -0
- {MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/entry_points.txt +0 -0
- {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
|
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,
|
File without changes
|
File without changes
|
{MeUtils-2025.3.21.17.22.17.dist-info → MeUtils-2025.3.26.18.50.26.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|