@aiyiran/myclaw 1.1.188 → 1.1.191
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.
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"provider": "minimax_image",
|
|
18
18
|
"model": "image-01",
|
|
19
19
|
"base_url": "https://api.minimaxi.com/v1",
|
|
20
|
-
"api_key": "sk-cp-
|
|
20
|
+
"api_key": "sk-cp-dZnzWB-ScLfjo8bO7DKTqSutkBXQsLWUmjhNDBRkgJd5e42qcE7z8J9i5m27V28eX-dYfo5Q7JNVG4XVsDi1zRxkIFZ4fT0DPGPJY7cHbqY5aBzJO1c6QVA"
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
"music": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"provider": "minimax_music",
|
|
26
26
|
"model": "music-2.6",
|
|
27
27
|
"base_url": "https://api.minimaxi.com/v1",
|
|
28
|
-
"api_key": "sk-cp-
|
|
28
|
+
"api_key": "sk-cp-dZnzWB-ScLfjo8bO7DKTqSutkBXQsLWUmjhNDBRkgJd5e42qcE7z8J9i5m27V28eX-dYfo5Q7JNVG4XVsDi1zRxkIFZ4fT0DPGPJY7cHbqY5aBzJO1c6QVA"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
31
|
"video": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"provider": "minimax_video",
|
|
34
34
|
"model": "MiniMax-Hailuo-2.3",
|
|
35
35
|
"base_url": "https://api.minimaxi.com/v1",
|
|
36
|
-
"api_key": "sk-cp-
|
|
36
|
+
"api_key": "sk-cp-dZnzWB-ScLfjo8bO7DKTqSutkBXQsLWUmjhNDBRkgJd5e42qcE7z8J9i5m27V28eX-dYfo5Q7JNVG4XVsDi1zRxkIFZ4fT0DPGPJY7cHbqY5aBzJO1c6QVA"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"provider": "jimeng_video",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"provider": "minimax_video",
|
|
48
48
|
"model": "MiniMax-Hailuo-2.3-Fast",
|
|
49
49
|
"base_url": "https://api.minimaxi.com/v1",
|
|
50
|
-
"api_key": "sk-cp-
|
|
50
|
+
"api_key": "sk-cp-dZnzWB-ScLfjo8bO7DKTqSutkBXQsLWUmjhNDBRkgJd5e42qcE7z8J9i5m27V28eX-dYfo5Q7JNVG4XVsDi1zRxkIFZ4fT0DPGPJY7cHbqY5aBzJO1c6QVA"
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
}
|
|
@@ -55,11 +55,19 @@ def ratio_to_size(ratio_str, max_dim=2048):
|
|
|
55
55
|
return w, h
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
# 供应商缩写:文件名统一格式 {name}_{缩写}_...
|
|
59
|
+
PROVIDER_ABBR = {
|
|
60
|
+
"jimeng": "JM",
|
|
61
|
+
"minimax": "MM",
|
|
62
|
+
"vapi": "VP",
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def make_output_path(out_dir, name, resource_type, params, ext, provider=None):
|
|
59
67
|
"""Generate filename with Chinese name and key parameters.
|
|
60
68
|
|
|
61
|
-
Format: {name}_{params}_{timestamp}.{ext}
|
|
62
|
-
Example: 日落风景
|
|
69
|
+
Format: {name}_{provider_abbr}_{params}_{timestamp}.{ext}
|
|
70
|
+
Example: 日落风景_JM_2048x1152_20260414_123456.png
|
|
63
71
|
"""
|
|
64
72
|
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
65
73
|
|
|
@@ -74,6 +82,10 @@ def make_output_path(out_dir, name, resource_type, params, ext):
|
|
|
74
82
|
param_parts.append("instrumental")
|
|
75
83
|
|
|
76
84
|
parts = [name]
|
|
85
|
+
if provider:
|
|
86
|
+
# jimeng_image → JM, minimax_video → MM
|
|
87
|
+
key = provider.split("_")[0]
|
|
88
|
+
parts.append(PROVIDER_ABBR.get(key, key.upper()))
|
|
77
89
|
if param_parts:
|
|
78
90
|
parts.extend(param_parts)
|
|
79
91
|
parts.append(ts)
|
|
@@ -233,17 +245,19 @@ def main():
|
|
|
233
245
|
# User specified output path - use it directly
|
|
234
246
|
kwargs["output_path"] = args.output
|
|
235
247
|
else:
|
|
236
|
-
# Auto-naming:
|
|
248
|
+
# Auto-naming: 先写到 hide- 临时名(不进作品列表),生成完拿到
|
|
249
|
+
# used_provider 后再 rename 成带供应商缩写的正式名。供应商只有 dispatch
|
|
250
|
+
# 返回后才知道(有 fallback),故命名必须后置。
|
|
237
251
|
import tempfile
|
|
238
|
-
with tempfile.NamedTemporaryFile(delete=False, suffix=f".{ext}", dir=out_dir) as tmp:
|
|
239
|
-
|
|
240
|
-
kwargs["output_path"] = tmp_path
|
|
252
|
+
with tempfile.NamedTemporaryFile(delete=False, prefix="hide-tmp-", suffix=f".{ext}", dir=out_dir) as tmp:
|
|
253
|
+
kwargs["output_path"] = tmp.name
|
|
241
254
|
|
|
242
255
|
files, used_provider = dispatch(args.type, args.prompt, **kwargs)
|
|
243
256
|
|
|
244
|
-
# Rename with
|
|
257
|
+
# Rename with provider abbr (auto-naming only)
|
|
245
258
|
if not args.output:
|
|
246
|
-
proper_path = make_output_path(out_dir, args.name, args.type, kwargs, ext
|
|
259
|
+
proper_path = make_output_path(out_dir, args.name, args.type, kwargs, ext,
|
|
260
|
+
provider=used_provider.get("provider"))
|
|
247
261
|
import shutil
|
|
248
262
|
shutil.move(files[0], proper_path)
|
|
249
263
|
files = [proper_path]
|