@lingjingai/lj-awb-cli 0.4.5 → 0.4.8

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.
@@ -1,5 +1,4 @@
1
1
  import { fetchProjectGroupUsers, fetchTeams, fetchUserInfo } from './api.js';
2
- import * as artifact from './artifact.js';
3
2
  import { clearAuth, loadAuth, saveAccessKey, summarizeAuth } from './auth.js';
4
3
  import { LingjingAwbCliError, maskSecret, toBool, trimSecret } from './common.js';
5
4
  import { runCliUpdate } from './update.js';
@@ -14,6 +13,8 @@ import {
14
13
  authLogin,
15
14
  authLogout,
16
15
  creditsBalance,
16
+ creditsBuy,
17
+ creditsRedeem,
17
18
  creditsUsageSummary,
18
19
  createProjectGroupCommand,
19
20
  accountInfo,
@@ -114,7 +115,6 @@ const BODY_INPUT_ARGS = [
114
115
  { name: 'body-json', valueName: 'json', description: '直接传接口 body JSON' },
115
116
  { name: 'input-file', valueName: 'path', description: '从本地 JSON 文件读取接口 body' },
116
117
  ];
117
- const ARTIFACT_WRITE_ARGS = [DRY_RUN_ARG, YES_ARG];
118
118
 
119
119
  export function registerAwbCommands(cli) {
120
120
  cli({
@@ -291,9 +291,9 @@ export function registerAwbCommands(cli) {
291
291
  });
292
292
 
293
293
  cli({
294
- name: 'project use',
294
+ name: 'project switch',
295
295
  description: commandHelp('切换当前项目组;后续生成任务会归属到该项目组', {
296
- examples: ['lj-awb project use --project-group-no <no> --dry-run', 'lj-awb project use --project-group-no <no> --yes'],
296
+ examples: ['lj-awb project switch --project-group-no <no> --dry-run', 'lj-awb project switch --project-group-no <no> --yes'],
297
297
  }),
298
298
  args: [
299
299
  PROJECT_GROUP_ARG,
@@ -398,6 +398,33 @@ export function registerAwbCommands(cli) {
398
398
  func: async (_ctx, kwargs) => creditsUsageSummary(kwargs),
399
399
  });
400
400
 
401
+ cli({
402
+ name: 'credits buy',
403
+ description: commandHelp('引导购买 / 充值:按当前环境(预发 / 正式)输出充值页面链接', {
404
+ examples: ['lj-awb credits buy'],
405
+ hint: '只输出充值链接,不发起网络请求;请在浏览器中打开链接完成购买。链接随构建环境写死,预发与正式各自指向对应工作台域名。',
406
+ }),
407
+ args: [],
408
+ func: async () => creditsBuy(),
409
+ });
410
+
411
+ cli({
412
+ name: 'credits redeem',
413
+ description: commandHelp('兑换码兑换:等待输入兑换码并调用平台兑换接口,成功后展示最新积分余额', {
414
+ examples: [
415
+ 'lj-awb credits redeem',
416
+ 'lj-awb credits redeem --code <code>',
417
+ ],
418
+ hint: '不传 --code 时进入交互模式,最长等待约 10 分钟读取兑换码(自动去除空格 / 换行);非交互终端必须用 --code 传入。兑换成功后会顺带展示当前积分余额。',
419
+ }),
420
+ args: [
421
+ { name: 'code', valueName: 'code', description: '兑换码;不传则交互式等待输入' },
422
+ { name: 'wait-seconds', valueName: 'seconds', description: '交互模式下等待输入兑换码的最长秒数,默认 600' },
423
+ DRY_RUN_ARG,
424
+ ],
425
+ func: async (_ctx, kwargs) => creditsRedeem(kwargs),
426
+ });
427
+
401
428
  cli({
402
429
  name: 'model image-models',
403
430
  description: commandHelp('查询可用生图模型', {
@@ -899,462 +926,6 @@ export function registerAwbCommands(cli) {
899
926
  func: async (_ctx, kwargs) => assetRegister(kwargs),
900
927
  });
901
928
 
902
- const ARTIFACT_ROW_KIND_ARG = { name: 'row-kind', valueName: 'kind', description: 'document/asset/state/speaker/episode/scene/action' };
903
- const ARTIFACT_ENTITY_KEY_ARG = { name: 'entity-key', valueName: 'key', description: '业务唯一键;可包含 / 和 #' };
904
- const ARTIFACT_EPISODE_ARG = { name: 'episode-id', valueName: 'id', description: '集 ID,例如 ep_001' };
905
- const ARTIFACT_SCENE_ARG = { name: 'scene-id', valueName: 'id', description: '场 ID,例如 scn_001' };
906
- const ARTIFACT_CLIP_ARG = { name: 'clip-id', valueName: 'id', description: 'clip ID,例如 clip_001' };
907
- const ARTIFACT_VIDEO_EPISODE_ID_ARG = { name: 'video-episode-id', valueName: 'id', description: '视频集产物的数字主键,由 artifact video upsert-episode / artifact video episode 返回的 id 字段提供(不是 ep_001 这种业务 ID)' };
908
- const ARTIFACT_INCLUDE_STATES_ARG = { name: 'include-states', valueName: 'bool', description: '是否带 states,默认 true' };
909
-
910
- for (const spec of [
911
- {
912
- name: 'artifact script get',
913
- summary: '查询项目完整剧本最终产物',
914
- examples: ['lj-awb artifact script get --project-id <projectId>'],
915
- args: [PROJECT_ID_ARG],
916
- func: artifact.artifactScriptGet,
917
- },
918
- {
919
- name: 'artifact script document',
920
- summary: '查询剧本 document 根记录',
921
- examples: ['lj-awb artifact script document --project-id <projectId>'],
922
- args: [PROJECT_ID_ARG],
923
- func: artifact.artifactScriptDocument,
924
- },
925
- {
926
- name: 'artifact script rows',
927
- summary: '查询剧本最终产物行列表',
928
- examples: [
929
- 'lj-awb artifact script rows --project-id <projectId> --row-kind scene',
930
- 'lj-awb artifact script rows --project-id <projectId> --row-kind action --parent-key scn_001',
931
- ],
932
- args: [
933
- PROJECT_ID_ARG,
934
- ARTIFACT_ROW_KIND_ARG,
935
- { name: 'parent-key', valueName: 'key', description: '按父节点业务键过滤' },
936
- { name: 'revision-after', valueName: 'n', description: '只查 revisionNo 大于该值的行' },
937
- { name: 'include-deleted', valueName: 'bool', description: '是否包含逻辑删除行,默认 false' },
938
- ],
939
- func: artifact.artifactScriptRows,
940
- },
941
- {
942
- name: 'artifact script row',
943
- summary: '查询单条剧本最终产物行',
944
- examples: ['lj-awb artifact script row --project-id <projectId> --row-kind action --entity-key "ep_001/scn_001#0"'],
945
- args: [PROJECT_ID_ARG, ARTIFACT_ROW_KIND_ARG, ARTIFACT_ENTITY_KEY_ARG],
946
- func: artifact.artifactScriptRow,
947
- },
948
- {
949
- name: 'artifact script children',
950
- summary: '按 parentKey 查询剧本子节点',
951
- examples: ['lj-awb artifact script children --project-id <projectId> --parent-key scn_001 --row-kind action'],
952
- args: [
953
- PROJECT_ID_ARG,
954
- { name: 'parent-key', valueName: 'key', description: '父节点业务键' },
955
- ARTIFACT_ROW_KIND_ARG,
956
- ],
957
- func: artifact.artifactScriptChildren,
958
- },
959
- {
960
- name: 'artifact script upsert-row',
961
- summary: '新增或更新单条剧本最终产物行',
962
- examples: ['lj-awb artifact script upsert-row --project-id <projectId> --input-file ./row.json --dry-run', 'lj-awb artifact script upsert-row --project-id <projectId> --input-file ./row.json --yes'],
963
- args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
964
- func: artifact.artifactScriptUpsertRow,
965
- },
966
- {
967
- name: 'artifact script delete-row',
968
- summary: '逻辑删除单条剧本最终产物行',
969
- examples: ['lj-awb artifact script delete-row --project-id <projectId> --row-kind action --entity-key "ep_001/scn_001#0" --dry-run', 'lj-awb artifact script delete-row --project-id <projectId> --row-kind action --entity-key "ep_001/scn_001#0" --yes'],
970
- args: [PROJECT_ID_ARG, ARTIFACT_ROW_KIND_ARG, ARTIFACT_ENTITY_KEY_ARG, ...ARTIFACT_WRITE_ARGS],
971
- func: artifact.artifactScriptDeleteRow,
972
- },
973
- {
974
- name: 'artifact script import',
975
- summary: '从本地 script.json 拆分并批量导入剧本最终产物',
976
- examples: [
977
- 'lj-awb artifact script import --project-id <projectId> --input-file 1_script/output/script.json --dry-run',
978
- 'lj-awb artifact script import --project-id <projectId> --input-file output/script.json --yes',
979
- ],
980
- args: [
981
- PROJECT_ID_ARG,
982
- { name: 'input-file', valueName: 'path', description: 'script.json 路径,默认 output/script.json' },
983
- ...ARTIFACT_WRITE_ARGS,
984
- ],
985
- func: artifact.artifactScriptImport,
986
- hint: '不传 --input-file 时默认读取当前目录的 output/script.json。',
987
- },
988
- ]) {
989
- cli({
990
- name: spec.name,
991
- description: commandHelp(spec.summary, { examples: spec.examples, hint: spec.hint }),
992
- args: spec.args,
993
- func: async (_ctx, kwargs) => spec.func(kwargs),
994
- });
995
- }
996
-
997
- for (const spec of [
998
- {
999
- name: 'artifact asset get',
1000
- summary: '查询项目完整资产最终产物',
1001
- examples: ['lj-awb artifact asset get --project-id <projectId>'],
1002
- args: [PROJECT_ID_ARG],
1003
- func: artifact.artifactAssetGet,
1004
- },
1005
- {
1006
- name: 'artifact asset actors',
1007
- summary: '查询角色最终产物列表',
1008
- examples: ['lj-awb artifact asset actors --project-id <projectId> --include-states true'],
1009
- args: [PROJECT_ID_ARG, ARTIFACT_INCLUDE_STATES_ARG],
1010
- func: artifact.artifactAssetActors,
1011
- },
1012
- {
1013
- name: 'artifact asset actor',
1014
- summary: '查询单个角色最终产物',
1015
- examples: ['lj-awb artifact asset actor --project-id <projectId> --actor-key act_001'],
1016
- args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, ARTIFACT_INCLUDE_STATES_ARG],
1017
- func: artifact.artifactAssetActor,
1018
- },
1019
- {
1020
- name: 'artifact asset props',
1021
- summary: '查询道具最终产物列表',
1022
- examples: ['lj-awb artifact asset props --project-id <projectId>'],
1023
- args: [PROJECT_ID_ARG, ARTIFACT_INCLUDE_STATES_ARG],
1024
- func: artifact.artifactAssetProps,
1025
- },
1026
- {
1027
- name: 'artifact asset prop',
1028
- summary: '查询单个道具最终产物',
1029
- examples: ['lj-awb artifact asset prop --project-id <projectId> --prop-key prp_001'],
1030
- args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, ARTIFACT_INCLUDE_STATES_ARG],
1031
- func: artifact.artifactAssetProp,
1032
- },
1033
- {
1034
- name: 'artifact asset locations',
1035
- summary: '查询场景最终产物列表',
1036
- examples: ['lj-awb artifact asset locations --project-id <projectId>'],
1037
- args: [PROJECT_ID_ARG, ARTIFACT_INCLUDE_STATES_ARG],
1038
- func: artifact.artifactAssetLocations,
1039
- },
1040
- {
1041
- name: 'artifact asset location',
1042
- summary: '查询单个场景最终产物',
1043
- examples: ['lj-awb artifact asset location --project-id <projectId> --location-key loc_001'],
1044
- args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, ARTIFACT_INCLUDE_STATES_ARG],
1045
- func: artifact.artifactAssetLocation,
1046
- },
1047
- {
1048
- name: 'artifact asset upsert-actor',
1049
- summary: '新增或更新角色最终产物',
1050
- examples: ['lj-awb artifact asset upsert-actor --project-id <projectId> --input-file ./actor.json --dry-run', 'lj-awb artifact asset upsert-actor --project-id <projectId> --input-file ./actor.json --yes'],
1051
- args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1052
- func: artifact.artifactAssetUpsertActor,
1053
- },
1054
- {
1055
- name: 'artifact asset upsert-prop',
1056
- summary: '新增或更新道具最终产物',
1057
- examples: ['lj-awb artifact asset upsert-prop --project-id <projectId> --input-file ./prop.json --dry-run', 'lj-awb artifact asset upsert-prop --project-id <projectId> --input-file ./prop.json --yes'],
1058
- args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1059
- func: artifact.artifactAssetUpsertProp,
1060
- },
1061
- {
1062
- name: 'artifact asset upsert-location',
1063
- summary: '新增或更新场景最终产物',
1064
- examples: ['lj-awb artifact asset upsert-location --project-id <projectId> --input-file ./location.json --dry-run', 'lj-awb artifact asset upsert-location --project-id <projectId> --input-file ./location.json --yes'],
1065
- args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1066
- func: artifact.artifactAssetUpsertLocation,
1067
- },
1068
- {
1069
- name: 'artifact asset upsert-actor-state',
1070
- summary: '新增或更新角色状态最终产物',
1071
- examples: ['lj-awb artifact asset upsert-actor-state --project-id <projectId> --actor-key act_001 --input-file ./state.json --dry-run', 'lj-awb artifact asset upsert-actor-state --project-id <projectId> --actor-key act_001 --input-file ./state.json --yes'],
1072
- args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1073
- func: artifact.artifactAssetUpsertActorState,
1074
- },
1075
- {
1076
- name: 'artifact asset upsert-prop-state',
1077
- summary: '新增或更新道具状态最终产物',
1078
- examples: ['lj-awb artifact asset upsert-prop-state --project-id <projectId> --prop-key prp_001 --input-file ./state.json --dry-run', 'lj-awb artifact asset upsert-prop-state --project-id <projectId> --prop-key prp_001 --input-file ./state.json --yes'],
1079
- args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1080
- func: artifact.artifactAssetUpsertPropState,
1081
- },
1082
- {
1083
- name: 'artifact asset upsert-location-state',
1084
- summary: '新增或更新场景状态最终产物',
1085
- examples: ['lj-awb artifact asset upsert-location-state --project-id <projectId> --location-key loc_001 --input-file ./state.json --dry-run', 'lj-awb artifact asset upsert-location-state --project-id <projectId> --location-key loc_001 --input-file ./state.json --yes'],
1086
- args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1087
- func: artifact.artifactAssetUpsertLocationState,
1088
- },
1089
- {
1090
- name: 'artifact asset delete-actor',
1091
- summary: '逻辑删除角色及其状态最终产物',
1092
- examples: ['lj-awb artifact asset delete-actor --project-id <projectId> --actor-key act_001 --dry-run', 'lj-awb artifact asset delete-actor --project-id <projectId> --actor-key act_001 --yes'],
1093
- args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, ...ARTIFACT_WRITE_ARGS],
1094
- func: artifact.artifactAssetDeleteActor,
1095
- },
1096
- {
1097
- name: 'artifact asset delete-prop',
1098
- summary: '逻辑删除道具及其状态最终产物',
1099
- examples: ['lj-awb artifact asset delete-prop --project-id <projectId> --prop-key prp_001 --dry-run', 'lj-awb artifact asset delete-prop --project-id <projectId> --prop-key prp_001 --yes'],
1100
- args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, ...ARTIFACT_WRITE_ARGS],
1101
- func: artifact.artifactAssetDeleteProp,
1102
- },
1103
- {
1104
- name: 'artifact asset delete-location',
1105
- summary: '逻辑删除场景及其状态最终产物',
1106
- examples: ['lj-awb artifact asset delete-location --project-id <projectId> --location-key loc_001 --dry-run', 'lj-awb artifact asset delete-location --project-id <projectId> --location-key loc_001 --yes'],
1107
- args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, ...ARTIFACT_WRITE_ARGS],
1108
- func: artifact.artifactAssetDeleteLocation,
1109
- },
1110
- {
1111
- name: 'artifact asset delete-actor-state',
1112
- summary: '逻辑删除角色状态最终产物',
1113
- examples: ['lj-awb artifact asset delete-actor-state --project-id <projectId> --actor-key act_001 --state-key default --dry-run', 'lj-awb artifact asset delete-actor-state --project-id <projectId> --actor-key act_001 --state-key default --yes'],
1114
- args: [PROJECT_ID_ARG, { name: 'actor-key', valueName: 'key', description: '角色业务键' }, { name: 'state-key', valueName: 'key', description: '状态业务键' }, ...ARTIFACT_WRITE_ARGS],
1115
- func: artifact.artifactAssetDeleteActorState,
1116
- },
1117
- {
1118
- name: 'artifact asset delete-prop-state',
1119
- summary: '逻辑删除道具状态最终产物',
1120
- examples: ['lj-awb artifact asset delete-prop-state --project-id <projectId> --prop-key prp_001 --state-key default --dry-run', 'lj-awb artifact asset delete-prop-state --project-id <projectId> --prop-key prp_001 --state-key default --yes'],
1121
- args: [PROJECT_ID_ARG, { name: 'prop-key', valueName: 'key', description: '道具业务键' }, { name: 'state-key', valueName: 'key', description: '状态业务键' }, ...ARTIFACT_WRITE_ARGS],
1122
- func: artifact.artifactAssetDeletePropState,
1123
- },
1124
- {
1125
- name: 'artifact asset delete-location-state',
1126
- summary: '逻辑删除场景状态最终产物',
1127
- examples: ['lj-awb artifact asset delete-location-state --project-id <projectId> --location-key loc_001 --state-key default --dry-run', 'lj-awb artifact asset delete-location-state --project-id <projectId> --location-key loc_001 --state-key default --yes'],
1128
- args: [PROJECT_ID_ARG, { name: 'location-key', valueName: 'key', description: '场景业务键' }, { name: 'state-key', valueName: 'key', description: '状态业务键' }, ...ARTIFACT_WRITE_ARGS],
1129
- func: artifact.artifactAssetDeleteLocationState,
1130
- },
1131
- {
1132
- name: 'artifact asset import',
1133
- summary: '从本地 actors/props/locations JSON 批量导入资产最终产物',
1134
- examples: [
1135
- 'lj-awb artifact asset import --project-id <projectId> --input-dir 2_asset/output --dry-run',
1136
- 'lj-awb artifact asset import --project-id <projectId> --actors-file output/actors/actors.json --props-file output/props/props.json --locations-file output/locations/locations.json --yes',
1137
- ],
1138
- args: [
1139
- PROJECT_ID_ARG,
1140
- { name: 'input-dir', valueName: 'path', description: '资产 output 目录,默认 output' },
1141
- { name: 'actors-file', valueName: 'path', description: '可选 actors.json 路径' },
1142
- { name: 'props-file', valueName: 'path', description: '可选 props.json 路径' },
1143
- { name: 'locations-file', valueName: 'path', description: '可选 locations.json 路径' },
1144
- ...ARTIFACT_WRITE_ARGS,
1145
- ],
1146
- func: artifact.artifactAssetImport,
1147
- hint: '默认在 --input-dir 下查找 actors/actors.json、props/props.json、locations/locations.json;也兼容 actors.json 等扁平文件名。',
1148
- },
1149
- ]) {
1150
- cli({
1151
- name: spec.name,
1152
- description: commandHelp(spec.summary, { examples: spec.examples, hint: spec.hint }),
1153
- args: spec.args,
1154
- func: async (_ctx, kwargs) => spec.func(kwargs),
1155
- });
1156
- }
1157
-
1158
- for (const spec of [
1159
- {
1160
- name: 'artifact video get',
1161
- summary: '查询项目完整视频最终产物',
1162
- examples: ['lj-awb artifact video get --project-id <projectId>'],
1163
- args: [PROJECT_ID_ARG],
1164
- func: artifact.artifactVideoGet,
1165
- },
1166
- {
1167
- name: 'artifact video episodes',
1168
- summary: '查询视频集列表',
1169
- examples: ['lj-awb artifact video episodes --project-id <projectId>'],
1170
- args: [PROJECT_ID_ARG],
1171
- func: artifact.artifactVideoEpisodes,
1172
- },
1173
- {
1174
- name: 'artifact video episode',
1175
- summary: '查询单集视频最终产物',
1176
- examples: ['lj-awb artifact video episode --project-id <projectId> --episode-id ep_001'],
1177
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG],
1178
- func: artifact.artifactVideoEpisode,
1179
- },
1180
- {
1181
- name: 'artifact video scenes',
1182
- summary: '查询某集下的场列表',
1183
- examples: ['lj-awb artifact video scenes --project-id <projectId> --episode-id ep_001'],
1184
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG],
1185
- func: artifact.artifactVideoScenes,
1186
- },
1187
- {
1188
- name: 'artifact video scene',
1189
- summary: '查询单场视频最终产物',
1190
- examples: ['lj-awb artifact video scene --project-id <projectId> --episode-id ep_001 --scene-id scn_001'],
1191
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG],
1192
- func: artifact.artifactVideoScene,
1193
- },
1194
- {
1195
- name: 'artifact video clips',
1196
- summary: '查询某场下的 clip 列表',
1197
- examples: ['lj-awb artifact video clips --project-id <projectId> --episode-id ep_001 --scene-id scn_001'],
1198
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG],
1199
- func: artifact.artifactVideoClips,
1200
- },
1201
- {
1202
- name: 'artifact video clip',
1203
- summary: '查询单个 clip 视频最终产物',
1204
- examples: ['lj-awb artifact video clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001'],
1205
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ARTIFACT_CLIP_ARG],
1206
- func: artifact.artifactVideoClip,
1207
- },
1208
- {
1209
- name: 'artifact video upsert-episode',
1210
- summary: '新增或更新视频 episode 最终产物',
1211
- examples: ['lj-awb artifact video upsert-episode --project-id <projectId> --input-file ./episode.json --dry-run', 'lj-awb artifact video upsert-episode --project-id <projectId> --input-file ./episode.json --yes'],
1212
- args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1213
- func: artifact.artifactVideoUpsertEpisode,
1214
- },
1215
- {
1216
- name: 'artifact video upsert-scene',
1217
- summary: '新增或更新视频 scene 最终产物',
1218
- examples: ['lj-awb artifact video upsert-scene --project-id <projectId> --episode-id ep_001 --input-file ./scene.json --dry-run', 'lj-awb artifact video upsert-scene --project-id <projectId> --episode-id ep_001 --input-file ./scene.json --yes'],
1219
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1220
- func: artifact.artifactVideoUpsertScene,
1221
- },
1222
- {
1223
- name: 'artifact video upsert-clip',
1224
- summary: '新增或更新视频 clip 最终产物',
1225
- examples: ['lj-awb artifact video upsert-clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --input-file ./clip.json --dry-run', 'lj-awb artifact video upsert-clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --input-file ./clip.json --yes'],
1226
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1227
- func: artifact.artifactVideoUpsertClip,
1228
- },
1229
- {
1230
- name: 'artifact video update-clip-urls',
1231
- summary: '只回写 clip.videoUrls,不覆盖 payload / prompt / duration',
1232
- examples: [
1233
- 'lj-awb artifact video update-clip-urls --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001 --video-urls-json \'["https://example.com/a.mp4"]\' --dry-run',
1234
- 'lj-awb artifact video update-clip-urls --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001 --video-urls-json \'["https://example.com/a.mp4"]\' --yes',
1235
- ],
1236
- args: [
1237
- PROJECT_ID_ARG,
1238
- ARTIFACT_EPISODE_ARG,
1239
- ARTIFACT_SCENE_ARG,
1240
- ARTIFACT_CLIP_ARG,
1241
- { name: 'video-urls-json', valueName: 'json', description: '视频 URL 数组 JSON' },
1242
- ...ARTIFACT_WRITE_ARGS,
1243
- ],
1244
- func: artifact.artifactVideoUpdateClipVideoUrls,
1245
- },
1246
- {
1247
- name: 'artifact video delete-episode',
1248
- summary: '逻辑删除视频 episode,并级联删除该集 scenes/clips',
1249
- examples: ['lj-awb artifact video delete-episode --project-id <projectId> --episode-id ep_001 --dry-run', 'lj-awb artifact video delete-episode --project-id <projectId> --episode-id ep_001 --yes'],
1250
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ...ARTIFACT_WRITE_ARGS],
1251
- func: artifact.artifactVideoDeleteEpisode,
1252
- },
1253
- {
1254
- name: 'artifact video delete-scene',
1255
- summary: '逻辑删除视频 scene,并级联删除该场 clips',
1256
- examples: ['lj-awb artifact video delete-scene --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --dry-run', 'lj-awb artifact video delete-scene --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --yes'],
1257
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ...ARTIFACT_WRITE_ARGS],
1258
- func: artifact.artifactVideoDeleteScene,
1259
- },
1260
- {
1261
- name: 'artifact video delete-clip',
1262
- summary: '逻辑删除视频 clip',
1263
- examples: ['lj-awb artifact video delete-clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001 --dry-run', 'lj-awb artifact video delete-clip --project-id <projectId> --episode-id ep_001 --scene-id scn_001 --clip-id clip_001 --yes'],
1264
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG, ARTIFACT_SCENE_ARG, ARTIFACT_CLIP_ARG, ...ARTIFACT_WRITE_ARGS],
1265
- func: artifact.artifactVideoDeleteClip,
1266
- },
1267
- {
1268
- name: 'artifact video import-storyboard',
1269
- summary: '从 epXXX_storyboard.json 拆分 episode/scenes/clips 并导入视频最终产物',
1270
- examples: [
1271
- 'lj-awb artifact video import-storyboard --project-id <projectId> --input-file 3_footage/output/ep001/ep001_storyboard.json --dry-run',
1272
- 'lj-awb artifact video import-storyboard --project-id <projectId> --input-file output/ep001/ep001_storyboard.json --yes',
1273
- ],
1274
- args: [PROJECT_ID_ARG, { name: 'input-file', valueName: 'path', description: 'epXXX_storyboard.json 路径' }, ...ARTIFACT_WRITE_ARGS],
1275
- func: artifact.artifactVideoImportStoryboard,
1276
- },
1277
- ]) {
1278
- cli({
1279
- name: spec.name,
1280
- description: commandHelp(spec.summary, { examples: spec.examples }),
1281
- args: spec.args,
1282
- func: async (_ctx, kwargs) => spec.func(kwargs),
1283
- });
1284
- }
1285
-
1286
- for (const spec of [
1287
- {
1288
- name: 'artifact clip get',
1289
- summary: '查询项目完整剪辑最终产物',
1290
- examples: ['lj-awb artifact clip get --project-id <projectId>'],
1291
- args: [PROJECT_ID_ARG],
1292
- func: artifact.artifactClipGet,
1293
- },
1294
- {
1295
- name: 'artifact clip episodes',
1296
- summary: '查询项目剪辑产物列表',
1297
- examples: ['lj-awb artifact clip episodes --project-id <projectId>'],
1298
- args: [PROJECT_ID_ARG],
1299
- func: artifact.artifactClipEpisodes,
1300
- },
1301
- {
1302
- name: 'artifact clip episode',
1303
- summary: '按 videoEpisodeId 查询单集剪辑产物',
1304
- examples: ['lj-awb artifact clip episode --project-id <projectId> --video-episode-id 101'],
1305
- args: [PROJECT_ID_ARG, ARTIFACT_VIDEO_EPISODE_ID_ARG],
1306
- func: artifact.artifactClipEpisode,
1307
- },
1308
- {
1309
- name: 'artifact clip episode-by-id',
1310
- summary: '按业务 episodeId 查询单集剪辑产物',
1311
- examples: ['lj-awb artifact clip episode-by-id --project-id <projectId> --episode-id ep_001'],
1312
- args: [PROJECT_ID_ARG, ARTIFACT_EPISODE_ARG],
1313
- func: artifact.artifactClipEpisodeById,
1314
- },
1315
- {
1316
- name: 'artifact clip upsert-episode',
1317
- summary: '新增或更新单集剪辑最终产物',
1318
- examples: ['lj-awb artifact clip upsert-episode --project-id <projectId> --input-file ./clip-output.json --dry-run', 'lj-awb artifact clip upsert-episode --project-id <projectId> --input-file ./clip-output.json --yes'],
1319
- args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1320
- func: artifact.artifactClipUpsertEpisode,
1321
- },
1322
- {
1323
- name: 'artifact clip upsert-batch',
1324
- summary: '批量新增或更新剪辑最终产物',
1325
- examples: ['lj-awb artifact clip upsert-batch --project-id <projectId> --input-file ./clip-output-list.json --dry-run', 'lj-awb artifact clip upsert-batch --project-id <projectId> --input-file ./clip-output-list.json --yes'],
1326
- args: [PROJECT_ID_ARG, ...BODY_INPUT_ARGS, ...ARTIFACT_WRITE_ARGS],
1327
- func: artifact.artifactClipUpsertBatch,
1328
- },
1329
- {
1330
- name: 'artifact clip update-status',
1331
- summary: '只更新剪辑产物 status;messages 非空时覆盖',
1332
- examples: ['lj-awb artifact clip update-status --project-id <projectId> --video-episode-id 101 --status music_success --messages-json \'[{"level":"info","step":"music","message":"配乐完成"}]\' --dry-run'],
1333
- args: [
1334
- PROJECT_ID_ARG,
1335
- ARTIFACT_VIDEO_EPISODE_ID_ARG,
1336
- { name: 'status', valueName: 'status', description: '剪辑阶段状态,例如 concat_success / music_success / burn_success' },
1337
- { name: 'messages-json', valueName: 'json', description: '可选 messages 数组 JSON;传入时覆盖原 messages' },
1338
- ...ARTIFACT_WRITE_ARGS,
1339
- ],
1340
- func: artifact.artifactClipUpdateStatus,
1341
- },
1342
- {
1343
- name: 'artifact clip delete-episode',
1344
- summary: '逻辑删除单集剪辑最终产物',
1345
- examples: ['lj-awb artifact clip delete-episode --project-id <projectId> --video-episode-id 101 --dry-run', 'lj-awb artifact clip delete-episode --project-id <projectId> --video-episode-id 101 --yes'],
1346
- args: [PROJECT_ID_ARG, ARTIFACT_VIDEO_EPISODE_ID_ARG, ...ARTIFACT_WRITE_ARGS],
1347
- func: artifact.artifactClipDeleteEpisode,
1348
- },
1349
- ]) {
1350
- cli({
1351
- name: spec.name,
1352
- description: commandHelp(spec.summary, { examples: spec.examples }),
1353
- args: spec.args,
1354
- func: async (_ctx, kwargs) => spec.func(kwargs),
1355
- });
1356
- }
1357
-
1358
929
  cli({
1359
930
  name: 'create subject-list',
1360
931
  description: commandHelp('查询可用于视频主体参考的元素 / 主体', {
@@ -11,6 +11,18 @@ export const API_ORIGIN = (
11
11
  || process.env.AWB_BASE_URL
12
12
  || DEFAULT_API_ORIGIN
13
13
  ).replace(/\/+$/, '');
14
+ // 充值 / 购买引导页面链接:随构建环境写死,预发和正式分别指向各自的工作台域名。
15
+ export const PURCHASE_URL_PRE = 'https://animeworkbench-pre.lingjingai.cn/platform/creation?openModal=RechargeModal';
16
+ export const PURCHASE_URL_PROD = 'https://animeworkbench.lingjingai.cn/platform/creation?openModal=RechargeModal';
17
+
18
+ export function resolvePurchaseUrl() {
19
+ const isPre = API_ORIGIN.includes('animeworkbench-pre') || API_ORIGIN.includes('-pre.');
20
+ return {
21
+ environment: isPre ? 'pre' : 'prod',
22
+ purchaseUrl: isPre ? PURCHASE_URL_PRE : PURCHASE_URL_PROD,
23
+ };
24
+ }
25
+
14
26
  export const APP_HOME_DIR = process.env.LINGJING_AWB_STATE_DIR || process.env.ANIME_STATE_DIR || path.join(os.homedir(), '.lingjingai', 'awb');
15
27
  export const AUTH_PATH = process.env.LINGJING_AWB_AUTH_PATH || process.env.ANIME_AUTH_PATH || path.join(APP_HOME_DIR, 'auth.json');
16
28
  export const STATE_PATH = process.env.LINGJING_AWB_STATE_PATH || process.env.ANIME_STATE_PATH || path.join(APP_HOME_DIR, 'state.json');