MeUtils 2025.1.17.19.49.29__py3-none-any.whl → 2025.1.27.15.5.31__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 (47) hide show
  1. {MeUtils-2025.1.17.19.49.29.dist-info → MeUtils-2025.1.27.15.5.31.dist-info}/METADATA +27 -28
  2. {MeUtils-2025.1.17.19.49.29.dist-info → MeUtils-2025.1.27.15.5.31.dist-info}/RECORD +46 -43
  3. examples/_openaisdk/4v.py +3 -4
  4. examples/_openaisdk/openai_baichuan.py +7 -3
  5. examples/_openaisdk/openai_chatfire.py +17 -4
  6. examples/_openaisdk/openai_deepinfra.py +2 -2
  7. examples/_openaisdk/openai_deepseek.py +7 -6
  8. examples/_openaisdk/openai_doubao.py +16 -7
  9. examples/_openaisdk/openai_embeddings.py +1 -1
  10. examples/_openaisdk/openai_modelscope.py +2 -1
  11. examples/_openaisdk/openai_together.py +2 -1
  12. meutils/apis/jimeng/lip_sync.py → examples/_openaisdk/openai_x.py +3 -2
  13. examples/_openaisdk/openai_zhipu.py +9 -5
  14. examples/bserver.py +60 -518
  15. examples/json_jmespath.py +13 -13
  16. meutils/apis/fal/videos.py +13 -7
  17. meutils/apis/hailuoai/videos.py +16 -6
  18. meutils/apis/hunyuan/image_tools.py +6 -2
  19. meutils/apis/images/edits.py +74 -6
  20. meutils/apis/images/recraft.py +5 -5
  21. meutils/apis/jimeng/common.py +2 -147
  22. meutils/apis/jimeng/doubao.py +2 -2
  23. meutils/apis/jimeng/files.py +84 -29
  24. meutils/apis/jimeng/images.py +177 -11
  25. meutils/apis/jimeng/videos.py +305 -0
  26. meutils/apis/oneapi/user.py +3 -1
  27. meutils/data/VERSION +1 -1
  28. meutils/io/files_utils.py +9 -3
  29. meutils/jwt_utils/common.py +46 -0
  30. meutils/llm/clients.py +4 -1
  31. meutils/llm/completions/agents/file.py +7 -4
  32. meutils/llm/completions/agents/search.py +115 -0
  33. meutils/parsers/fileparser/mineru.py +48 -0
  34. meutils/schemas/hailuo_types.py +8 -2
  35. meutils/schemas/image_types.py +19 -5
  36. meutils/schemas/oneapi/common.py +152 -45
  37. meutils/schemas/oneapi/models.py +1 -1
  38. meutils/schemas/openai_types.py +1 -1
  39. meutils/schemas/task_types.py +2 -0
  40. meutils/schemas/video_types.py +19 -1
  41. meutils/str_utils/json_utils.py +29 -1
  42. meutils/request_utils/jwt_utils/common.py +0 -42
  43. {MeUtils-2025.1.17.19.49.29.dist-info → MeUtils-2025.1.27.15.5.31.dist-info}/LICENSE +0 -0
  44. {MeUtils-2025.1.17.19.49.29.dist-info → MeUtils-2025.1.27.15.5.31.dist-info}/WHEEL +0 -0
  45. {MeUtils-2025.1.17.19.49.29.dist-info → MeUtils-2025.1.27.15.5.31.dist-info}/entry_points.txt +0 -0
  46. {MeUtils-2025.1.17.19.49.29.dist-info → MeUtils-2025.1.27.15.5.31.dist-info}/top_level.txt +0 -0
  47. /meutils/{request_utils/jwt_utils → jwt_utils}/__init__.py +0 -0
examples/json_jmespath.py CHANGED
@@ -10,16 +10,16 @@
10
10
  # https://www.cnblogs.com/denise1108/p/10265911.html
11
11
  # 解析dict、json字符串
12
12
 
13
-
14
- import jmespath
15
-
16
- jmespath.search('foo.bar[*].name', {"foo": {"bar": [{"name": "one"}, {"name": "two"}]}})
17
-
18
- jmespath.search('foo.*.name', {"foo": {"bar": {"name": "one"}, "baz": {"name": "two"}}})
19
-
20
-
21
- expression = jmespath.compile('foo.bar')
22
- print(expression.search({'foo': [{'bar': 'baz'}]}))
23
-
24
-
25
- import jsonpath
13
+ #
14
+ # # import jmespath
15
+ #
16
+ # jmespath.search('foo.bar[*].name', {"foo": {"bar": [{"name": "one"}, {"name": "two"}]}})
17
+ #
18
+ # jmespath.search('foo.*.name', {"foo": {"bar": {"name": "one"}, "baz": {"name": "two"}}})
19
+ #
20
+ #
21
+ # expression = jmespath.compile('foo.bar')
22
+ # print(expression.search({'foo': [{'bar': 'baz'}]}))
23
+ #
24
+ #
25
+ # import jsonpath
@@ -50,13 +50,16 @@ async def get_task(task_id: str, token: Optional[str] = None):
50
50
  application = f"fal-ai/{model}"
51
51
 
52
52
  client = AsyncClient(key=token)
53
- # status = await fal_client.status_async("fal-ai/latentsync", request_id, with_logs=True)
53
+ response = await client.status(application, request_id, with_logs=False)
54
+ logger.debug(response)
54
55
 
55
- response = await client.result(application, request_id)
56
- # AsyncRequestHandle(request_id='0b7ab6b8-c7dc-4f17-a655-4ee56dd0f864')
56
+ # response = await client.result(application, request_id)
57
+ # client.AsyncRequestHandle(request_id='0b7ab6b8-c7dc-4f17-a655-4ee56dd0f864')
57
58
  return response
58
59
 
59
60
 
61
+
62
+
60
63
  if __name__ == '__main__':
61
64
  model = "latentsync"
62
65
  model = "sync-lipsync"
@@ -70,8 +73,11 @@ if __name__ == '__main__':
70
73
 
71
74
  r = arun(create_task(request))
72
75
 
73
- token = "3f712efa-a692-4e7f-9409-e6c505bab4e2:151a0b6093312cc8f66fc52b7c4c92a8"
74
- model = "0b7ab6b8-c7dc-4f17-a655-4ee56dd0f864"
75
76
 
76
- # task_id = r.task_id
77
- # arun(get_task(task_id, token))
77
+ task_id = r.task_id
78
+ arun(get_task(task_id, r.system_fingerprint))
79
+
80
+ # task_id="latentsync::d4133f01-0f5b-4213-abe4-d14abdb57e3f"
81
+ # token = "3f712efa-a692-4e7f-9409-e6c505bab4e2:151a0b6093312cc8f66fc52b7c4c92a8"
82
+
83
+ # r = arun(get_task(task_id, token))
@@ -35,14 +35,19 @@ send_message = partial(
35
35
  )
36
36
 
37
37
  MODEL_MAPPING = {
38
- # video-01
39
- "T2V-01": "23000",
40
- "I2V-01": "23001",
41
- "I2V-01-live": "23011",
42
- "S2V-01": "23021"
38
+ # video-01 video-01 video-01-live2d S2V-01
39
+
40
+ "t2v-01": "23000",
41
+ "i2v-01": "23001",
42
+ "i2v-01-live": "23011",
43
+ "video-01-live2d": "23011",
44
+ "s2v-01": "23021",
43
45
  }
44
46
 
45
47
 
48
+ # minimax_video-01,minimax_video-01-live2d,,minimax_t2v-01,minimax_i2v-01,minimax_i2v-01-live,minimax_s2v-01
49
+
50
+
46
51
  async def upload(file: bytes, token: Optional[str] = None, vip: Optional[bool] = True):
47
52
  global BASE_URL, FEISHU_URL
48
53
  if vip:
@@ -217,6 +222,11 @@ async def create_task(request: VideoRequest, token: Optional[str] = None, vip: O
217
222
  # "type": "png",
218
223
  "url": request.first_frame_image,
219
224
  }
225
+
226
+ # {"desc": "跳起来", "useOriginPrompt": false, "fileList": [{"id": "338311163211288581",
227
+ # "url": "https://cdn.hailuoai.video/moss/prod/2025-01-22-11/user/multi_chat_file/de5a4cec-eb26-4380-94e4-13b268bf5c0d.jpg",
228
+ # "name": "duikoux.jpg", "type": "jpg"}],
229
+ # "modelID": "23021", "quantity": "1"}
220
230
  else:
221
231
  data = await upload(file, token=refresh_token, vip=vip)
222
232
  file_data = {
@@ -227,7 +237,7 @@ async def create_task(request: VideoRequest, token: Optional[str] = None, vip: O
227
237
  }
228
238
 
229
239
  payload["fileList"].append(file_data)
230
- payload["modelID"] = MODEL_MAPPING.get(request.model, "23001")
240
+ payload["modelID"] = MODEL_MAPPING.get(request.model.lower(), "23001")
231
241
 
232
242
  logger.debug(bjson(payload))
233
243
 
@@ -73,12 +73,16 @@ async def image_process(request: HunyuanImageProcessRequest, token: Optional[str
73
73
 
74
74
  if __name__ == '__main__':
75
75
  # request = ImageProcessRequest(image="https://oss.ffire.cc/files/kling_watermark.png", task='removewatermark')
76
-
76
+ token = "web_uid=ac283ec7-4bf6-40c9-a0ce-5a2e0cd7db06; hy_source=web; hy_user=I09MgMfFcUUyVSIg; hy_token=hevVCi/QuVjQcre5NDRMO7FuiWCZoDMIq3Zp8IwNxrPUofl4zWYazHEdeZ2S5o7q; _qimei_q36=; _qimei_h38=f2d27f50f0f23e085296d28303000006a17a09; _qimei_fingerprint=efbb885a22f7d4e5589008c28bc8e7ba; _qimei_uuid42=18c0310102d1002a082420cd40bb9717523c3c7e12; _gcl_au=1.1.915258067.1733278380; _ga_RPMZTEBERQ=GS1.1.1733722091.3.1.1733722108.0.0.0; _ga=GA1.2.981511920.1725261466; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22100000458739%22%2C%22first_id%22%3A%22191b198c7b2d52-0fcca8d731cb9b8-18525637-2073600-191b198c7b31fd9%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%A4%BE%E4%BA%A4%E7%BD%91%E7%AB%99%E6%B5%81%E9%87%8F%22%2C%22%24latest_utm_medium%22%3A%22cpc%22%7D%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMTkxYjE5OGM3YjJkNTItMGZjY2E4ZDczMWNiOWI4LTE4NTI1NjM3LTIwNzM2MDAtMTkxYjE5OGM3YjMxZmQ5IiwiJGlkZW50aXR5X2xvZ2luX2lkIjoiMTAwMDAwNDU4NzM5In0%3D%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%24identity_login_id%22%2C%22value%22%3A%22100000458739%22%7D%2C%22%24device_id%22%3A%22191b198c7b2d52-0fcca8d731cb9b8-18525637-2073600-191b198c7b31fd9%22%7D"
77
77
  with timer():
78
78
  image = "https://sfile.chatglm.cn/chatglm4/3dcb1cc2-22ad-420b-9d16-dc71dffc02b2.png"
79
79
  image = "https://oss.ffire.cc/files/kling_watermark.png"
80
80
  image = "https://cdn.meimeiqushuiyin.cn/2024-12-05/ori/tmp_0511a4cb2066ffc309fa6f7a733ac1e93236709bf46c9430.jpg"
81
81
  image = "https://cdn.meimeiqushuiyin.cn/2024-12-05/ori/tmp_de5e186878b079a87d22c561f17e6853.jpg"
82
+ image = "https://yuanbao.tencent.com/api/resource/download?resourceId=740fed65baed5f763db891b5443b7ee5"
83
+ image = url = "https://oss.ffire.cc/files/shuiyin.jpg"
84
+ # image = url = "https://oss.ffire.cc/files/shuiyin2.jpg"
85
+
82
86
  request = HunyuanImageProcessRequest(image=image, task='removewatermark')
83
87
 
84
- arun(image_process(request))
88
+ arun(image_process(request, token=token))
@@ -9,9 +9,12 @@
9
9
  # @Description :
10
10
 
11
11
  from meutils.pipe import *
12
+ from meutils.decorators.retry import retrying, IgnoredRetryException
13
+
12
14
  from meutils.config_utils.lark_utils import get_next_token_for_polling
13
- from meutils.schemas.image_types import ImageRequest, ImagesResponse
15
+ from meutils.schemas.image_types import ImageRequest, ImagesResponse, HunyuanImageProcessRequest
14
16
  from meutils.schemas.image_types import ImageProcess
17
+ from meutils.schemas.yuanbao_types import YUANBAO_BASE_URL, FEISHU_URL as YUANBAO_FEISHU_URL
15
18
 
16
19
  from meutils.io.files_utils import to_bytes, to_base64, to_url_fal
17
20
 
@@ -28,6 +31,50 @@ send_message = partial(
28
31
  )
29
32
 
30
33
 
34
+ @retrying(min=3, ignored_exception_types=(IgnoredRetryException,))
35
+ async def make_request_for_hunyuan(payload, token: Optional[str] = None, response_format: str = "url"):
36
+ s = time.time()
37
+
38
+ token = token or await get_next_token_for_polling(YUANBAO_FEISHU_URL)
39
+
40
+ model = payload.pop("model", "removewatermark")
41
+
42
+ logger.debug(payload)
43
+
44
+ headers = {
45
+ 'cookie': token
46
+ }
47
+ async with httpx.AsyncClient(base_url=YUANBAO_BASE_URL, headers=headers, timeout=100) as client:
48
+ response = await client.post(f"/api/image/{model}", json=payload)
49
+ response.raise_for_status()
50
+ logger.debug(response.text)
51
+
52
+ skip_strings = ['DONE', 'TRACEID']
53
+ data = response.text.replace(r'\u0026', '&').splitlines() | xsse_parser(skip_strings=skip_strings)
54
+ data = data and data[-1]
55
+ logger.debug(data)
56
+
57
+ # todo: 错误处理
58
+ if isinstance(data, dict) and any(data["code"] == code for code in {"429"}):
59
+ Exception(f"重试: {response.text}")
60
+
61
+ elif isinstance(data, list) or any(i in response.text for i in {"当前图片没有检测到水印"}): # 跳过重试并返回原始错误
62
+ raise IgnoredRetryException(f"忽略重试: \n{response.text}")
63
+
64
+ data = [
65
+ {
66
+ "url": data["imageUrl"],
67
+ "imageUrl": data["imageUrl"],
68
+ "thumbnailUrl": data["thumbnailUrl"],
69
+ }
70
+ ]
71
+ if response_format == "url":
72
+ return ImagesResponse(data=data, timings={"inference": time.time() - s})
73
+ else:
74
+ data[0]["b64_json"] = await to_base64(data[0]['url'])
75
+ return ImagesResponse(data=data, timings={"inference": time.time() - s})
76
+
77
+
31
78
  async def make_request_for_gitee(payload, token: Optional[str] = None, response_format: str = "url"):
32
79
  s = time.time()
33
80
  feishu_url = "https://xchatllm.feishu.cn/sheets/MekfsfVuohfUf1tsWV0cCvTmn3c?sheet=PDnO6X"
@@ -83,6 +130,8 @@ async def make_request_for_baidu(payload, token: Optional[str] = None, response_
83
130
  except Exception as e:
84
131
  logger.error(e)
85
132
  if i > 3: break
133
+ if not image_base64:
134
+ raise Exception(f"未检测到: {data}")
86
135
 
87
136
  if response_format == "url":
88
137
  url = await to_url_fal(image_base64, content_type="image/png")
@@ -102,18 +151,18 @@ async def edit_image(request: ImageProcess):
102
151
  }
103
152
 
104
153
  if request.model == "remove-watermark":
105
- if mask:
154
+ if mask: ####### todo: mask 抠图
106
155
  payload['type'] = "2"
107
- return await make_request_for_baidu(payload)
156
+ return await make_request_for_baidu(payload, response_format=request.response_format)
108
157
 
109
158
  elif request.model == "clarity":
110
159
  payload['type'] = "3"
111
- return await make_request_for_baidu(payload)
160
+ return await make_request_for_baidu(payload, response_format=request.response_format)
112
161
 
113
162
  elif request.model == "expand":
114
163
  payload['type'] = "4"
115
164
  payload['ext_ratio'] = request.aspect_ratio
116
- return await make_request_for_baidu(payload)
165
+ return await make_request_for_baidu(payload, response_format=request.response_format)
117
166
  ################################################################################################
118
167
 
119
168
  elif request.model == "rmbg-2.0":
@@ -123,15 +172,34 @@ async def edit_image(request: ImageProcess):
123
172
  }
124
173
  return await make_request_for_gitee(payload, response_format=request.response_format)
125
174
 
175
+ elif request.model.startswith("hunyuan-"):
176
+ payload = {
177
+ "imageUrl": request.image if request.image.startswith("http") else await to_url_fal(request.image),
178
+ }
179
+ # "remove-watermark" "clarity"
180
+ if "remove-watermark" in request.model:
181
+ payload["model"] = "removewatermark"
182
+ elif "clarity" in request.model:
183
+ payload["model"] = "clarity"
184
+
185
+ return await make_request_for_hunyuan(payload, response_format=request.response_format)
186
+
126
187
 
127
188
  if __name__ == '__main__':
128
189
  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"
190
+ # hunyuan
191
+ token = "web_uid=ac283ec7-4bf6-40c9-a0ce-5a2e0cd7db06; hy_source=web; hy_user=I09MgMfFcUUyVSIg; hy_token=hevVCi/QuVjQcre5NDRMO7FuiWCZoDMIq3Zp8IwNxrPUofl4zWYazHEdeZ2S5o7q; _qimei_q36=; _qimei_h38=f2d27f50f0f23e085296d28303000006a17a09; _qimei_fingerprint=efbb885a22f7d4e5589008c28bc8e7ba; _qimei_uuid42=18c0310102d1002a082420cd40bb9717523c3c7e12; _gcl_au=1.1.915258067.1733278380; _ga_RPMZTEBERQ=GS1.1.1733722091.3.1.1733722108.0.0.0; _ga=GA1.2.981511920.1725261466; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22100000458739%22%2C%22first_id%22%3A%22191b198c7b2d52-0fcca8d731cb9b8-18525637-2073600-191b198c7b31fd9%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%A4%BE%E4%BA%A4%E7%BD%91%E7%AB%99%E6%B5%81%E9%87%8F%22%2C%22%24latest_utm_medium%22%3A%22cpc%22%7D%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMTkxYjE5OGM3YjJkNTItMGZjY2E4ZDczMWNiOWI4LTE4NTI1NjM3LTIwNzM2MDAtMTkxYjE5OGM3YjMxZmQ5IiwiJGlkZW50aXR5X2xvZ2luX2lkIjoiMTAwMDAwNDU4NzM5In0%3D%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%24identity_login_id%22%2C%22value%22%3A%22100000458739%22%7D%2C%22%24device_id%22%3A%22191b198c7b2d52-0fcca8d731cb9b8-18525637-2073600-191b198c7b31fd9%22%7D"
129
192
 
130
193
  url = "https://oss.ffire.cc/files/kling_watermark.png"
194
+ url = "https://oss.ffire.cc/files/shuiyin.jpg"
195
+ url = "https://oss.ffire.cc/files/shuiyin3.jpg"
196
+
131
197
  # 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
198
 
133
199
  request = ImageProcess(
134
- model="remove-watermark",
200
+ model="hunyuan-remove-watermark",
201
+
202
+ # model="remove-watermark",
135
203
  # model="clarity",
136
204
  # model="expand",
137
205
  # model="rmbg-2.0",
@@ -143,10 +143,10 @@ if __name__ == '__main__':
143
143
  **data
144
144
  )
145
145
 
146
- with timer():
147
- arun(generate(request, token=token))
146
+ # with timer():
147
+ # arun(generate(request, token=token))
148
148
  # tokens = [token]
149
149
 
150
- # tokens = list(arun(aget_spreadsheet_values(feishu_url=FEISHU_URL, to_dataframe=True))[0]) | xfilter_
151
- #
152
- # r = arun(check_token(tokens))
150
+ tokens = list(arun(aget_spreadsheet_values(feishu_url=FEISHU_URL, to_dataframe=True))[0]) | xfilter_
151
+
152
+ r = arun(check_token(tokens))
@@ -11,13 +11,9 @@ from openai import AsyncClient
11
11
 
12
12
  from meutils.pipe import *
13
13
  from meutils.hash_utils import md5
14
- from meutils.schemas.image_types import ImageRequest
15
14
  from meutils.schemas.openai_types import TTSRequest
16
15
 
17
16
  from meutils.schemas.jimeng_types import BASE_URL, MODELS_MAP
18
- from meutils.str_utils.regular_expression import parse_url
19
- from meutils.apis.jimeng.files import upload
20
- from meutils.io.files_utils import to_bytes
21
17
  from meutils.caches.redis_cache import cache
22
18
 
23
19
  from fake_useragent import UserAgent
@@ -25,7 +21,7 @@ from fake_useragent import UserAgent
25
21
  ua = UserAgent()
26
22
 
27
23
 
28
- def get_headers(url, token="693701c43e477b7c405cc7e2fef0ddbd"):
24
+ def get_headers(url, token: str = "693701c43e477b7c405cc7e2fef0ddbd"):
29
25
  device_time = f"{int(time.time())}"
30
26
  sign = md5(
31
27
  # f"9e2c|receive|7|5.8.0|{device_time}||11ac"
@@ -98,149 +94,7 @@ async def check_token(token, threshold: int = 1):
98
94
  return False
99
95
 
100
96
 
101
- async def create_draft_content(request: ImageRequest, token: str):
102
- """
103
- 创建草稿内容
104
- """
105
- request.model = MODELS_MAP.get(request.model, MODELS_MAP["default"])
106
97
 
107
- height = width = 1360
108
- if 'x' in request.size:
109
- height, width = map(int, request.size.split('x'))
110
-
111
- main_component_id = str(uuid.uuid4())
112
-
113
- if urls := parse_url(request.prompt):
114
- url = urls[-1]
115
- upload_token = await get_upload_token(token)
116
- image_uri = upload(await to_bytes(url), upload_token)
117
-
118
- request.prompt = request.prompt.replace(url, '')
119
- request.model = "high_aes_general_v20_L:general_v2.0_L" # 2.1不支持图片编辑
120
-
121
- component = {
122
- "type": "image_base_component",
123
- "id": main_component_id,
124
- "min_version": "3.0.2",
125
- "generate_type": "blend",
126
- "aigc_mode": "workbench",
127
- "abilities": {
128
- "type": "",
129
- "id": str(uuid.uuid4()),
130
- "blend": {
131
- "type": "",
132
- "id": str(uuid.uuid4()),
133
- "core_param": {
134
- "type": "",
135
- "id": str(uuid.uuid4()),
136
- "model": request.model,
137
- "prompt": f"##{request.prompt}",
138
- "sample_strength": 0.5,
139
- "image_ratio": 1,
140
- "large_image_info": {
141
- "type": "",
142
- "id": str(uuid.uuid4()),
143
- "height": height,
144
- "width": width
145
- },
146
- },
147
- "ability_list": [
148
- {
149
- "type": "",
150
- "id": str(uuid.uuid4()),
151
- "name": "byte_edit",
152
- "image_uri_list": [
153
- image_uri
154
- ],
155
- "image_list": [
156
- {
157
- "type": "image",
158
- "id": str(uuid.uuid4()),
159
- "source_from": "upload",
160
- "platform_type": 1,
161
- "name": "",
162
- "image_uri": image_uri,
163
- "width": 0,
164
- "height": 0,
165
- "format": "",
166
- "uri": image_uri
167
- }
168
- ],
169
- "strength": 0.5
170
- }
171
- ],
172
- "history_option": {
173
- "type": "",
174
- "id": str(uuid.uuid4()),
175
- },
176
- "prompt_placeholder_info_list": [
177
- {
178
- "type": "",
179
- "id": str(uuid.uuid4()),
180
- "ability_index": 0
181
- }
182
- ],
183
- "postedit_param": {
184
- "type": "",
185
- "id": str(uuid.uuid4()),
186
- "generate_type": 0
187
- }
188
- }
189
- }
190
- }
191
-
192
- else:
193
-
194
- component = {
195
- "type": "image_base_component",
196
- "id": main_component_id,
197
- "min_version": "3.0.2",
198
- "generate_type": "generate",
199
- "aigc_mode": "workbench",
200
- "abilities": {
201
- "type": "",
202
- "id": str(uuid.uuid4()),
203
- "generate": {
204
- "type": "",
205
- "id": str(uuid.uuid4()),
206
- "core_param": {
207
- "type": "",
208
- "id": str(uuid.uuid4()),
209
- "model": request.model,
210
- "prompt": request.prompt,
211
- "negative_prompt": request.negative_prompt or "",
212
- "seed": request.seed or 426999300,
213
- "sample_strength": 0.5,
214
- "image_ratio": 1,
215
- "large_image_info": {
216
- "type": "",
217
- "id": str(uuid.uuid4()),
218
- "height": height,
219
- "width": width
220
- }
221
- },
222
- "history_option": {
223
- "type": "",
224
- "id": str(uuid.uuid4()),
225
- }
226
- }
227
- }
228
- }
229
-
230
- draft_content = {
231
- "type": "draft",
232
- "id": str(uuid.uuid4()),
233
- "min_version": "3.0.2",
234
- "min_features": [],
235
- "is_from_tsn": True,
236
- "version": "3.0.8",
237
- "main_component_id": main_component_id,
238
- "component_list": [component]
239
- }
240
-
241
- logger.debug(bjson(draft_content))
242
-
243
- return draft_content
244
98
 
245
99
 
246
100
  def create_photo_lip_sync(request: TTSRequest):
@@ -319,6 +173,7 @@ if __name__ == '__main__':
319
173
  token = "dcf7bbc31faed9740b0bf748cd4d2c74"
320
174
  token = "38d7d300b5e0a803431ef88d8d2acfef"
321
175
  token = "916fed81175f5186a2c05375699ea40d"
176
+ token = "7c5e148d9fa858e3180c42f843c20454"
322
177
  # arun(get_credit(token))
323
178
  arun(check_token(token))
324
179
 
@@ -13,13 +13,13 @@ from meutils.pipe import *
13
13
  from meutils.apis.jimeng.doubao_utils import generate_cookie
14
14
 
15
15
  from meutils.schemas.image_types import ImageRequest
16
- from meutils.schemas.task_types import TaskResponse
16
+
17
17
  from meutils.schemas.jimeng_types import BASE_URL, MODELS_MAP, FEISHU_URL
18
18
  from meutils.apis.jimeng.common import create_draft_content, get_headers, check_token
19
19
  from meutils.config_utils.lark_utils import get_next_token_for_polling
20
20
 
21
21
 
22
- async def create():
22
+ async def create_():
23
23
  headers = {
24
24
  'agw-js-conv': 'str',
25
25
  'Cookie': 's_v_web_id=verify_m4t9wrdc_qgbhUw0z_07iP_4GFV_8HA7_6jr0e9lLCqQO; passport_csrf_token=8a8aa82fa109ecb3cb25e7afa10de214; passport_csrf_token_default=8a8aa82fa109ecb3cb25e7afa10de214; oauth_token=e45378cb-5afd-4495-88f5-58440e321b48; n_mh=lG4jjJNpPRqpnflIMXQoPMflNZdP31M8fFqgdR9Id5g; uid_tt=1a11a8af13cf1c878482fa862287107c; uid_tt_ss=1a11a8af13cf1c878482fa862287107c; sid_tt=de2215a7bb8e442774cf388f03fac84c; sessionid=de2215a7bb8e442774cf388f03fac84c; sessionid_ss=de2215a7bb8e442774cf388f03fac84c; is_staff_user=false; store-region=cn-js; store-region-src=uid; odin_tt=774fcc6d25d5259fd2af19858e0518c64943eb788718658b403ad8eb13ebbc6ebcb4c42620e87a48b2efb45fe78dc163b82399750898bb201c89f324b9e25b94; passport_auth_status=042935fbff60617ac0735d3ba4cfb559%2C7c535e1ccd98b367728b6560feb66a2e; passport_auth_status_ss=042935fbff60617ac0735d3ba4cfb559%2C7c535e1ccd98b367728b6560feb66a2e; sid_guard=de2215a7bb8e442774cf388f03fac84c%7C1734489199%7C5184000%7CSun%2C+16-Feb-2025+02%3A33%3A19+GMT; sid_ucp_v1=1.0.0-KGQyN2NlYjIxNTA1NTc3ZjI3NWQ2MjZkY2FhNGM3MGM0NzdkNGVjZDMKHwjAreC708zWBBDv6Ii7BhjCsR4gDDDn782qBjgIQCYaAmxxIiBkZTIyMTVhN2JiOGU0NDI3NzRjZjM4OGYwM2ZhYzg0Yw; ssid_ucp_v1=1.0.0-KGQyN2NlYjIxNTA1NTc3ZjI3NWQ2MjZkY2FhNGM3MGM0NzdkNGVjZDMKHwjAreC708zWBBDv6Ii7BhjCsR4gDDDn782qBjgIQCYaAmxxIiBkZTIyMTVhN2JiOGU0NDI3NzRjZjM4OGYwM2ZhYzg0Yw; ttwid=1%7C4rAQ216JOophOdIJRX4cHa6E8FSBjbjqHCKmFCNrQuc%7C1734510550%7C6217dce55189d102c393a4de7022e9ee2e2fa75f211108551b349a0a04532921; passport_fe_beating_status=true; tt_scid=b.csKGNI6QALEo8gG9vJu3nCfptGnLkTxVXPX.wNPQ0q9PaXuKzXfuFQC0i2U7gVa974; gd_random_1831913=eyJtYXRjaCI6ZmFsc2UsInBlcmNlbnQiOjAuMjIzMzcxMDAwNzk1MzUxNzd9.NuOx3z2e4BUOJrwTMG9F3lxrnhmz9jNR6BrhQYU4BhI; gd_random_1525008=eyJtYXRjaCI6ZmFsc2UsInBlcmNlbnQiOjAuMjIzMzcxMDAwNzk1MzUxNzd9.NuOx3z2e4BUOJrwTMG9F3lxrnhmz9jNR6BrhQYU4BhI; gd_random_1831904=eyJtYXRjaCI6ZmFsc2UsInBlcmNlbnQiOjAuMjIzMzcxMDAwNzk1MzUxNzd9.NuOx3z2e4BUOJrwTMG9F3lxrnhmz9jNR6BrhQYU4BhI; msToken=enism5q1i_XLtL8VKKjkjidcvGhyW0U3EGJBI19P3fyqk8NsW4fXW4g8s4TnlgRaF-aWS0kHrmNnENw5L4mFRyyz6A5yZbpR3nCRYJrvBi3-GrtptyOBhznILSv4OO0',