@aiyiran/myclaw 1.1.190 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.190",
3
+ "version": "1.1.191",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -55,11 +55,19 @@ def ratio_to_size(ratio_str, max_dim=2048):
55
55
  return w, h
56
56
 
57
57
 
58
- def make_output_path(out_dir, name, resource_type, params, ext):
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: 日落风景_2048x1152_20260414_123456.png
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,11 +245,23 @@ def main():
233
245
  # User specified output path - use it directly
234
246
  kwargs["output_path"] = args.output
235
247
  else:
236
- # Auto-naming: generate proper path directly
237
- kwargs["output_path"] = make_output_path(out_dir, args.name, args.type, kwargs, ext)
248
+ # Auto-naming: 先写到 hide- 临时名(不进作品列表),生成完拿到
249
+ # used_provider 后再 rename 成带供应商缩写的正式名。供应商只有 dispatch
250
+ # 返回后才知道(有 fallback),故命名必须后置。
251
+ import tempfile
252
+ with tempfile.NamedTemporaryFile(delete=False, prefix="hide-tmp-", suffix=f".{ext}", dir=out_dir) as tmp:
253
+ kwargs["output_path"] = tmp.name
238
254
 
239
255
  files, used_provider = dispatch(args.type, args.prompt, **kwargs)
240
256
 
257
+ # Rename with provider abbr (auto-naming only)
258
+ if not args.output:
259
+ proper_path = make_output_path(out_dir, args.name, args.type, kwargs, ext,
260
+ provider=used_provider.get("provider"))
261
+ import shutil
262
+ shutil.move(files[0], proper_path)
263
+ files = [proper_path]
264
+
241
265
  end_dt = datetime.now()
242
266
  log_entry.update({
243
267
  "status": "success",