MeUtils 2025.1.16.17.15.52__py3-none-any.whl → 2025.1.17.17.55.21__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 (27) hide show
  1. {MeUtils-2025.1.16.17.15.52.dist-info → MeUtils-2025.1.17.17.55.21.dist-info}/METADATA +29 -29
  2. {MeUtils-2025.1.16.17.15.52.dist-info → MeUtils-2025.1.17.17.55.21.dist-info}/RECORD +27 -22
  3. examples/_openaisdk/openai_embeddings.py +1 -1
  4. examples/_openaisdk/openai_siliconflow.py +1 -1
  5. meutils/apis/{vidu/x.py → aitools/__init__.py} +2 -5
  6. meutils/apis/aitools/baidu/__init__.py +11 -0
  7. meutils/apis/aitools/baidu/sdk.py +37 -0
  8. meutils/apis/gitee//350/211/262/346/203/205/345/233/276/347/211/207/350/257/206/345/210/253.py +33 -0
  9. meutils/apis/images/edits.py +146 -0
  10. meutils/apis/siliconflow/image_to_image.py +3 -3
  11. meutils/apis/siliconflow/text_to_image.py +1 -1
  12. meutils/apis/siliconflow/utils.py +1 -1
  13. meutils/apis/utils.py +30 -4
  14. meutils/apis/vidu/vidu_video.py +2 -0
  15. meutils/data/VERSION +1 -1
  16. meutils/io/files_utils.py +6 -2
  17. meutils/llm/check_api.py +1 -1
  18. meutils/llm/check_utils.py +1 -1
  19. meutils/llm/completions/qwenllm.py +56 -0
  20. meutils/llm/openai_utils/common.py +4 -4
  21. meutils/schemas/image_types.py +15 -0
  22. meutils/schemas/kuaishou_types.py +1 -1
  23. meutils/schemas/siliconflow_types.py +1 -1
  24. {MeUtils-2025.1.16.17.15.52.dist-info → MeUtils-2025.1.17.17.55.21.dist-info}/LICENSE +0 -0
  25. {MeUtils-2025.1.16.17.15.52.dist-info → MeUtils-2025.1.17.17.55.21.dist-info}/WHEEL +0 -0
  26. {MeUtils-2025.1.16.17.15.52.dist-info → MeUtils-2025.1.17.17.55.21.dist-info}/entry_points.txt +0 -0
  27. {MeUtils-2025.1.16.17.15.52.dist-info → MeUtils-2025.1.17.17.55.21.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MeUtils
3
- Version: 2025.1.16.17.15.52
3
+ Version: 2025.1.17.17.55.21
4
4
  Summary: description
5
5
  Home-page: https://github.com/yuanjie-ai/MeUtils
6
6
  Author: yuanjie
@@ -63,42 +63,42 @@ Requires-Dist: sse-starlette ; extra == 'ai'
63
63
  Requires-Dist: openai ; extra == 'ai'
64
64
  Requires-Dist: langchain ; extra == 'ai'
65
65
  Provides-Extra: all
66
- Requires-Dist: schedule ; extra == 'all'
67
- Requires-Dist: filetype ; extra == 'all'
68
- Requires-Dist: asyncmy ; extra == 'all'
69
- Requires-Dist: thefuck ; extra == 'all'
70
- Requires-Dist: gunicorn ; extra == 'all'
71
- Requires-Dist: pandas-summary ; extra == 'all'
72
- Requires-Dist: thriftpy2 ; extra == 'all'
73
- Requires-Dist: pymysql ; extra == 'all'
74
- Requires-Dist: cachetools ; extra == 'all'
75
- Requires-Dist: uvicorn ; extra == 'all'
76
- Requires-Dist: seaborn ; extra == 'all'
77
- Requires-Dist: streamlit ; extra == 'all'
78
- Requires-Dist: redis-py-cluster ; extra == 'all'
66
+ Requires-Dist: sqlalchemy ; extra == 'all'
79
67
  Requires-Dist: simplejson ; extra == 'all'
80
- Requires-Dist: sse-starlette ; extra == 'all'
81
- Requires-Dist: iteration-utilities ; extra == 'all'
82
- Requires-Dist: langchain ; extra == 'all'
83
- Requires-Dist: missingno ; extra == 'all'
68
+ Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
84
69
  Requires-Dist: faiss-cpu ; extra == 'all'
85
- Requires-Dist: jieba ; extra == 'all'
86
- Requires-Dist: sqlalchemy ; extra == 'all'
87
- Requires-Dist: openai ; extra == 'all'
88
70
  Requires-Dist: fastapi[all] ; extra == 'all'
89
- Requires-Dist: pretty-errors ; extra == 'all'
71
+ Requires-Dist: pymongo ; extra == 'all'
72
+ Requires-Dist: uvicorn ; extra == 'all'
73
+ Requires-Dist: cachetools ; extra == 'all'
74
+ Requires-Dist: gunicorn ; extra == 'all'
90
75
  Requires-Dist: fastapi ; extra == 'all'
91
- Requires-Dist: pyarrow ; extra == 'all'
76
+ Requires-Dist: redis-py-cluster ; extra == 'all'
77
+ Requires-Dist: jieba ; extra == 'all'
78
+ Requires-Dist: pretty-errors ; extra == 'all'
92
79
  Requires-Dist: jmespath ; extra == 'all'
93
- Requires-Dist: pymupd ; extra == 'all'
94
- Requires-Dist: polars ; extra == 'all'
80
+ Requires-Dist: filetype ; extra == 'all'
95
81
  Requires-Dist: reportlab ; extra == 'all'
96
- Requires-Dist: jinja2 ; extra == 'all'
97
- Requires-Dist: pymilvus ; extra == 'all'
98
- Requires-Dist: pymongo ; extra == 'all'
99
82
  Requires-Dist: geopy ; extra == 'all'
83
+ Requires-Dist: pymupd ; extra == 'all'
84
+ Requires-Dist: pymysql ; extra == 'all'
100
85
  Requires-Dist: dataframe-image ; extra == 'all'
101
- Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
86
+ Requires-Dist: jinja2 ; extra == 'all'
87
+ Requires-Dist: sse-starlette ; extra == 'all'
88
+ Requires-Dist: iteration-utilities ; extra == 'all'
89
+ Requires-Dist: openai ; extra == 'all'
90
+ Requires-Dist: polars ; extra == 'all'
91
+ Requires-Dist: streamlit ; extra == 'all'
92
+ Requires-Dist: missingno ; extra == 'all'
93
+ Requires-Dist: schedule ; extra == 'all'
94
+ Requires-Dist: asyncmy ; extra == 'all'
95
+ Requires-Dist: thriftpy2 ; extra == 'all'
96
+ Requires-Dist: seaborn ; extra == 'all'
97
+ Requires-Dist: pymilvus ; extra == 'all'
98
+ Requires-Dist: langchain ; extra == 'all'
99
+ Requires-Dist: thefuck ; extra == 'all'
100
+ Requires-Dist: pyarrow ; extra == 'all'
101
+ Requires-Dist: pandas-summary ; extra == 'all'
102
102
  Provides-Extra: ann
103
103
  Requires-Dist: pymilvus ; extra == 'ann'
104
104
  Requires-Dist: faiss-cpu ; extra == 'ann'
@@ -97,7 +97,7 @@ examples/_openaisdk/openai_chatfire_all.py,sha256=DaiI1NfDeK655QvXyczkgXK9Awxp7N
97
97
  examples/_openaisdk/openai_deepinfra.py,sha256=RuIU7-7JFOpgFo19nLK2yqv3b8_XXYzGA4VJlmqD0oc,1188
98
98
  examples/_openaisdk/openai_deepseek.py,sha256=-1WyTX5EfB8bdVhZ-y2yZQ04fVzujp4OPmOQR6i3QxI,660
99
99
  examples/_openaisdk/openai_doubao.py,sha256=dp0SLvDBYpIJPNs_vnV2GBIEFa9FglNtYvfGKtJ9Bqk,1053
100
- examples/_openaisdk/openai_embeddings.py,sha256=cBF0bK_saOadjietR1uZ3TrlhO30H4CuYdEEC1bwV2Q,866
100
+ examples/_openaisdk/openai_embeddings.py,sha256=edifTqwQb0cljDZD8qRDLfYxchdZEJxksXLaFBdpC60,867
101
101
  examples/_openaisdk/openai_files.py,sha256=gfUbKGZg5P7c3kSMfwalIThi_SEs8O-JTqx49bYFtyM,1505
102
102
  examples/_openaisdk/openai_gitee.py,sha256=TfuvFl6E2MubHJQO4hv-5r80bQUgwUWP1jAtIY9bDaU,870
103
103
  examples/_openaisdk/openai_god.py,sha256=O8fbhyxiIlVR7pTvBTXgQ2QTwfcZ2MkEIyDe_jp797A,1056
@@ -112,7 +112,7 @@ examples/_openaisdk/openai_ppu.py,sha256=cpr__WVlOrm2w1WjRV7v0rux4oiJkaqBnUZImR6
112
112
  examples/_openaisdk/openai_qwen.py,sha256=OzYJbHcTQ-vd81GcOdUAt0TqzA5lr5zkPhhzM7jPHDk,2009
113
113
  examples/_openaisdk/openai_search.py,sha256=HKRTU6y9j_nUfZgrJt2eZ84d7TVT39WN-dcA_BFkVb4,937
114
114
  examples/_openaisdk/openai_sensenova.py,sha256=TnJpHcD1tG5w_x5DsgFgBRWrU8XUkww0uCebgNFfZDM,3216
115
- examples/_openaisdk/openai_siliconflow.py,sha256=A2CMev2Bw5OwEJQNXGXQKrNs0DzlvrV4hvs7D8AsDKM,1386
115
+ examples/_openaisdk/openai_siliconflow.py,sha256=zpbrnKt0nWLJpaxrq_VyjE8-knDRLR7kIzNZxJZUZgs,1387
116
116
  examples/_openaisdk/openai_step.py,sha256=rwXrGRs5CHhWpNl9oeIHltErp1Or_B3PVKNAoMGY-0c,1054
117
117
  examples/_openaisdk/openai_test.py,sha256=gjPveJYkI_MqCePoVZ6kNlEEChRgedE2hzMkN7gZuqI,1909
118
118
  examples/_openaisdk/openai_together.py,sha256=7S52fFp87mJkTJgs0Y39kj1d7flZ93ZN2Usc5_LkEzY,1548
@@ -316,9 +316,12 @@ meutils/apis/niutrans.py,sha256=sbSfzudfGs_sH5YwU2NofKh_mBAPmpFXhB2Vpa09tyM,2270
316
316
  meutils/apis/search_music.py,sha256=HBLtdterztrccnLAPZrWBlrYSx4WCRflCqz-V30fOA8,972
317
317
  meutils/apis/textin.py,sha256=vkl3VI3ox-m-0UA-DBTOCZURAlD9lA7nA-057gJLMoc,4880
318
318
  meutils/apis/ts.py,sha256=Q13EOS9Q-Y2-KwOG_cFMVmGj9RUmDtxk5A3E27dxbN0,1511
319
- meutils/apis/utils.py,sha256=60kNe50UthghRm2ReJtL1ELS5iZ5-bqWjNwFHFN7B0M,1261
319
+ meutils/apis/utils.py,sha256=hwIj67IsuI3255l3rDDHmcwUIlRoK_xLnE6iCvqOi74,2045
320
320
  meutils/apis/web_search.py,sha256=6gS3leIB2iyeLtqhB0IbpL_mKzDgArRTqnR7odTWT3E,1035
321
321
  meutils/apis/yezi.py,sha256=26vhnA3lC5049Rqx-CHO-wyGKbdZAfvjEOG90W38cr0,3675
322
+ meutils/apis/aitools/__init__.py,sha256=USdDfW2JZyUVY8ko54Dwpl801O766bvO_3F1lM4b8Gc,271
323
+ meutils/apis/aitools/baidu/__init__.py,sha256=4fRDQV9EezQDG4bg-WDaB3jOCr_BcSVChHFJ3clvHpY,271
324
+ meutils/apis/aitools/baidu/sdk.py,sha256=5uA1bEqwNYpJirFnwoMTI6Jua3r3DlVNr90RffG9rcs,1132
322
325
  meutils/apis/audio/__init__.py,sha256=y7Rpn90LocHhA0ywrDP_fT4QAK7sr4JsIX5wLJgkNHA,241
323
326
  meutils/apis/audio/deepinfra.py,sha256=O-IpAnHfx25QCjhB5xaIYVBy5AbyPzmVz-Pr40gpnsM,1773
324
327
  meutils/apis/audio/fish.py,sha256=rTRaxXHKYfNNUU3DhXT-S9rTqJAQmww0DiA9ZqhgvO8,8378
@@ -337,6 +340,7 @@ meutils/apis/fal/images.py,sha256=o4kgiLyzhRTBidnkcaEKXjAwd2KdPMTkfCfILnkF_bY,18
337
340
  meutils/apis/fal/images_.py,sha256=C-C1TTQtMJ6RRcd-4FeYPn0R5IpPRPUFmBbrTVs_ypA,1446
338
341
  meutils/apis/fal/videos.py,sha256=FeQI2V8_NjBrpg_c6Xql7DKmOtObIPeCHnDyLE7ijiY,2339
339
342
  meutils/apis/gitee/__init__.py,sha256=rmAktsUvEtk7_F28P5C65wuu00nmrbu5bOw6PiCRTS0,271
343
+ meutils/apis/gitee/色情图片识别.py,sha256=liCftD7sL6Fw4Aq6r1PY-qxsxm5XkgVdDvlDR39lrEU,757
340
344
  meutils/apis/gitee/images/__init__.py,sha256=zvS8e0ogQLqajZTAype1e0TDLJenlfbRQ16FjSYpxbY,243
341
345
  meutils/apis/gitee/images/kolors.py,sha256=IGpDtMiOOPgbE8ZOXFP9-Hh_XNCDkuvNYjKQbXq8Nik,3338
342
346
  meutils/apis/hailuoai/__init__.py,sha256=2g9okuB6pxPh1hDiAE9HZo37baqIO9cX-67RpyfBj1k,272
@@ -360,6 +364,7 @@ meutils/apis/hunyuan/image_tools.py,sha256=o_Q8_-kp4F11bmZ-VA4_wmI_S5xdH8Dw6VIDb
360
364
  meutils/apis/images/__init__.py,sha256=hs7HUJZvw_3DAtoapPnbZsEb4ng1p0a6fJGFFWwUcUk,272
361
365
  meutils/apis/images/deepinfra.py,sha256=lMqfU0LIXEzHiAS31dCcoTnPIE6tpoDJhq61H0TVJPg,3219
362
366
  meutils/apis/images/demo.py,sha256=Cjk-EKMKbp44czykW_44qR0TzElX8nNCALqXBBw5sJA,4405
367
+ meutils/apis/images/edits.py,sha256=CiTntcN_Idmk0sbvyvxRZmZkaZY8rLAR7d0ck74PZTw,5717
363
368
  meutils/apis/images/eidt.py,sha256=42dCdGPSLvr0zh8OZtwQxi-5B6Ln_o_FsL1gt2Ura_k,750
364
369
  meutils/apis/images/recraft.py,sha256=ie9_xFGaDnS0yUryJxIqZ-RHJe3VPlNG2vw06vvCg7g,59527
365
370
  meutils/apis/images/flux/__init__.py,sha256=W_PZabQm6EmtJYmzEiEpL_WCXTAW0AiJ-t_n5UTrE8c,271
@@ -427,11 +432,11 @@ meutils/apis/search/n.py,sha256=o7jzNoR5v_nAjgdUvWgebL3nvvo3ECpq2KCj9YhUNr4,4337
427
432
  meutils/apis/search/searxng.py,sha256=RBPeq-AYj5D42gROrZNg0SxIWwWEW0oqrbQ3wEDH9k8,951
428
433
  meutils/apis/siliconflow/__init__.py,sha256=DQ-A6wAWGna49pmyGhcIWgc2zx6TN9DfQmSUdAW7qjk,241
429
434
  meutils/apis/siliconflow/audio.py,sha256=pk1OROATtAURPQ6VkswmR5gJFOFYJJPnjp-boDAf8X0,2017
430
- meutils/apis/siliconflow/image_to_image.py,sha256=Clk-2hACzoUP0yTHnxhlV5MA_HsVdcPuhrX41YARWPM,89439
435
+ meutils/apis/siliconflow/image_to_image.py,sha256=EnoT8p2IS35XGZ0ivFKTBII3b_iIG9NR_Ae2nOA-orc,89442
431
436
  meutils/apis/siliconflow/images.py,sha256=rmlO90_7Lly-m2cKNOJiLUeNKD13ClppYdofrnGgUmY,6137
432
437
  meutils/apis/siliconflow/rerankers.py,sha256=GuKT33MmAiVULqNaAO9IIy1Zp570-kYJ6xP03eLCp5Y,1259
433
- meutils/apis/siliconflow/text_to_image.py,sha256=rDxk6NIj4TjigcSPVDZknQR9nUpK5CTJBXc3KjI1Z8Y,4457
434
- meutils/apis/siliconflow/utils.py,sha256=Awe0V7Mkceop1vWWrw9901cKQ6HHntIn8HbIG0fEo40,2091
438
+ meutils/apis/siliconflow/text_to_image.py,sha256=ZSyvCF_CfH6pV4BXM4TJjmQiu2x4nF197GliDddWI8Q,4458
439
+ meutils/apis/siliconflow/utils.py,sha256=uPpJVgqVmTzTN0LuHWliTWaf1rzneNyA-mELwwrUbdQ,2092
435
440
  meutils/apis/siliconflow/videos.py,sha256=sYBxrrI5zMr_4_VXDFpjjiISlJNH4o6eIuZgaDnxvB4,3488
436
441
  meutils/apis/sunoai/__init__.py,sha256=O8J8jKTmvZGGovkF_jCRl3vbL68a4_dXVSxiKIYTkFo,244
437
442
  meutils/apis/sunoai/haimian.py,sha256=CSISElYbbGFnVCxCgAbHM_YZ9ELUjhuFQ6jdYM0hh7E,5521
@@ -455,8 +460,7 @@ meutils/apis/uptime_kuma/国产分组.py,sha256=OIiUUFfjWEEJHg5fr8Vf5xSBWkbXboQ4
455
460
  meutils/apis/videos/__init__.py,sha256=OCykr_XRIOH18Xh5hfBq5yMxbk8e9Myk4KuAtrtgAWw,272
456
461
  meutils/apis/videos/sora.py,sha256=G3wGlvTYl4YfG20L2HXPhmhZ4HwrlIFSU-KYM-TdALg,295
457
462
  meutils/apis/vidu/__init__.py,sha256=8nQN-RiZGJlZaZGVFbtHgK57_Ml5g_vFCiOImWwBm0I,242
458
- meutils/apis/vidu/vidu_video.py,sha256=gstOriwTLUS6tOsNDsaieKSHz_pa8vbI7WVIYA-1Iz4,17504
459
- meutils/apis/vidu/x.py,sha256=UD1QlAQTtLgFiDfWYVxM-1ppfrX_LaVYASk2yNviMuk,322
463
+ meutils/apis/vidu/vidu_video.py,sha256=ivK5r_ciHrSvkR3GnNLW_h5jWMSbZsueB4LHaNrg85s,17570
460
464
  meutils/apis/voice_clone/__init__.py,sha256=y7Rpn90LocHhA0ywrDP_fT4QAK7sr4JsIX5wLJgkNHA,241
461
465
  meutils/apis/voice_clone/fish.py,sha256=6m8zcS2KEqmalKy2ArnOaNovyxsQp_sw4d_O1kVZR2s,7146
462
466
  meutils/apis/voice_clone/fish_api.py,sha256=pDpE-B8HFiGIOV3NVd1HmFrCC2GQc3wH-81oNbTS0mY,307
@@ -506,7 +510,7 @@ meutils/config_utils/lark_utils/demo.py,sha256=3g0Fs7oLaeW75T60gYWMLgyNg1OnfOjfH
506
510
  meutils/config_utils/lark_utils/x.py,sha256=MlMQGhehP9xMEgetxVCX68XFaosfKoW1JA5cZ3JqN2w,1857
507
511
  meutils/crawlers/__init__.py,sha256=TBU4xA-IOsHV-0yIkW7YXxn_QT7TT8NncqxO7IykEfs,271
508
512
  meutils/data/SimHei.ttf,sha256=-XEnekS5yHP_URkT4XBI2w22ylV-KxudhkeIYFbrILA,10062565
509
- meutils/data/VERSION,sha256=PLJoHDonB9mciV-BE2NeEV_k04tS9dB6Du7Am4v7Y_A,19
513
+ meutils/data/VERSION,sha256=FtmNOxclMgJ_9cZqxqfa7xoOfEs7rbYm_rn7YgWz-Rs,19
510
514
  meutils/data/_FLAG,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
511
515
  meutils/data/_SUCCESS,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
512
516
  meutils/data/__init__.py,sha256=Hfwkkxs4zHqKhxht0YrhS566a9P5axtmgNvM5wF8ceQ,243
@@ -549,14 +553,14 @@ meutils/init/__init__.py,sha256=J_ApVNdTQAHsIfSLrMRZhwJ8rdgiOfeyiXGSymvZSng,242
549
553
  meutils/init/evn.py,sha256=GPw9Un8YbgYJmjwd-uYWQ8JeVr6pRxwyYbDv3W8fb1s,1588
550
554
  meutils/init/oo.py,sha256=jXWaCWWFYVPGgTIas47Z3J7sIq-CD7DyK6fKDBsq8GA,12884
551
555
  meutils/io/__init__.py,sha256=uW43ZfdWu7adRvwvcTzUGtn4CseRmbzEJdlZV-oqHEA,2107
552
- meutils/io/files_utils.py,sha256=Hnsfa4mmxWVRejULD9JGCiUJCRs2WGFZUGlxnnI5B8Q,7249
556
+ meutils/io/files_utils.py,sha256=FWOLY579zA_SlFa0A47ArXrfIhZu9fUQbq0wEssbvHc,7308
553
557
  meutils/io/image.py,sha256=BJmYzx7o66X7C32gOfVmfr5tBRXOi0IYQY7BpGLsGrg,6926
554
558
  meutils/io/minio_utils.py,sha256=i1YuxwDJzLse0smMXuPqnD1wirBBb8psmB_kd1oPoVU,1274
555
559
  meutils/io/tf_io.py,sha256=vEZZS4pCf4Dt3A-FtIVMfhC3FJUUpQCK2OoEvXrBWos,8605
556
560
  meutils/io/x.py,sha256=NyDhVhZ9poPPxaK-W5G8qWAnxjZ5NEz-kv32tK8qNvA,2665
557
561
  meutils/llm/__init__.py,sha256=mYv0QpACLd-wz4htIduPuTU3mX06_Y8ZprxDohtZGBM,244
558
- meutils/llm/check_api.py,sha256=Vlan35FGvjPLP-dZu_Gfgmki-G89YPV96-x1oXji79I,3566
559
- meutils/llm/check_utils.py,sha256=wA7mHaWEqcN-GBeoqUw2ee_54G-Bht-m1opqZkAEFss,3354
562
+ meutils/llm/check_api.py,sha256=sgxfMWM0fe3nNpv_lLR7kFgsWaowcm1cQlsbp7qZSKM,3567
563
+ meutils/llm/check_utils.py,sha256=o5SAsjIuTK_p8ARZgjeyJiapVz3Ox_A6UdNbVACmpGw,3355
560
564
  meutils/llm/clients.py,sha256=G84smYHMrhZhUhKTVGb3FcbI8serRxmXmbp57pGZDkw,1118
561
565
  meutils/llm/demo.py,sha256=gyGjTxuNFMOa1X4CXaChkq0lcjbKiRsnSRhkeMvsoQk,3822
562
566
  meutils/llm/mappers.py,sha256=ZQLl3OuD06kVMP8bwIpVgAB1UVzMJWUJiZ3vgk-ZjeI,303
@@ -569,6 +573,7 @@ meutils/llm/completions/dify.py,sha256=dqL_8uxAp2d8M00pkyh2I30tflwi4pUyX-V6pwe3_
569
573
  meutils/llm/completions/kimi.py,sha256=TSkLObebIAb_oivOMq3aKx9qoXcMy611_g2yIKex9eo,1541
570
574
  meutils/llm/completions/modelscope.py,sha256=umPlJuHSL2RR0oNdTIAqts8iqEmGp_MR6Vh49g-UZuc,271
571
575
  meutils/llm/completions/oi.py,sha256=DmvzxJfdLA_I3MWcULhFtiUdo90j7V2dLvYvmZ-Tm9U,293
576
+ meutils/llm/completions/qwenllm.py,sha256=2lmYbIW1qyWkDGuw_gXuSIN5In-2ilobPpiQKm_DQ6M,1639
572
577
  meutils/llm/completions/rag.py,sha256=cpQ1aZX2QI1QDfFpODTxWHPYglK6_3qrlUM_KHLBNhc,1112
573
578
  meutils/llm/completions/tryblend.py,sha256=NfVRktn1QiE2k60PzEI-LmKuxZCc7mtL_KlsrVcZg4k,8957
574
579
  meutils/llm/completions/tune.py,sha256=FypfUgsB34t-E9xI6WydJYEk_-phscrLOX1iUCeKb_E,10138
@@ -583,7 +588,7 @@ meutils/llm/completions/rag/qwen.py,sha256=1dBNLLbQDRsM-7EGaStcWFU8HRa-rp3RxJ9cp
583
588
  meutils/llm/completions/rag/rag.py,sha256=mnC4bZUMuNYuPFXMBqXMofj_ms8uP5MMw1leJ5jXA_k,1209
584
589
  meutils/llm/functions/__init__.py,sha256=It6pcNwRBSh3Em45ooi61lc5tFg8eOYv0BvEFuRjSGQ,271
585
590
  meutils/llm/openai_utils/__init__.py,sha256=MWyNhP2K49oaHGEZlInZc3XlwqlStFultP8k7HDPAwk,290
586
- meutils/llm/openai_utils/common.py,sha256=ySMfEfo2qjUvH1jIaH7L_3MZ37FLy3TXOz41jWYuCDA,9288
591
+ meutils/llm/openai_utils/common.py,sha256=RRoyMfXqOo6GG4UZvwCIaUA0kbzY_O1tjL7Oq4Mlidk,9398
587
592
  meutils/llm/openai_utils/tool_outputs.py,sha256=6mNkm4btgy0uzF98gdmcah1bYmoflXdLz2Sqm0KC_LQ,1224
588
593
  meutils/llm/output_parsers/__init__.py,sha256=EGKvgUD47ReyV5Z9RXDCrdDLgfKMHdoayzsXVmBuQxw,3474
589
594
  meutils/llm/prompts/__init__.py,sha256=VlEEViFoUSRS0EF1rHJXHh9Ik9FpvAiR1luKjHOsUc4,8580
@@ -693,12 +698,12 @@ meutils/schemas/fish_types.py,sha256=yC0ZFr3Ebh8F0OhtMsXYaIfNNvzOM2LT9YtKTaRoHGU
693
698
  meutils/schemas/hailuo_types.py,sha256=G9LsZFC1MGrDj9YcmmeQQWVdL5yTEptduEbHXdx-0IQ,6343
694
699
  meutils/schemas/haimian_types.py,sha256=jGu484UviAeBgy5OIUyRY4uYCxXfv16zDPqiJQr9wNQ,1364
695
700
  meutils/schemas/idphoto_types.py,sha256=nuHbpppejRSkJCiQ7YKx0Gnke0ShKZhOvdg0e7tk9-0,1074
696
- meutils/schemas/image_types.py,sha256=LmVJraGNpcoBff7PruOyU0WDWrdqbaPIVcOsbT4yVrI,12378
701
+ meutils/schemas/image_types.py,sha256=pFeN4mn2fN8opSPPyOb2I5NJ0vtPKv4w851opvAi_H0,12776
697
702
  meutils/schemas/jimeng_types.py,sha256=qsjtyURGsGnAGAhfZ9k4k-mtbRgjbWId75UMV1d6AiE,851
698
703
  meutils/schemas/jina_types.py,sha256=SLRRBCap2B1uXnHF7Sgnlz1Work8HvdIltjj4oVlGTk,8826
699
704
  meutils/schemas/kimi_types.py,sha256=PjCgHwCDNzKasn4X6rUzvOENqKYT3xj07cgp71IdsDA,3607
700
705
  meutils/schemas/kling_types.py,sha256=brWaREBtQeZGUuwgOW2p-vIm2WWInYkq8UfrLInT-Ik,6959
701
- meutils/schemas/kuaishou_types.py,sha256=7Si0atIUcYt_lkPpmJUo_NSMEAfB5jAwWC74-pjIVaQ,10896
706
+ meutils/schemas/kuaishou_types.py,sha256=-_-0Fkab5jyJFb_2Y4ugi92JSIDlvWL_e8mH-wMQ6TE,10896
702
707
  meutils/schemas/luma_types.py,sha256=s9RZnZUpdUg8-13_WOWm3bE_e246olplFFjP8ygiDuw,1900
703
708
  meutils/schemas/message_types.py,sha256=AJc9ZT_weaTjfjmwF5CDroV0WJEJKnA3u4bnbHhBamo,6176
704
709
  meutils/schemas/message_types_.py,sha256=oL7uOsewaziSryZywfap09M5Wh9w28RJDuadFuAfCSI,6297
@@ -713,7 +718,7 @@ meutils/schemas/prodia_types.py,sha256=knh_lzAxMfWMoqAPmvyMweay9PmQmsoQ1X6Mj17oh
713
718
  meutils/schemas/replicate_types.py,sha256=Todfo-y2Gq1MW8IyEmzz_ZlTxuQ3PvIfiF0KkrmJaYw,3160
714
719
  meutils/schemas/request_types.py,sha256=GP2radX2Ixjbu8NDKihUsrSOft6WgcFYd7LXxM4mPY0,407
715
720
  meutils/schemas/runwayml_types.py,sha256=q6g00kg1PYCDjpw-notgbcUGwRAlIa8kAmU52ZuXyLQ,6128
716
- meutils/schemas/siliconflow_types.py,sha256=a8SOf-bh5ZBddqsCqJNPFfw9olxk-bD_ySqTr8d0aZw,8597
721
+ meutils/schemas/siliconflow_types.py,sha256=CpWrCUaUcajC-AWB9-rApYiCPisnmc4IqvXVR0ZfO1k,8598
717
722
  meutils/schemas/step_types.py,sha256=nGTPXZ7RwOF2RTsPBQguLLcIaBxHs4bsZkYa_LalcJ0,648
718
723
  meutils/schemas/suno_types.py,sha256=KTdcwaJNDUFiY8izVJSZdGZgEMb0OhdiRR_dJVN-Cz0,14967
719
724
  meutils/schemas/task_types.py,sha256=iLIUIfD5fv3_ByQVhSq-p4Wv65yMtVbNwFievRfTsbI,4571
@@ -856,9 +861,9 @@ meutils/tools/seize.py,sha256=nOKAS63w-Lbi48I0m2MPhdsokUTwxco0laPxYVmW4Mw,1064
856
861
  meutils/tools/service_monitor.py,sha256=ibsLtBN2g2DL7ZnLJ8vhiZOiOcqTAyx711djDdBK-3M,1255
857
862
  meutils/tools/sys_monitor.py,sha256=6MoyzrItqDUOSjfHcMJmMofQkEPTW36CT_aKui0rg84,429
858
863
  meutils/tools/token_monitor.py,sha256=Np-YK-R4P4IPAXyZvMxwvXI4sFmNJQAQK1lSegNaYpA,997
859
- MeUtils-2025.1.16.17.15.52.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
860
- MeUtils-2025.1.16.17.15.52.dist-info/METADATA,sha256=LoAyMbL4ysQK28h-PHa4gnvaxKeUzsqWc3fgYShxEvY,6202
861
- MeUtils-2025.1.16.17.15.52.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
862
- MeUtils-2025.1.16.17.15.52.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
863
- MeUtils-2025.1.16.17.15.52.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
864
- MeUtils-2025.1.16.17.15.52.dist-info/RECORD,,
864
+ MeUtils-2025.1.17.17.55.21.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
865
+ MeUtils-2025.1.17.17.55.21.dist-info/METADATA,sha256=YxDjZUou_b_kD9vkXJBs_PoJI10DqhM2hn0lyXQLp7c,6202
866
+ MeUtils-2025.1.17.17.55.21.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
867
+ MeUtils-2025.1.17.17.55.21.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
868
+ MeUtils-2025.1.17.17.55.21.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
869
+ MeUtils-2025.1.17.17.55.21.dist-info/RECORD,,
@@ -17,7 +17,7 @@ client = OpenAI(
17
17
  api_key=os.getenv("OPENAI_API_KEY_OPENAI"),
18
18
  # api_key=os.getenv("SILICONFLOW_API_KEY"),
19
19
  # # api_key="sk-gcxjtocodgggxwnhqqsaqznpkpxndktwlgmgkmzljyajjsfp",
20
- # base_url="https://api.siliconflow.cn/v1",
20
+ # base_url="https://api.siliconflow.com/v1",
21
21
 
22
22
  # base_url="https://api.bltcy.ai/v1"
23
23
  )
@@ -14,7 +14,7 @@ from openai import OpenAI
14
14
  client = OpenAI(
15
15
  api_key=os.getenv("SILICONFLOW_API_KEY"),
16
16
  # api_key="sk-zhvfnyebjcrylrwwzecxcbolwdsitqfwjqzxeysqhprdsjbm",
17
- base_url="https://api.siliconflow.cn/v1",
17
+ base_url="https://api.siliconflow.com/v1",
18
18
  )
19
19
 
20
20
  # print(client.models.list())
@@ -1,14 +1,11 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding: utf-8 -*-
3
3
  # @Project : AI. @by PyCharm
4
- # @File : x
5
- # @Time : 2024/9/25 10:42
4
+ # @File : __init__.py
5
+ # @Time : 2025/1/17 10:44
6
6
  # @Author : betterme
7
7
  # @WeChat : meutils
8
8
  # @Software : PyCharm
9
9
  # @Description :
10
10
 
11
11
  from meutils.pipe import *
12
- from meutils.hash_utils import md5
13
-
14
- # md5("8daf5c4765c493e2")
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : __init__.py
5
+ # @Time : 2025/1/17 10:54
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : sdk
5
+ # @Time : 2025/1/17 10:54
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
12
+
13
+
14
+ client_id = "6e4ca6247dea4186a09fc64362f72e51"
15
+ client_secret = "114d33c9-079b-2684-f93a-e6a1031260e1"
16
+
17
+ # BAIDU_AI=38243958:ayIjRRUv3MNNpss9r4YkCIKF:NqcBofQtvdAWKtiGAMjIkASWNxCKW8Fv # 25308860:GmAPqlyBDNLaoAqO2mrFhjS2:vXIoxFUdx2jiuRnGLvZSDMEczEaZsc1K
18
+
19
+ # DZjHpNLUauqYNFgpNujNhH5p 0p3XGiy0Y7troeGukFiEnlRMsq5smw9W
20
+ def main(client_id, client_secret):
21
+ url = f"https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}"
22
+
23
+ payload = ""
24
+ headers = {
25
+ 'Content-Type': 'application/json',
26
+ 'Accept': 'application/json'
27
+ }
28
+
29
+ response = requests.request("POST", url, headers=headers, data=payload)
30
+
31
+ print(response.text)
32
+
33
+
34
+ if __name__ == '__main__':
35
+ client_id="DZjHpNLUauqYNFgpNujNhH5p"
36
+ client_secret = "0p3XGiy0Y7troeGukFiEnlRMsq5smw9W"
37
+ main(client_id, client_secret)
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : x
5
+ # @Time : 2024/9/25 10:42
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description : https://ai.gitee.com/hf-models/giacomoarienti/nsfw-classifier/api
10
+
11
+ from meutils.pipe import *
12
+ from meutils.hash_utils import md5
13
+
14
+ # md5("8daf5c4765c493e2")
15
+ from openai import OpenAI
16
+
17
+ client = OpenAI(
18
+ base_url="https://ai.gitee.com/v1",
19
+ api_key="WPCSA3ZYD8KBQQ2ZKTAPVUA059J2Q47TLWGB2ZMQ",
20
+ default_headers={"X-Package":"1910"},
21
+ )
22
+
23
+ response = client.moderations.create(
24
+ model="nsfw-classifier",
25
+ input=[
26
+ {
27
+ "type": "image_url",
28
+ "image_url": {
29
+ "url": "https://oss.ffire.cc/files/kling_watermark.png"
30
+ }
31
+ }
32
+ ],
33
+ )
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : image_tools
5
+ # @Time : 2024/8/28 13:17
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
12
+ from meutils.config_utils.lark_utils import get_next_token_for_polling
13
+ from meutils.schemas.image_types import ImageRequest, ImagesResponse
14
+ from meutils.schemas.image_types import ImageProcess
15
+
16
+ from meutils.io.files_utils import to_bytes, to_base64, to_url_fal
17
+
18
+ from meutils.notice.feishu import send_message as _send_message
19
+
20
+ BASE_URL = "https://image.baidu.com"
21
+
22
+ FEISHU_URL = "https://xchatllm.feishu.cn/sheets/GYCHsvI4qhnDPNtI4VPcdw2knEd?sheet=jrWhAS"
23
+
24
+ send_message = partial(
25
+ _send_message,
26
+ title=__name__,
27
+ url="https://open.feishu.cn/open-apis/bot/v2/hook/dc1eda96-348e-4cb5-9c7c-2d87d584ca18"
28
+ )
29
+
30
+
31
+ async def make_request_for_gitee(payload, token: Optional[str] = None, response_format: str = "url"):
32
+ s = time.time()
33
+ feishu_url = "https://xchatllm.feishu.cn/sheets/MekfsfVuohfUf1tsWV0cCvTmn3c?sheet=PDnO6X"
34
+ token = token or await get_next_token_for_polling(feishu_url)
35
+
36
+ headers = {
37
+ "Authorization": f"Bearer {token}",
38
+ "X-Failover-Enabled": "true",
39
+ "X-Package": "1910"
40
+ }
41
+
42
+ files = {
43
+ "image": ("_.png", payload.pop('image'))
44
+ }
45
+ base_url = "https://ai.gitee.com/v1"
46
+ async with httpx.AsyncClient(base_url=base_url, headers=headers, timeout=60) as client:
47
+ response = await client.post("/images/mattings", data=payload, files=files)
48
+ response.raise_for_status()
49
+ response = ImagesResponse(**response.json())
50
+ if response_format == "url":
51
+ url = await to_url_fal(response.data[0].b64_json, content_type="image/png")
52
+ response.data[0].url = url
53
+ response.data[0].b64_json = None
54
+ response.timings = {"inference": time.time() - s}
55
+
56
+ return response
57
+
58
+
59
+ async def make_request_for_baidu(payload, token: Optional[str] = None, response_format: str = "url"):
60
+ s = time.time()
61
+ token = token or await get_next_token_for_polling(feishu_url=FEISHU_URL, from_redis=True)
62
+ headers = {
63
+ 'Cookie': token,
64
+ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
65
+ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
66
+ }
67
+ async with httpx.AsyncClient(base_url=BASE_URL, headers=headers, timeout=60) as client:
68
+ response = await client.post("/aigc/pccreate", data=payload) # pcEditTaskid
69
+ response.raise_for_status()
70
+ data = response.json()
71
+
72
+ logger.debug(data)
73
+
74
+ image_base64 = None
75
+ if task_id := data.get("pcEditTaskid"):
76
+ for i in range(30):
77
+ await asyncio.sleep(3)
78
+ try:
79
+ response = await client.get(f'/aigc/pcquery?taskId={task_id}')
80
+ if data := response.json().get("picArr", []):
81
+ image_base64 = data[0].get("src")
82
+ break
83
+ except Exception as e:
84
+ logger.error(e)
85
+ if i > 3: break
86
+
87
+ if response_format == "url":
88
+ url = await to_url_fal(image_base64, content_type="image/png")
89
+ return ImagesResponse(data=[{"url": url}], timings={"inference": time.time() - s})
90
+ else:
91
+ return ImagesResponse(data=[{"b64_json": image_base64}], timings={"inference": time.time() - s})
92
+
93
+
94
+ async def edit_image(request: ImageProcess):
95
+ image, mask = await asyncio.gather(to_base64(request.image), to_base64(request.mask))
96
+ payload = {
97
+ "type": "1", # 去水印
98
+
99
+ "picInfo": image,
100
+ "picInfo2": mask,
101
+ # "original_url": "", # 更快但是会有错误
102
+ }
103
+
104
+ if request.model == "remove-watermark":
105
+ if mask:
106
+ payload['type'] = "2"
107
+ return await make_request_for_baidu(payload)
108
+
109
+ elif request.model == "clarity":
110
+ payload['type'] = "3"
111
+ return await make_request_for_baidu(payload)
112
+
113
+ elif request.model == "expand":
114
+ payload['type'] = "4"
115
+ payload['ext_ratio'] = request.aspect_ratio
116
+ return await make_request_for_baidu(payload)
117
+ ################################################################################################
118
+
119
+ elif request.model == "rmbg-2.0":
120
+ payload = {
121
+ "model": request.model,
122
+ "image": await to_bytes(image),
123
+ }
124
+ return await make_request_for_gitee(payload, response_format=request.response_format)
125
+
126
+
127
+ if __name__ == '__main__':
128
+ token = "BAIDUID=FF8BB4BF861992E2BF4A585A37366236:FG=1; BAIDUID_BFESS=FF8BB4BF861992E2BF4A585A37366236:FG=1; BIDUPSID=FF8BB4BF861992E2BF4A585A37366236; BDRCVFR[dG2JNJb_ajR]=mk3SLVN4HKm; userFrom=null; ab_sr=1.0.1_NjY5OWZiZDg5YTJmYTQzNWUyNzU1YjBmN2FlMDFiNjMyOTVhMDE3ZWVlYWY5N2Y2MTg4NGI1MzRmMmVjMjQyZjlhZTU2MmM1NDRlMmU4YzgwMzRiMjUyYTc4ZjY1OTcxZTE4OTA4YTlmMWIwZWUzNTdiMzlhZTRiM2IzYTQ0MjgyMzc2MjQwMGRlYzZlZDhjOTg5Yzg4NWVjMTNiZmVmZQ==; BDRCVFR[-pGxjrCMryR]=mk3SLVN4HKm; H_WISE_SIDS=60273_60360_60623_60664_60678_60684_60700"
129
+
130
+ url = "https://oss.ffire.cc/files/kling_watermark.png"
131
+ # url = "https://s22-def.ap4r.com/bs2/upload-ylab-stunt-sgp/se/ai_portal_sgp_queue_mmu_txt2img_aiweb/9c520b80-efc2-4321-8f0e-f1d34d483ddd/1.png"
132
+
133
+ request = ImageProcess(
134
+ model="remove-watermark",
135
+ # model="clarity",
136
+ # model="expand",
137
+ # model="rmbg-2.0",
138
+
139
+ image=url,
140
+ # mask=url,
141
+
142
+ # response_format="b64_json"
143
+ )
144
+ arun(edit_image(request))
145
+
146
+ # arun(image_edit(request))
@@ -23,7 +23,7 @@ BASE_URL = "https://cloud.siliconflow.cn"
23
23
  FEISHU_URL = "https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=InxiCF"
24
24
  FEISHU_URL_TOKEN = "https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=xlvlrH"
25
25
 
26
- url = "https://api.siliconflow.cn/v1/TencentARC/PhotoMaker/image-to-image"
26
+ url = "https://api.siliconflow.com/v1/TencentARC/PhotoMaker/image-to-image"
27
27
 
28
28
  PHOTOMAKER_STYLES = {
29
29
  "Photographic (Default)",
@@ -83,8 +83,8 @@ async def create(request: ImageRequest, api_key: Optional[str] = None): # SD3
83
83
  headers = {
84
84
  "Authorization": f"Bearer {api_key}",
85
85
  }
86
- base_url = "https://api.siliconflow.cn/v1"
87
- url = "https://api.siliconflow.cn/v1/TencentARC/PhotoMaker/image-to-image"
86
+ base_url = "https://api.siliconflow.com/v1"
87
+ url = "https://api.siliconflow.com/v1/TencentARC/PhotoMaker/image-to-image"
88
88
 
89
89
  async with httpx.AsyncClient(base_url=base_url, headers=headers, timeout=100) as client:
90
90
  response = await client.post(f"/{request.model}/image-to-image", json=payload)
@@ -17,7 +17,7 @@ from meutils.schemas.translator_types import DeeplxRequest
17
17
  from meutils.decorators.retry import retrying
18
18
  from meutils.schemas.image_types import ASPECT_RATIOS
19
19
 
20
- BASE_URL = "https://api.siliconflow.cn/v1"
20
+ BASE_URL = "https://api.siliconflow.com/v1"
21
21
  FEISHU_URL = "https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=InxiCF"
22
22
  FEISHU_URL_TOKEN = "https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=xlvlrH"
23
23
 
@@ -12,7 +12,7 @@ import os
12
12
  from meutils.pipe import *
13
13
  from meutils.decorators.retry import retrying
14
14
 
15
- url = "https://api.siliconflow.cn/v1/user/info"
15
+ url = "https://api.siliconflow.com/v1/user/info"
16
16
 
17
17
 
18
18
  # todo: 付费不付费模型优化
meutils/apis/utils.py CHANGED
@@ -22,8 +22,10 @@ async def make_request(
22
22
 
23
23
  method: str = "GET",
24
24
  headers: Optional[dict] = None,
25
- payload: Optional[dict] = None,
25
+
26
26
  params: Optional[dict] = None,
27
+ payload: Optional[dict] = None,
28
+ files: Optional[dict] = None,
27
29
 
28
30
  ):
29
31
  client = AsyncClient(base_url=base_url, api_key=api_key, default_headers=headers)
@@ -32,16 +34,40 @@ async def make_request(
32
34
  if params:
33
35
  options["params"] = params
34
36
 
35
- if method == 'GET':
37
+ if method.upper() == 'GET':
36
38
  response = await client.get(path, options=options, cast_to=object)
37
39
  return response
38
- elif method == 'POST':
39
- response = await client.post(path, body=payload, options=options, cast_to=object)
40
+ elif method.upper() == 'POST':
41
+ response = await client.post(path, body=payload, options=options, files=files, cast_to=object)
40
42
  return response
41
43
 
42
44
 
43
45
  if __name__ == '__main__':
46
+ from meutils.io.files_utils import to_bytes
47
+
44
48
  base_url = "https://api.chatfire.cn/tasks/kling-57751135"
45
49
  base_url = "https://httpbin.org"
46
50
 
47
51
  arun(make_request(base_url=base_url, path='/ip'))
52
+
53
+ base_url = "https://ai.gitee.com/v1"
54
+ path = "/images/mattings"
55
+ headers = {
56
+ "Authorization": "Bearer WPCSA3ZYD8KBQQ2ZKTAPVUA059J2Q47TLWGB2ZMQ",
57
+ "X-Package": "1910"
58
+ }
59
+ payload = {
60
+ "model": "RMBG-2.0",
61
+ "image": "path/to/image.png"
62
+ }
63
+ files = {
64
+ "image": ('path/to/image.png', to_bytes("https://oss.ffire.cc/files/kling_watermark.png"))
65
+ }
66
+
67
+ arun(make_request(base_url=base_url,
68
+ path=path,
69
+ method="post",
70
+ files=files,
71
+ payload=payload,
72
+
73
+ api_key="WPCSA3ZYD8KBQQ2ZKTAPVUA059J2Q47TLWGB2ZMQ"))
@@ -7,6 +7,8 @@
7
7
  # @WeChat : meutils
8
8
  # @Software : PyCharm
9
9
  # @Description : todo 测试 https://oss-shanghai.sanwubeixin.cn/ios/110580373/20241126133701.png
10
+ # https://www.capitalonline.net/zh-cn/support/openapi/index.html
11
+
10
12
  import asyncio
11
13
 
12
14
  from meutils.pipe import *
meutils/data/VERSION CHANGED
@@ -1 +1 @@
1
- 2025.01.16.17.15.52
1
+ 2025.01.17.17.55.21
meutils/io/files_utils.py CHANGED
@@ -161,7 +161,9 @@ async def to_url(
161
161
  logger.error(e)
162
162
 
163
163
 
164
- async def to_base64(file: Union[UploadFile, str, bytes]):
164
+ async def to_base64(file: Union[UploadFile, str, bytes, list]):
165
+ if not file: return
166
+
165
167
  _ = base64.b64encode(await to_bytes(file)).decode('utf-8')
166
168
  return _
167
169
 
@@ -216,7 +218,9 @@ if __name__ == '__main__':
216
218
 
217
219
  file = Path("/Users/betterme/PycharmProjects/AI/MeUtils/meutils/io/x.py").read_bytes()
218
220
 
219
- arun(to_url_fal([file] * 10))
221
+ # arun(to_url_fal([file] * 10))
222
+
223
+ arun(to_bytes(None))
220
224
 
221
225
  # print(mimetypes.guess_type("x.jpg"))
222
226
  # print(mimetypes.guess_type("x.png"))
meutils/llm/check_api.py CHANGED
@@ -96,7 +96,7 @@ if __name__ == '__main__':
96
96
  #
97
97
  # api_keys = os.getenv("SILICONFLOW_API_KEY").split()
98
98
  # for api_key in api_keys:
99
- # arun(check(api_key, "https://api.siliconflow.cn/v1/user/info"))
99
+ # arun(check(api_key, "https://api.siliconflow.com/v1/user/info"))
100
100
 
101
101
  # api_keys = get_spreadsheet_values(feishu_url="https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=EOZuBW", to_dataframe=True)[0].tolist()
102
102
 
@@ -33,7 +33,7 @@ async def check_token_for_siliconflow(api_key, threshold: float = 0):
33
33
  }
34
34
  try:
35
35
  async with httpx.AsyncClient(headers=headers, timeout=60) as client:
36
- response: httpx.Response = await client.get("https://api.siliconflow.cn/v1/user/info")
36
+ response: httpx.Response = await client.get("https://api.siliconflow.com/v1/user/info")
37
37
  response.raise_for_status()
38
38
 
39
39
  logger.debug(response.text)
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : qwen
5
+ # @Time : 2025/1/17 16:45
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
12
+ from meutils.llm.clients import AsyncOpenAI
13
+ from meutils.llm.openai_utils import to_openai_params
14
+
15
+ from meutils.config_utils.lark_utils import get_next_token_for_polling
16
+ from meutils.schemas.openai_types import chat_completion, chat_completion_chunk, ChatCompletionRequest, CompletionUsage
17
+
18
+ FEISHU_URL = "https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=PP1PGr"
19
+
20
+ base_url = "https://chat.qwenlm.ai/api"
21
+
22
+
23
+ async def create(request: ChatCompletionRequest):
24
+ token = await get_next_token_for_polling(feishu_url=FEISHU_URL)
25
+
26
+ client = AsyncOpenAI(base_url=base_url, api_key=token)
27
+ data = to_openai_params(request)
28
+
29
+ if request.stream:
30
+ _chunk = ""
31
+ async for chunk in await client.chat.completions.create(**data):
32
+ chunk = chunk.choices[0].delta.content or ""
33
+ yield chunk.removeprefix(_chunk)
34
+ _chunk = chunk
35
+
36
+ else:
37
+ response = await client.chat.completions.create(**data)
38
+ yield response.choices[0].message.content
39
+
40
+
41
+ if __name__ == '__main__':
42
+ request = ChatCompletionRequest(
43
+ # model="qwen-turbo-2024-11-01",
44
+ # model="claude-3-5-sonnet-20241022",
45
+ model="qwen-plus-latest",
46
+
47
+ messages=[
48
+ {
49
+ 'role': 'user',
50
+ 'content': 'hi'
51
+ },
52
+
53
+ ],
54
+ stream=False,
55
+ )
56
+ arun(create(request))
@@ -169,7 +169,7 @@ def create_chat_completion(
169
169
  redirect_model: str = '',
170
170
  chat_id: Optional[str] = None
171
171
  ):
172
- if isinstance(completion, Iterable):
172
+ if isinstance(completion, Iterable): # ChatCompletion
173
173
  completion = ''.join(completion)
174
174
 
175
175
  chat_completion.choices[0].message.content = completion
@@ -191,7 +191,7 @@ async def create_chat_completion_chunk(
191
191
  redirect_model: str = ' ',
192
192
  chat_id: Optional[str] = None
193
193
  ):
194
- """
194
+ """ todo: 替换 前缀
195
195
  async def main():
196
196
  data = {}
197
197
  _ = AsyncOpenAI().chat.completions.create(**data)
@@ -206,11 +206,11 @@ async def create_chat_completion_chunk(
206
206
  completion_chunks = await completion_chunks
207
207
  # logger.debug(type(completion_chunks))
208
208
 
209
+ chat_completion_chunk.id = chat_id or f"chatcmpl-{shortuuid.random()}"
210
+ chat_completion_chunk_stop.id = chat_completion_chunk.id
209
211
  async for completion_chunk in achain(completion_chunks):
210
212
 
211
213
  # logger.debug(completion_chunk)
212
-
213
- chat_completion_chunk.id = chat_id or shortuuid.random()
214
214
  chat_completion_chunk.created = int(time.time())
215
215
  if isinstance(completion_chunk, str):
216
216
  chat_completion_chunk.choices[0].delta.content = completion_chunk
@@ -49,6 +49,8 @@ class ImagesResponse(_ImagesResponse):
49
49
 
50
50
  metadata: Optional[Any] = None
51
51
 
52
+ timings: Optional[Any] = None
53
+
52
54
  def __init__(self, /, **data: Any):
53
55
  super().__init__(**data)
54
56
  if self.data is None and self.image is not None:
@@ -57,6 +59,8 @@ class ImagesResponse(_ImagesResponse):
57
59
 
58
60
  self.data = [{"url": image} for image in self.image]
59
61
 
62
+ # class Config:
63
+ # extra = "allow"
60
64
 
61
65
  class ImageRequest(BaseModel): # openai
62
66
  model: str = ""
@@ -449,6 +453,17 @@ class TextinImageProcessRequest(ImageProcessRequest):
449
453
  self.task = TEXTIN_TASKS.get(self.task.replace('_', '-'), self.task)
450
454
 
451
455
 
456
+ class ImageProcess(BaseModel):
457
+ model: Literal["remove-watermark", "clarity", "expand", "rmbg-2.0"]
458
+ image: str
459
+ mask: Optional[str] = None
460
+
461
+ style: Optional[str] = None
462
+ aspect_ratio: Union[str, Literal["1:1", "4:3", "3:4"]] = "1:1" # 扩图
463
+
464
+ response_format: Literal["url", "b64_json"] = "url"
465
+
466
+
452
467
  if __name__ == '__main__':
453
468
  # print(ASPECT_RATIOS.items())
454
469
 
@@ -113,7 +113,7 @@ class KlingaiImageRequest(BaseModel):
113
113
  {'name': 'imageCount', 'value': self.n},
114
114
  {"name": "fidelity", "value": self.image_fidelity or 0.5},
115
115
  {'name': 'biz', 'value': 'klingai'},
116
- {"name": "kolors_version", "value": "1.0"} ####### 1.5
116
+ {"name": "kolors_version", "value": "1.5"} ####### 1.5
117
117
  ]
118
118
  self.payload = {
119
119
  'arguments': arguments,
@@ -11,7 +11,7 @@
11
11
 
12
12
  from meutils.pipe import *
13
13
 
14
- BASE_URL = "https://api.siliconflow.cn/v1"
14
+ BASE_URL = "https://api.siliconflow.com/v1"
15
15
 
16
16
  EXAMPLES = [
17
17
  {