MeUtils 2025.5.14.16.46.40__py3-none-any.whl → 2025.5.27.14.55.19__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 (40) hide show
  1. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/METADATA +265 -265
  2. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/RECORD +39 -34
  3. examples/_openaisdk/openai_audio.py +13 -5
  4. examples/_openaisdk/openai_chatfire.py +5 -0
  5. meutils/ai_audio/asr/openai_asr.py +5 -5
  6. meutils/apis/dreamfaceapp/__init__.py +11 -0
  7. meutils/apis/dreamfaceapp/audios.py +31 -0
  8. meutils/apis/dreamfaceapp/images.py +110 -0
  9. meutils/apis/dreamfaceapp/videos.py +115 -0
  10. meutils/apis/fal/videos.py +1 -0
  11. meutils/apis/google/chat.py +3 -0
  12. meutils/apis/google/gemini_sdk.py +34 -0
  13. meutils/apis/hailuoai/images.py +8 -4
  14. meutils/apis/images/recraft.py +11 -8
  15. meutils/apis/jimeng/audio.py +19 -11
  16. meutils/apis/jimeng/doubao_images.py +70 -0
  17. meutils/apis/jimeng/doubao_utils.py +4 -4
  18. meutils/apis/jimeng/videos.py +2 -0
  19. meutils/apis/oneapi/channel.py +11 -7
  20. meutils/apis/oneapi/user.py +1 -1
  21. meutils/apis/siliconflow/videos.py +8 -15
  22. meutils/common.py +2 -1
  23. meutils/config_utils/lark_utils/common.py +4 -4
  24. meutils/data/VERSION +1 -1
  25. meutils/io/files_utils.py +5 -3
  26. meutils/io/openai_files.py +3 -2
  27. meutils/llm/completions/chat_spark.py +31 -13
  28. meutils/llm/completions/qwenllm.py +13 -14
  29. meutils/llm/completions/xx.py +3 -48
  30. meutils/llm/openai_polling/chat.py +2 -2
  31. meutils/office_automation/pdf.py +38 -2
  32. meutils/pipe.py +4 -1
  33. meutils/schemas/dreamfaceapp_types.py +12 -0
  34. meutils/schemas/oneapi/common.py +52 -22
  35. meutils/schemas/openai_types.py +5 -4
  36. meutils/apis/jimeng/doubao.py +0 -68
  37. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/LICENSE +0 -0
  38. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/WHEEL +0 -0
  39. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/entry_points.txt +0 -0
  40. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/top_level.txt +0 -0
@@ -35,6 +35,28 @@ client = genai.Client(
35
35
  )
36
36
  )
37
37
 
38
+ GOOGLE_CREDENTIALS_JSON="""{
39
+ "type": "service_account",
40
+ "project_id": "mystic-gradient-460414-s3",
41
+ "private_key_id": "074dc3f29316a8d663c6af1eb3e9b60f9c440230",
42
+ "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCtAW0wwjk0GheH\nF1PEps5Q+smR9Fc9lBcK6R5cTpJo0aNC/9xvz6yqFXYpTjTqwUYK8EH62RFP4K9g\neZRTAQdF4qXP7S1cPsyeBEtk2whsjUIThS0dK1FZzOM3CLM+JRUU9AJdkQWuY4pT\ngfcZ+x5KtfbbTZQ3rf91ZPbaJID/cEd1yjiquhSWG6UGYxN09YPEmPOMAUSBmphI\nWhPdMLih3lghxHRbIhXF2y8uTAIVifyT4xFb7C9IT4NphMt/Ee5hpN+GzlveNsPK\n6UdO7XBgpWX+GjxCoxKgvuvpsJxBprv87BVar4jOFS8YaIMBaSKV37ZKDs1/JNaa\nYn0nCepJAgMBAAECggEABCMNOH3idoqbrqsqAYEwHItcq9DtD5/Fi8kehNxLn7ZI\nmkLqQ2GyyifkeREhzo3D1iHf4AbWBUQVCYBqwa/b+8mzR5UvMR4e0DX/1AfxTAA2\nOOeFuEV3hudRdRjQCW/DUOqTTme3/C8s6PmJ/jztIOH4Rs70eP7gBY9+ICIAlCsR\n258PYn3AkLq6u3f0lYVeafV2I52aX861FlQTGNfTg3Npixx0ygWKrppX67bhlzm8\nyedpkCc3S+ZIjfYAG8mO57vYWUi0oPA6TDbzAQBHqq1Su2+WvsCaqpJ3PtPVigSj\n/KSsUmCXGMXDl3/yRBvuzV6SMlpylBx72SJY8Pn0gQKBgQDz9f6+58l7BBG1fFKe\nYJdRViuGjNG6pKfXnPFaZEpwwgJx2C4chkEKBB6ge6hiIrk9CCE365xjVl82l99x\nqukOWf6dsW6nX7U4oMNQ53ZMPpCdHvaFI9E/B9Exl01GGx61Ajx88NMFVXDYbWa+\n+gKZ6DFeMukMwqWAPqRmMbp8gQKBgQC1iwn6mbsxiSteZ9SzfE+rPb9FkxC/W0VO\nQMBwTVD52M5STZbuXj+oRP1DXFEz1HWNWhrX2w92faLgaZQv5rbXXXkI5zD1Ymlo\n82yjxjoe2fs79GzuQjs5pVzr9Gd7qjqDiHQETV67uqkjjjrBDxtnh2pBJrQ7NAX4\nWQ5YvO2pyQKBgQDlWaLAftAf4ldzswlI863OPaB1wfV57koMnfMY86g4EWyS8pWH\nI4AJlo3kedx3RgW3pujz1YEUsqKYhHcAOZkYcOq5/ZD1sTiBoEF+0duZGkiCLhW8\nXUveYc79PCzdd6mKqiuLmiwIm6aXEWLCr++6GVwwHtSRtnw48KtFmAKmAQKBgEHn\n6AeCJ+Mj2Qq8xwsh5gpUsEuhyEKv78ko2LPsXalWfBCE+nYu4Q1Ffmwl55TZXJOk\nUnpqnIJ3udmeep2pNFebJ4WD6NIsl/fx507Nd+wbVom9go48nSOgVMuUPr02X2fA\n8d1d+TZN3Xl6+Pl9coVzM6/TTTrw9/ng2sR8UguBAoGBAJ6SMKAqa+yjZezDUkC3\nUkmywTRX9vfhH5mDv+kj1MHW++hLYhLE7WRNtMhgf9idLEQBbw7jzoS4wmx9jtPu\nP0mUh67fjctbtR6uxbuZl5sY3eMx03hmv5H33aazhMA7mQXjMPS7gXTIxMoE2Wmw\nFpJyddFAuwMDZecDr74xNU9b\n-----END PRIVATE KEY-----\n",
43
+ "client_email": "xxxxx-350@mystic-gradient-460414-s3.iam.gserviceaccount.com",
44
+ "client_id": "115968049812880579488",
45
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
46
+ "token_uri": "https://oauth2.googleapis.com/token",
47
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
48
+ "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xxxxx-350%40mystic-gradient-460414-s3.iam.gserviceaccount.com",
49
+ "universe_domain": "googleapis.com"
50
+ }"""
51
+
52
+
53
+ client = genai.Client(
54
+ vertexai=True,
55
+ credentials=GOOGLE_CREDENTIALS_JSON,
56
+ http_options=HttpOptions(
57
+ base_url="https://all.chatfire.cc/genai"
58
+ )
59
+ )
38
60
  if __name__ == '__main__':
39
61
  model = "gemini-2.0-flash-exp-image-generation"
40
62
  model = "gemini-2.5-flash-preview-04-17"
@@ -192,3 +214,15 @@ curl "https://all.chatfire.cc/genai/v1beta/models/gemini-2.5-flash-preview-04-17
192
214
  }
193
215
  }'
194
216
  """
217
+
218
+ from litellm import completion
219
+ import os
220
+
221
+ # auth: run 'gcloud auth application-default'
222
+ os.environ["VERTEXAI_PROJECT"] = "hardy-device-386718"
223
+ os.environ["VERTEXAI_LOCATION"] = "us-central1"
224
+
225
+ response = completion(
226
+ model="vertex_ai/gemini-1.5-pro",
227
+ messages=[{ "content": "Hello, how are you?","role": "user"}]
228
+ )
@@ -374,7 +374,9 @@ async def generate(request: ImageRequest):
374
374
  for i in range(1, 10):
375
375
  await asyncio.sleep(max(10 / i, 1))
376
376
  if urls := await get_task(task_response.task_id, task_response.system_fingerprint):
377
- return ImagesResponse(data=dict(zip(["url"] * len(urls), urls)))
377
+ logger.debug(urls)
378
+
379
+ return ImagesResponse(data=[{"url": url} for url in urls])
378
380
 
379
381
 
380
382
  if __name__ == '__main__': # 304752356930580482
@@ -414,15 +416,17 @@ if __name__ == '__main__': # 304752356930580482
414
416
  request = ImageRequest(
415
417
  model="hailuo-image-01",
416
418
 
417
- # prompt="a cat", # 307145017365086216
418
- prompt="https://oss.ffire.cc/files/kling_watermark.png 哭起来",
419
+ prompt="a cat", # 307145017365086216
420
+ # prompt="https://oss.ffire.cc/files/kling_watermark.png 哭起来",
419
421
  # first_frame_image="https://oss.ffire.cc/files/kling_watermark.png" # 307173162217783304
420
422
  )
421
423
 
422
- r = arun(create_task(request, token=token))
424
+ # r = arun(create_task(request, token=token))
423
425
  # arun(get_task(task_id=r.task_id, token=r.system_fingerprint))
424
426
 
425
427
  # arun(get_access_token(token))
428
+
429
+ arun(generate(request))
426
430
  #
427
431
  #
428
432
  # data = {
@@ -41,8 +41,10 @@ async def get_access_token(token: str):
41
41
  logger.debug(response.json())
42
42
  return response.json()["accessToken"]
43
43
 
44
+
44
45
  @retrying()
45
- async def edit_image(image, task: Literal["vectorize", "super_resolution",] = "super_resolution", response_format: Literal["url", "base64"] = "url"):
46
+ async def edit_image(image, task: Literal["vectorize", "super_resolution",] = "super_resolution",
47
+ response_format: Literal["url", "base64"] = "url"):
46
48
  token = await get_next_token_for_polling(
47
49
  feishu_url=FEISHU_URL,
48
50
  check_token=check_token,
@@ -141,14 +143,17 @@ async def generate(request: RecraftImageRequest, token: Optional[str] = None):
141
143
 
142
144
  # eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDY5MjY2MjQsInVzZXIiOnsiaWQiOiIzNjIzNjMwNDU2OTAxNTkxMDciLCJuYW1lIjoibWtybiBhbmJ2IiwiYXZhdGFyIjoiIiwiZGV2aWNlSUQiOiIzMjg2MDA4MzYzNzEwMzQxMTgiLCJpc0Fub255bW91cyI6ZmFsc2V9fQ.JyCL0Be9YsEBlLVIeSpqDv3bTKAlU9Jsds3y5cJKXa4
143
145
  async def check_token(token, threshold: float = 1):
144
- if not isinstance(token, str):
146
+ if isinstance(token, list):
145
147
  tokens = token
146
148
  r = []
149
+ logger.debug(tokens)
147
150
  for batch in tqdm(tokens | xgroup(32)):
148
151
  bools = await asyncio.gather(*map(check_token, batch))
149
152
  r += list(itertools.compress(batch, bools))
150
153
  return r
154
+
151
155
  try:
156
+
152
157
  access_token = await get_access_token(token)
153
158
  headers = {"Authorization": f"Bearer {access_token}"}
154
159
 
@@ -200,10 +205,8 @@ if __name__ == '__main__':
200
205
  # with timer():
201
206
  # arun(generate(request, token=token))
202
207
 
203
- with timer():
204
- arun(edit_image("https://oss.ffire.cc/files/kling_watermark.png"))
208
+ # with timer():
209
+ # arun(edit_image("https://oss.ffire.cc/files/kling_watermark.png"))
205
210
  # tokens = [token]
206
- #
207
- # tokens = list(arun(aget_spreadsheet_values(feishu_url=FEISHU_URL, to_dataframe=True))[0]) | xfilter_
208
- # #
209
- # r = arun(check_token(tokens[:5]))
211
+ tokens = list(arun(aget_spreadsheet_values(feishu_url=FEISHU_URL, to_dataframe=True))[0]) | xfilter_
212
+ r = arun(check_token(tokens))
@@ -17,7 +17,8 @@ from meutils.schemas.jimeng_types import BASE_URL
17
17
 
18
18
  VOICE_MAPPING = {
19
19
  # 带情绪
20
- "柔美女友": "7382552865023201819", # "happy", "angry", "fear", "surprise", "coldness", "disgust", "excited", "hate"
20
+ "柔美女友": "7382552865023201819",
21
+ # "happy", "angry", "fear", "surprised", "coldness", "disgust", "excited", "hate"
21
22
  "妩媚女生": "7459778019725414962", # "happy", "angry", "fear", "surprise"
22
23
  "京腔小爷": "7382048889659986458", # "joy", "angry", "surprise", "disgust"
23
24
 
@@ -117,25 +118,28 @@ async def create_tts(request: TTSRequest): # audio.speech.create
117
118
  "audio_config": {
118
119
  "format": "mp3",
119
120
  "sample_rate": 24000,
120
- "speech_rate": 0,
121
+ "speech_rate": request.speed or 0,
121
122
  "pitch_rate": 0,
122
123
  "enable_timestamp": True,
123
124
 
124
125
  },
125
126
  "id_info": {
126
- "id": VOICE_MAPPING.get(request.voice, request.voice) or "7459778019725414962",
127
+ "id": effect_id,
127
128
  "item_platform": 1
128
129
  }
129
130
  }
130
- if request.emotion:
131
- if request.voice == "京腔小爷" and request.emotion == "happy":
131
+ if request.instructions and request.voice in {"柔美女友", "妩媚女生", "京腔小爷", }:
132
+ if request.voice == "京腔小爷" and request.instructions == "happy":
132
133
  request.emotion = "joy"
133
134
 
135
+ if request.voice == "柔美女友" and request.instructions == "surprise":
136
+ request.emotion = "surprised"
137
+
134
138
  payload["audio_config"].update(
135
139
  {
136
140
  # 情绪
137
141
  "emotion_scale": 5,
138
- "emotion": request.emotion,
142
+ "emotion": request.instructions,
139
143
  }
140
144
  )
141
145
 
@@ -162,22 +166,26 @@ async def create_tts(request: TTSRequest): # audio.speech.create
162
166
 
163
167
 
164
168
  if __name__ == '__main__':
165
- text = """
166
- 我们不能迟到早退刷脸打卡 中午休息一个小时 进出都得打卡
169
+ text = """Chatfire tts-pro支持多种音色:
170
+ 柔美女友 妩媚女生 京腔小爷 猴哥 熊二 如来佛祖 咆哮哥 四郎 懒小羊 TVB女声 动漫小新 紫薇 黛玉 顾姐 动漫海绵 云龙哥 容嬷嬷 华妃 河南小哥 湾区大叔 广西老表 山东小哥 长沙妹坨 樱花小哥 上海阿姨 京腔 港普男声 天津小哥 西安掌柜 台湾女生 东北老铁 粤语男声 重庆小伙 魅力姐姐 高冷御姐 魅力女友 耿直女声 活泼女声 随性女声 知性女声 温柔淑女 悲伤女声 开朗学长 阳光青年 广告男声 悠悠君子 强势青年 阳光男生 沉稳男声 悲伤青年 病娇少女 撒娇学妹 冷静少女 元气少女 活泼女孩 阳光少年 活泼少年 小男孩 小女孩 萌娃 沉稳老者 老婆婆 儒雅大叔 温柔阿姨 刚正大叔
171
+
167
172
  """
168
173
  request = TTSRequest(
169
174
  model="tts-1",
170
175
  # input="军杰 快来我的五指山下" * 1,
171
176
  input=text,
172
- voice="柔美女友",
177
+ # voice="柔美女友",
178
+ voice="猴哥",
179
+
173
180
  # voice="妩媚女生",
174
181
  # voice="如来佛祖",
175
182
  # voice="京腔小爷",
176
183
 
177
- # response_format="url",
184
+ response_format="url",
178
185
 
179
186
  # emotion="happy",
180
- emotion="fear"
187
+ # emotion="fear"
188
+ emotion="surprise"
181
189
 
182
190
  )
183
191
 
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : images
5
+ # @Time : 2024/12/16 17:46
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from openai import AsyncClient
12
+ from meutils.pipe import *
13
+ from meutils.apis.jimeng.doubao_utils import generate_cookie, generate_params
14
+
15
+ from meutils.schemas.image_types import ImageRequest
16
+
17
+ from meutils.schemas.jimeng_types import BASE_URL, MODELS_MAP, FEISHU_URL
18
+ from meutils.config_utils.lark_utils import get_next_token_for_polling
19
+
20
+
21
+ async def create(token: Optional[str] = None):
22
+ token = token or "712a47e7eec7c03b4cc7229775e06841"
23
+ cookie = generate_cookie(token)
24
+ params = generate_params()
25
+
26
+ headers = {
27
+ 'Cookie': cookie,
28
+ 'agw-js-conv': 'str',
29
+ 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
30
+ 'content-type': 'application/json'
31
+ }
32
+ payload = {
33
+ "messages": [
34
+ {
35
+ "content": "{\"text\":\"一只猫\"}",
36
+ "content_type": 2009,
37
+ "attachments": [
38
+
39
+ ]
40
+ }
41
+ ],
42
+ "completion_option": {
43
+ "is_regen": False,
44
+ "with_suggest": False,
45
+ "need_create_conversation": False,
46
+ "launch_stage": 1,
47
+ "is_replace": False,
48
+ "is_delete": False,
49
+ "message_from": 0,
50
+ "event_id": "0"
51
+ },
52
+ "section_id": "6287920686327298",
53
+ "conversation_id": "6287920686327042",
54
+ "local_message_id": "936eee40-354d-11f0-83df-6b1810ffef8a"
55
+
56
+ # "local_message_id": str(uuid.uuid4())
57
+
58
+ }
59
+
60
+ client = AsyncClient(base_url="https://www.doubao.com/samantha", default_headers=headers, api_key='xx',
61
+ )
62
+ response = await client.post("/chat/completion", body=payload, cast_to=object, stream=True,
63
+ options=dict(params=params))
64
+ async for i in response:
65
+ print(i)
66
+ # return response
67
+
68
+
69
+ if __name__ == '__main__':
70
+ arun(create())
@@ -132,7 +132,7 @@ def generate_cookie(refresh_token: str, ms_token: Optional[str] = None) -> str:
132
132
  return "; ".join(cookie_parts)
133
133
 
134
134
 
135
- async def get_upload_token(): # 3600过期
135
+ async def get_upload_token(refresh_token): # 3600过期
136
136
  """
137
137
 
138
138
  {'code': 0,
@@ -148,7 +148,7 @@ async def get_upload_token(): # 3600过期
148
148
 
149
149
  :return:
150
150
  """
151
- cookie = generate_cookie('de2215a7bb8e442774cf388f03fac84c')
151
+ cookie = generate_cookie(refresh_token)
152
152
  url = "https://www.doubao.com/alice/upload/auth_token"
153
153
 
154
154
  headers = {
@@ -170,6 +170,6 @@ async def get_upload_token(): # 3600过期
170
170
  if __name__ == '__main__':
171
171
  # generate_cookie("")
172
172
 
173
- # arun(get_upload_token())
174
- print(generate_params())
173
+ arun(get_upload_token("712a47e7eec7c03b4cc7229775e06841"))
174
+ # print(generate_params())
175
175
  # print(get_signing_key('xW9YbDhTlWsXdaN7O2g1lfcyePxf5kJyg/r2mwSZG/iuSmbvVgToO6LVCLmUjVJ3'))
@@ -36,6 +36,8 @@ async def get_task(task_id: str, token: str = "916fed81175f5186a2c05375699ea40d"
36
36
  $..image_to_avatar 成功: 先检测图片or视频
37
37
  :param task_ids:
38
38
  :return:
39
+
40
+ todo: fail_code
39
41
  """
40
42
  task_ids = task_id.split()
41
43
 
@@ -9,6 +9,7 @@
9
9
  # @Description :
10
10
 
11
11
  from meutils.pipe import *
12
+ from meutils.hash_utils import murmurhash
12
13
  from meutils.schemas.oneapi import BASE_URL, GROUP_RATIO
13
14
 
14
15
  headers = {
@@ -72,24 +73,27 @@ async def edit_channel(models, token: Optional[str] = None):
72
73
 
73
74
 
74
75
  # todo: 分批
76
+
75
77
  async def create_or_update_channel(api_key, base_url: Optional[str] = "https://api.ffire.cc"):
76
78
  if isinstance(api_key, list):
77
79
  api_keys = api_key | xgroup(128) # [[],]
78
80
  else:
79
81
  api_keys = [[api_key]]
80
82
 
81
- models = "gemini-1.0-pro-vision-latest,gemini-pro-vision,gemini-1.5-pro-latest,gemini-1.5-pro-001,gemini-1.5-pro-002,gemini-1.5-pro,gemini-1.5-flash-latest,gemini-1.5-flash-001,gemini-1.5-flash-001-tuning,gemini-1.5-flash,gemini-1.5-flash-002,gemini-1.5-flash-8b,gemini-1.5-flash-8b-001,gemini-1.5-flash-8b-latest,gemini-1.5-flash-8b-exp-0827,gemini-1.5-flash-8b-exp-0924,gemini-2.5-pro-exp-03-25,gemini-2.5-pro-preview-03-25,gemini-2.5-flash-preview-04-17,gemini-2.0-flash-exp,gemini-2.0-flash,gemini-2.0-flash-001,gemini-2.0-flash-exp-image-generation,gemini-2.0-flash-lite-001,gemini-2.0-flash-lite,gemini-2.0-flash-lite-preview-02-05,gemini-2.0-flash-lite-preview,gemini-2.0-pro-exp,gemini-2.0-pro-exp-02-05,gemini-2.0-flash-thinking-exp-01-21,gemini-2.0-flash-thinking-exp,gemini-2.0-flash-thinking-exp-1219,learnlm-1.5-pro-experimental,learnlm-2.0-flash-experimental,gemma-3-1b-it,gemma-3-4b-it,gemma-3-12b-it,gemma-3-27b-it,gemini-2.0-flash-live-001"
82
- nothinking_models = 'gemini-2.5-pro-exp-03-25-nothinking,gemini-2.5-pro-preview-03-25-nothinking,gemini-2.5-flash-preview-04-17-nothinking,gemini-2.0-flash-thinking-exp-01-21-nothinking,gemini-2.0-flash-thinking-exp-nothinking,gemini-2.0-flash-thinking-exp-1219-nothinking'
83
+ models = "gemini-2.5-flash-preview-05-20,gemini-1.5-flash-latest,gemini-1.5-flash-001,gemini-1.5-flash-001-tuning,gemini-1.5-flash,gemini-1.5-flash-002,gemini-1.5-flash-8b,gemini-1.5-flash-8b-001,gemini-1.5-flash-8b-latest,gemini-1.5-flash-8b-exp-0827,gemini-1.5-flash-8b-exp-0924,gemini-2.5-flash-preview-04-17,gemini-2.0-flash-exp,gemini-2.0-flash,gemini-2.0-flash-001,gemini-2.0-flash-exp-image-generation,gemini-2.0-flash-lite-001,gemini-2.0-flash-lite,gemini-2.0-flash-lite-preview-02-05,gemini-2.0-flash-lite-preview,gemini-2.0-flash-thinking-exp-01-21,gemini-2.0-flash-thinking-exp,gemini-2.0-flash-thinking-exp-1219,learnlm-2.0-flash-experimental,gemma-3-1b-it,gemma-3-4b-it,gemma-3-12b-it,gemma-3-27b-it,gemini-2.0-flash-live-001"
84
+ nothinking_models = 'gemini-2.5-flash-preview-05-20-nothinking,gemini-2.5-flash-preview-04-17-nothinking,gemini-2.0-flash-thinking-exp-01-21-nothinking,gemini-2.0-flash-thinking-exp-nothinking,gemini-2.0-flash-thinking-exp-1219-nothinking'
83
85
  models = f"{models},{nothinking_models}"
84
86
 
85
87
  payload = {
86
88
  # "id": 7493,
87
- "type": 24,# gemini
89
+ "type": 24, # gemini
88
90
  # "key": "AIzaSyCXWV19FRM4XX0KHmpR9lYUz9i1wxQTYUg",
89
91
  "openai_organization": "",
90
92
  "test_model": "",
91
93
  "status": 1,
92
94
  "name": "gemini",
95
+
96
+ "priority": murmurhash(api_key, bins=3),
93
97
  "weight": 0,
94
98
  # "created_time": 1745554162,
95
99
  # "test_time": 1745554168,
@@ -102,7 +106,6 @@ async def create_or_update_channel(api_key, base_url: Optional[str] = "https://a
102
106
  # "used_quota": 0,
103
107
  "model_mapping": """{"gemini-2.5-pro-preview-03-25": "gemini-2.5-pro-exp-03-25"}""",
104
108
  # "status_code_mapping": "",
105
- # "priority": 0,
106
109
  # "auto_ban": 1,
107
110
  # "other_info": "",
108
111
  # "settings": "",
@@ -154,12 +157,11 @@ if __name__ == '__main__':
154
157
  # base_url = "https://api.ffire.cc"
155
158
  base_url = "https://usa.chatfire.cn"
156
159
  #
157
- tokens = arun(get_series(FEISHU_URL))
160
+ tokens = arun(get_series(FEISHU_URL)) # [:5]
158
161
  arun(create_or_update_channel(tokens, base_url))
159
162
  # arun(create_or_update_channel(tokens))
160
163
  # # arun(delete_channel(range(10000, 20000)))
161
164
 
162
-
163
165
  """
164
166
  API_KEY=6c255307-7b4d-4be8-984b-5440a3e867eb
165
167
  curl --location --request POST 'https://api.ffire.cc/api/channel/' \
@@ -200,4 +202,6 @@ curl --location --request POST 'https://api.ffire.cc/api/channel/' \
200
202
  "volcengine"
201
203
  ]
202
204
  }'
203
- """
205
+ """
206
+
207
+
@@ -113,4 +113,4 @@ if __name__ == '__main__':
113
113
 
114
114
  # arun(get_api_key_log('sk-gpoH1z3G6nHovD8MY40i6xx5tsC1vbh7B3Aao2jmejYNoKhv'))
115
115
  # arun(get_user_money("sk-LlB4W38z9kv5Wy1c3ceeu4PHeIWs6bbWsjr8Om31jYvsucRv"))
116
- arun(get_user_from_api_key('sk-ROgrPPp2TUdGUC8aNOBwO8Lv0AHZjECKjoT7rBbHbvAKVTKA'))
116
+ arun(get_user_from_api_key('sk-4mQ0TUJtKfBF7iLcSmVlMCFgeV1gFxs3aPJRI6uBcojPoEBy'))
@@ -20,19 +20,17 @@ from openai import OpenAI, AsyncOpenAI
20
20
 
21
21
  check_token = partial(check_token_for_siliconflow, threshold=0.01)
22
22
 
23
- MODELS_MAP = {
24
- "hunyuan-video": "tencent/HunyuanVideo",
25
- "hunyuanvideo": "tencent/HunyuanVideo",
26
- "mochi-1-preview": "genmo/mochi-1-preview",
27
- "ltx-video": "Lightricks/LTX-Video",
28
- }
29
23
  """
24
+
25
+ tencent/HunyuanVideo-HD
26
+
30
27
  Wan-AI/Wan2.1-T2V-14B
31
28
  Wan-AI/Wan2.1-T2V-14B-Turbo
32
29
 
33
30
  Wan-AI/Wan2.1-I2V-14B-720P
34
31
  Wan-AI/Wan2.1-I2V-14B-720P-Turbo
35
32
 
33
+
36
34
  16:9 👉 1280×720
37
35
  9:16 👉 720×1280
38
36
  1:1 👉 960×960
@@ -44,17 +42,12 @@ Wan-AI/Wan2.1-I2V-14B-720P-Turbo
44
42
  async def create_task(request: VideoRequest, token: Optional[str] = None):
45
43
  token = token or await get_next_token_for_polling(FEISHU_URL_FREE, check_token=check_token, from_redis=True)
46
44
 
45
+ if 'Wan-AI' in request.model:
46
+ request.model = "Wan-AI/Wan2.1-T2V-14B-720P-Turbo"
47
+
47
48
  if request.image:
48
49
  request.image = await to_base64(request.image)
49
-
50
- if request.model == "Wan-AI/Wan2.1-T2V-14B":
51
- request.model = "Wan-AI/Wan2.1-T2V-14B-Turbo"
52
-
53
- elif request.model == "Wan-AI/Wan2.1-I2V-14B-720P":
54
- request.model = "Wan-AI/Wan2.1-I2V-14B-720P-Turbo"
55
-
56
- else:
57
- request.model = "Wan-AI/Wan2.1-I2V-14B-720P-Turbo" if request.image else "Wan-AI/Wan2.1-T2V-14B-Turbo"
50
+ request.model = request.model.replace("-T2V-", "-I2V-")
58
51
 
59
52
  payload = request.model_dump(exclude_none=True)
60
53
 
meutils/common.py CHANGED
@@ -570,7 +570,8 @@ def storage_to_cookie(storage: Union[str, Path, dict]):
570
570
  elif isinstance(storage, str):
571
571
  storage = json.loads(storage)
572
572
 
573
- storage = storage['cookies']
573
+ if isinstance(storage, dict):
574
+ storage = storage['cookies']
574
575
 
575
576
  import jsonpath
576
577
  cookies = [f"{n}={v}" for n, v in
@@ -80,7 +80,7 @@ def get_spreadsheet_values(
80
80
 
81
81
 
82
82
  @alru_cache(ttl=600)
83
- @rcache(ttl=600, serializer='pickle') # 缓存
83
+ @rcache(ttl=300, serializer='pickle') # 缓存
84
84
  async def aget_spreadsheet_values(
85
85
  spreadsheet_token: Optional[str] = None,
86
86
  sheet_id: Optional[str] = None,
@@ -101,10 +101,10 @@ async def aget_spreadsheet_values(
101
101
  if response.is_success:
102
102
  data = response.json()
103
103
  if to_dataframe:
104
- # values = data.get('data').get('valueRange').get('values')
105
- # [value | xmap(lambda x: x['text']) | xjoin('') for value in values]
104
+ values = data.get('data').get('valueRange').get('values')
105
+
106
+ return pd.DataFrame(values)
106
107
 
107
- return pd.DataFrame(data.get('data').get('valueRange').get('values'))
108
108
  return data
109
109
  else:
110
110
  send_message(
meutils/data/VERSION CHANGED
@@ -1 +1 @@
1
- 2025.05.14.16.46.40
1
+ 2025.05.27.14.55.19
meutils/io/files_utils.py CHANGED
@@ -26,7 +26,7 @@ from httpx import AsyncClient
26
26
  def guess_mime_type(file):
27
27
  mime_type = None
28
28
  if isinstance(file, str):
29
- mime_type, _ = mimetypes.guess_type(file)
29
+ mime_type, _ = mimetypes.guess_type(file.strip())
30
30
  return mime_type or "application/octet-stream"
31
31
 
32
32
 
@@ -280,5 +280,7 @@ if __name__ == '__main__':
280
280
 
281
281
  # arun(to_bytes("https://oss.ffire.cc/files/kling_watermark.png"))
282
282
 
283
- file = "https://v3.fal.media/files/penguin/Rx-8V0MVgkVZM6PJ0RiPD_douyin.mp4"
284
- arun(to_bytes(file))
283
+ # file = "https://v3.fal.media/files/penguin/Rx-8V0MVgkVZM6PJ0RiPD_douyin.mp4"
284
+ # arun(to_bytes(file))
285
+
286
+ print(guess_mime_type("http://admin.ilovechatgpt.top/file/ceshiwendangdocx_31118702.docx "))
@@ -50,7 +50,7 @@ async def delete_files(client, threshold: int = 666):
50
50
 
51
51
 
52
52
  @rcache(ttl=7 * 24 * 3600)
53
- async def file_extract(file):
53
+ async def file_extract(file, enable_reader: bool = True):
54
54
  """
55
55
 
56
56
  :param file: url bytes path
@@ -63,8 +63,9 @@ async def file_extract(file):
63
63
  filename = Path(file).name if isinstance(file, str) else 'untitled'
64
64
  mime_type = guess_mime_type(file)
65
65
 
66
- if str(file).startswith("http") and mime_type in {"application/octet-stream", "text/html"}:
66
+ if enable_reader and str(file).startswith("http") and mime_type in {"application/octet-stream", "text/html"}:
67
67
  logger.debug(f"jina reader")
68
+
68
69
  markdown_content = await url_reader(file)
69
70
  return {
70
71
  'filename': filename,
@@ -33,7 +33,7 @@ class Completions(object):
33
33
  file_url, *texts = request.last_user_content.split(maxsplit=1) + ["总结下"]
34
34
  text = texts[0]
35
35
 
36
- file_content = await file_extract(file_url)
36
+ file_content = await file_extract(file_url, enable_reader=False)
37
37
 
38
38
  request.messages = [
39
39
  {
@@ -73,7 +73,7 @@ class Completions(object):
73
73
 
74
74
  text, file_url = texts[-1], file_urls[-1]
75
75
  if file_url in image_urls:
76
- file_content = await file_extract(file_url)
76
+ file_content = await file_extract(file_url, enable_reader=False)
77
77
 
78
78
  message["content"] = f"""{json.dumps(file_content, ensure_ascii=False)}\n\n{text}"""
79
79
 
@@ -104,7 +104,7 @@ if __name__ == '__main__':
104
104
  request = CompletionRequest(
105
105
  # model="qwen-turbo-2024-11-01",
106
106
  # model="claude-3-5-sonnet-20241022",
107
- model="deepsek-chat",
107
+ model="deepseek-chat",
108
108
 
109
109
  messages=[
110
110
  # {
@@ -133,15 +133,15 @@ if __name__ == '__main__':
133
133
  {
134
134
  'role': 'user',
135
135
  # "content": '你好',
136
- "content": [
137
- {"type": "text", "text": "https://oss.ffire.cc/files/kling_watermark.png 描述第一张图片"},
138
-
139
- # {"type": "text", "text": "描述第一张图片"},
140
- #
141
- # {"type": "image_url", "image_url": "https://oss.ffire.cc/files/kling_watermark.png"},
142
- # # {"type": "image_url", "image_url": "https://oss.ffire.cc/files/nsfw.jpg"}
143
- #
144
- ],
136
+ # "content": [
137
+ # {"type": "text", "text": "https://oss.ffire.cc/files/kling_watermark.png 描述第一张图片"},
138
+ #
139
+ # # {"type": "text", "text": "描述第一张图片"},
140
+ # #
141
+ # # {"type": "image_url", "image_url": "https://oss.ffire.cc/files/kling_watermark.png"},
142
+ # # # {"type": "image_url", "image_url": "https://oss.ffire.cc/files/nsfw.jpg"}
143
+ # #
144
+ # ],
145
145
 
146
146
  # 'content': {
147
147
  # "type": "file_url",
@@ -153,7 +153,7 @@ if __name__ == '__main__':
153
153
  # "content": "https://oss.ffire.cc/files/百炼系列手机产品介绍.docx 总结下"
154
154
  # "content": "https://mj101-1317487292.cos.ap-shanghai.myqcloud.com/ai/test.pdf\n\n总结下"
155
155
 
156
- # "content": "https://admin.ilovechatgpt.top/file/lunIMYAIzhinengzhushouduishenghuodocx_14905733.docx 总结",
156
+ "content": "http://admin.ilovechatgpt.top/file/4docx_86529298.docx 我无法确定你是否准确识别word里面的论文?",
157
157
  # "content": "http://admin.ilovechatgpt.top/file/xinjianMicrosoftWordwendangdoc-9052714901036-bGSJLeKbqQdnIZZn.doc 111111234234",
158
158
 
159
159
  },
@@ -276,4 +276,22 @@ if __name__ == '__main__':
276
276
  # {},
277
277
  # {'role': 'user', 'content': '总结一下'}]
278
278
 
279
+ request = {
280
+ "model": "gemini-all",
281
+ "messages": [
282
+ {
283
+ "role": "system",
284
+ "content": "\\n Current date: 2025-05-21"
285
+ },
286
+ {
287
+ "role": "user",
288
+ "content": "http://admin.ilovechatgpt.top/file/ceshiwendangdocx_31118702.docx 你好"
289
+ }
290
+ ],
291
+ "stream": True,
292
+ "top_p": 0.7,
293
+ "temperature": 0.8,
294
+ "n": 1
295
+ }
296
+ request = CompletionRequest(**request)
279
297
  arun(c.create(request))