@lingjingai/lj-awb-cli-pre 0.3.16 → 0.3.18
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/README.md +10 -13
- package/package.json +1 -1
- package/packages/awb-cli/README.md +0 -3
- package/packages/awb-cli/package.json +2 -2
- package/packages/awb-core/package.json +1 -1
- package/packages/awb-core/src/api.js +9 -2
- package/packages/awb-core/src/auth.js +1 -1
- package/packages/awb-core/src/commands.js +42 -15
- package/packages/awb-core/src/common.js +3 -2
- package/packages/awb-core/src/output.js +147 -83
- package/packages/awb-core/src/services.js +118 -41
- package/packages/awb-core/src/standalone.js +114 -20
- package/skills/lj-awb/SKILL.md +5 -2
- package/skills/lj-awb/VERSION +1 -1
- package/skills/lj-awb/compat.json +3 -3
- package/skills/lj-awb/modules/asset.md +25 -18
- package/skills/lj-awb/modules/auth.md +1 -1
- package/skills/lj-awb/modules/create-contract.md +1 -1
- package/skills/lj-awb/modules/create.md +1 -0
- package/skills/lj-awb/modules/driver.md +17 -3
- package/skills/lj-awb/modules/model.md +12 -1
- package/skills/lj-awb/modules/subject.md +4 -4
- package/skills/lj-awb/modules/task-manual.md +4 -3
- package/skills/lj-awb/modules/upload.md +5 -3
- package/skills/lj-awb/modules/workflows.md +26 -21
- package/skills/lj-awb/references/error-codes.md +1 -1
- package/skills/lj-awb/references/model-options-read.md +8 -6
- package/skills/lj-awb/references/output-fields.md +6 -5
|
@@ -160,9 +160,6 @@ function normalizeDryRun(data = {}) {
|
|
|
160
160
|
localFiles,
|
|
161
161
|
results: Array.isArray(data.results) ? data.results.map((row) => normalizeDryRunResult(row)) : data.results,
|
|
162
162
|
nextRefSubject: data.nextRefSubject,
|
|
163
|
-
resolvedModelCode: data.resolvedModelCode,
|
|
164
|
-
resolvedFrom: data.resolvedFrom,
|
|
165
|
-
resolvedFromValue: data.resolvedFromValue,
|
|
166
163
|
});
|
|
167
164
|
}
|
|
168
165
|
|
|
@@ -338,6 +335,7 @@ function normalizeAsset(data = {}) {
|
|
|
338
335
|
registered: data.registered,
|
|
339
336
|
groupId: data.groupId,
|
|
340
337
|
assetId: data.assetId,
|
|
338
|
+
platform: data.platform,
|
|
341
339
|
name: data.name,
|
|
342
340
|
projectName: data.projectName,
|
|
343
341
|
assetPath: data.assetPath,
|
|
@@ -536,6 +534,7 @@ export function normalizeOutputData(commandName, data) {
|
|
|
536
534
|
return normalizeAsset(data);
|
|
537
535
|
case 'model image-models':
|
|
538
536
|
case 'model video-models':
|
|
537
|
+
case 'model asset-review-models':
|
|
539
538
|
return normalizeList(data, ['models', 'items', 'rows']);
|
|
540
539
|
case 'account teams':
|
|
541
540
|
return normalizeList(data, ['teams']);
|
|
@@ -682,6 +681,42 @@ function renderRecord(record, preferredKeys = [], excludedKeys = []) {
|
|
|
682
681
|
return keys.map((key) => `${key}=${shortValue(record[key])}`).join(' ');
|
|
683
682
|
}
|
|
684
683
|
|
|
684
|
+
function recordScalarKeys(record, preferredKeys = [], excludedKeys = []) {
|
|
685
|
+
const excluded = new Set(excludedKeys);
|
|
686
|
+
return [
|
|
687
|
+
...preferredKeys.filter((key) => !excluded.has(key) && record[key] !== undefined),
|
|
688
|
+
...Object.keys(record).filter((key) => !excluded.has(key) && !preferredKeys.includes(key) && !Array.isArray(record[key]) && !isPlainObject(record[key])),
|
|
689
|
+
];
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function pushSectionRecord(lines, title, record, preferredKeys = []) {
|
|
693
|
+
const compacted = compactRecord(record);
|
|
694
|
+
lines.push(`${title}:`);
|
|
695
|
+
for (const key of recordScalarKeys(compacted, preferredKeys)) {
|
|
696
|
+
lines.push(` ${key}=${shortValue(compacted[key])}`);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function pushSectionCount(lines, title, count) {
|
|
701
|
+
lines.push(`${title}:`);
|
|
702
|
+
lines.push(` count=${count}`);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
function pushSectionKeyValue(lines, key, value) {
|
|
706
|
+
if (value === undefined || value === null || value === '') return;
|
|
707
|
+
lines.push(` ${key}=${value}`);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
function pushSectionItem(lines, index, value) {
|
|
711
|
+
if (value === undefined || value === null || value === '') return;
|
|
712
|
+
lines.push(` [${index}]=${value}`);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
function pushSectionRecordItem(lines, index, record, preferredKeys = []) {
|
|
716
|
+
const rendered = renderRecord(compactRecord(record), preferredKeys);
|
|
717
|
+
if (rendered) lines.push(` [${index}]: ${rendered}`);
|
|
718
|
+
}
|
|
719
|
+
|
|
685
720
|
function firstList(data) {
|
|
686
721
|
for (const [key, value] of Object.entries(data || {})) {
|
|
687
722
|
if (['resultUrls', 'originUrls'].includes(key)) continue;
|
|
@@ -699,6 +734,7 @@ function rowSummary(row) {
|
|
|
699
734
|
'remoteTaskId',
|
|
700
735
|
'taskType',
|
|
701
736
|
'modelGroupCode',
|
|
737
|
+
'platform',
|
|
702
738
|
'provider',
|
|
703
739
|
'displayName',
|
|
704
740
|
'modelDesc',
|
|
@@ -925,70 +961,71 @@ function formatModelOptionsOutput(data = {}) {
|
|
|
925
961
|
const resources = Array.isArray(data.resources) ? data.resources : [];
|
|
926
962
|
const constraints = Array.isArray(data.constraints) ? data.constraints : [];
|
|
927
963
|
const lines = ['ok model options'];
|
|
928
|
-
lines
|
|
964
|
+
pushSectionRecord(lines, 'summary', {
|
|
929
965
|
modelGroupCode: data.modelGroupCode,
|
|
930
966
|
taskKind: data.taskKind,
|
|
931
|
-
}
|
|
932
|
-
lines
|
|
967
|
+
}, ['modelGroupCode', 'taskKind']);
|
|
968
|
+
pushSectionCount(lines, 'params', params.length);
|
|
933
969
|
for (const [index, param] of params.entries()) {
|
|
934
|
-
lines
|
|
970
|
+
pushSectionRecordItem(lines, index, {
|
|
935
971
|
key: param.key,
|
|
936
972
|
type: param.valueType,
|
|
937
973
|
values: valueList(param.values),
|
|
938
974
|
default: param.defaultValue,
|
|
939
975
|
maxLength: param.maxLength,
|
|
940
976
|
required: param.required,
|
|
941
|
-
}
|
|
977
|
+
}, ['key', 'type', 'values', 'default', 'maxLength', 'required']);
|
|
942
978
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
])}`);
|
|
977
|
-
}
|
|
979
|
+
pushSectionCount(lines, 'resources', resources.length);
|
|
980
|
+
for (const [index, item] of resources.entries()) {
|
|
981
|
+
pushSectionRecordItem(lines, index, {
|
|
982
|
+
mode: item.mode,
|
|
983
|
+
media: item.mediaType,
|
|
984
|
+
usage: item.usage,
|
|
985
|
+
valueShapes: textValueShapes(item.valueShapes),
|
|
986
|
+
formats: textResourceFormats(item),
|
|
987
|
+
webpInput: textWebpInput(item),
|
|
988
|
+
autoConvert: textResourceAutoConvert(item),
|
|
989
|
+
files: textFileCount(item),
|
|
990
|
+
maxSizeKB: item.maxSizeKB,
|
|
991
|
+
durationMs: textDurationRange(item),
|
|
992
|
+
totalDurationMs: item.maxTotalDurationMs != null ? `<=${item.maxTotalDurationMs}` : undefined,
|
|
993
|
+
items: textItemCount(item),
|
|
994
|
+
maxPromptLength: item.maxPromptLength,
|
|
995
|
+
lastFrameOnly: item.supportLastFrameOnly,
|
|
996
|
+
}, [
|
|
997
|
+
'mode',
|
|
998
|
+
'media',
|
|
999
|
+
'usage',
|
|
1000
|
+
'valueShapes',
|
|
1001
|
+
'formats',
|
|
1002
|
+
'webpInput',
|
|
1003
|
+
'autoConvert',
|
|
1004
|
+
'files',
|
|
1005
|
+
'maxSizeKB',
|
|
1006
|
+
'durationMs',
|
|
1007
|
+
'totalDurationMs',
|
|
1008
|
+
'items',
|
|
1009
|
+
'maxPromptLength',
|
|
1010
|
+
'lastFrameOnly',
|
|
1011
|
+
]);
|
|
978
1012
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1013
|
+
pushSectionCount(lines, 'constraints', constraints.length);
|
|
1014
|
+
for (const [index, item] of constraints.entries()) {
|
|
1015
|
+
pushSectionRecordItem(lines, index, {
|
|
1016
|
+
target: item.target,
|
|
1017
|
+
targetConfig: item.targetConfigCode && item.targetConfigCode !== item.target ? item.targetConfigCode : undefined,
|
|
1018
|
+
allowedValues: textAllowValues(item.allowValues),
|
|
1019
|
+
when: textConstraintConditions(item.conditions),
|
|
1020
|
+
effect: item.effect,
|
|
1021
|
+
priority: item.priority,
|
|
1022
|
+
name: item.name,
|
|
1023
|
+
}, ['target', 'targetConfig', 'allowedValues', 'when', 'effect', 'priority', 'name']);
|
|
1024
|
+
}
|
|
1025
|
+
if (data.modelGroupCode) {
|
|
1026
|
+
lines.push('next:');
|
|
1027
|
+
pushSectionKeyValue(lines, 'createSpec', `${commandPrefix()} model create-spec --model-group-code ${data.modelGroupCode}`);
|
|
1028
|
+
pushSectionKeyValue(lines, 'reason', '读取创建命令写法、资源语法、fee/dry-run 前置步骤和示例');
|
|
992
1029
|
}
|
|
993
1030
|
return `${lines.join('\n')}\n`;
|
|
994
1031
|
}
|
|
@@ -1000,44 +1037,63 @@ function textKeyBinding(value) {
|
|
|
1000
1037
|
return value;
|
|
1001
1038
|
}
|
|
1002
1039
|
|
|
1040
|
+
function modelFeeNextCommand(data = {}) {
|
|
1041
|
+
if (!data.feeCommand || !data.modelGroupCode) return null;
|
|
1042
|
+
const args = [
|
|
1043
|
+
`${commandPrefix()} ${data.feeCommand}`,
|
|
1044
|
+
`--model-group-code ${data.modelGroupCode}`,
|
|
1045
|
+
'--prompt "<prompt>"',
|
|
1046
|
+
];
|
|
1047
|
+
if (data.taskKind === 'video') args.push('--duration <duration>', '--ratio <ratio>', '--quality <quality>');
|
|
1048
|
+
if (data.taskKind === 'image') args.push('--ratio <ratio>', '--quality <quality>');
|
|
1049
|
+
return args.join(' ');
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function modelCreateExampleWithCode(example, modelGroupCode) {
|
|
1053
|
+
if (!example || !modelGroupCode) return rewriteCommandPrefix(example);
|
|
1054
|
+
return rewriteCommandPrefix(String(example).replaceAll('--model-group-code <code>', `--model-group-code ${modelGroupCode}`));
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1003
1057
|
function formatModelCreateSpecOutput(data = {}) {
|
|
1004
1058
|
const intents = Array.isArray(data.supportedIntents) ? data.supportedIntents : [];
|
|
1005
1059
|
const examples = Array.isArray(data.examples) ? data.examples : [];
|
|
1006
1060
|
const lines = ['ok model create-spec'];
|
|
1007
|
-
lines
|
|
1061
|
+
pushSectionRecord(lines, 'summary', {
|
|
1008
1062
|
modelGroupCode: data.modelGroupCode,
|
|
1009
1063
|
taskKind: data.taskKind,
|
|
1010
1064
|
create: data.createCommand,
|
|
1011
1065
|
fee: data.feeCommand,
|
|
1012
1066
|
statusTaskType: data.statusCommandTaskType,
|
|
1013
|
-
}
|
|
1014
|
-
lines
|
|
1015
|
-
|
|
1067
|
+
}, ['modelGroupCode', 'taskKind', 'create', 'fee', 'statusTaskType']);
|
|
1068
|
+
pushSectionRecord(lines, 'input', {
|
|
1069
|
+
summary: data.inputRequirement?.summary,
|
|
1016
1070
|
acceptedModes: valueList(data.inputRequirement?.acceptedModes),
|
|
1017
|
-
}
|
|
1018
|
-
lines
|
|
1071
|
+
}, ['summary', 'acceptedModes']);
|
|
1072
|
+
pushSectionCount(lines, 'intents', intents.length);
|
|
1019
1073
|
for (const [index, intent] of intents.entries()) {
|
|
1020
|
-
lines
|
|
1074
|
+
pushSectionRecordItem(lines, index, {
|
|
1021
1075
|
mode: intent.mode,
|
|
1022
1076
|
intent: intent.intent,
|
|
1023
1077
|
args: valueList(intent.requiredArgs),
|
|
1024
1078
|
usage: valueList(intent.resourceUsages),
|
|
1025
1079
|
resources: valueList(intent.resourceSyntax),
|
|
1026
1080
|
key: textKeyBinding(intent.promptBinding),
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
if (examples.length) {
|
|
1030
|
-
lines.push(`examples.count=${examples.length}`);
|
|
1031
|
-
for (const [index, example] of examples.entries()) lines.push(`example[${index}]=${example}`);
|
|
1081
|
+
}, ['mode', 'intent', 'args', 'usage', 'resources', 'key']);
|
|
1032
1082
|
}
|
|
1033
|
-
|
|
1083
|
+
pushSectionCount(lines, 'examples', examples.length);
|
|
1084
|
+
for (const [index, example] of examples.entries()) pushSectionItem(lines, index, rewriteCommandPrefix(example));
|
|
1085
|
+
lines.push('next:');
|
|
1086
|
+
if (data.optionsCommand) pushSectionKeyValue(lines, 'options', `${commandPrefix()} ${data.optionsCommand}`);
|
|
1087
|
+
const feeNext = modelFeeNextCommand(data);
|
|
1088
|
+
if (feeNext) pushSectionKeyValue(lines, 'fee', feeNext);
|
|
1089
|
+
if (examples.length) pushSectionKeyValue(lines, 'dryRun', modelCreateExampleWithCode(examples[0], data.modelGroupCode));
|
|
1034
1090
|
return `${lines.join('\n')}\n`;
|
|
1035
1091
|
}
|
|
1036
1092
|
|
|
1037
1093
|
function formatGuideTableRows(rows = []) {
|
|
1038
1094
|
return (Array.isArray(rows) ? rows : []).map((item, index) => {
|
|
1039
1095
|
const values = valueList(item.values);
|
|
1040
|
-
return `
|
|
1096
|
+
return ` [${index}]: ${renderRecord(compactRecord({
|
|
1041
1097
|
name: item.field,
|
|
1042
1098
|
values,
|
|
1043
1099
|
desc: item.description,
|
|
@@ -1047,20 +1103,20 @@ function formatGuideTableRows(rows = []) {
|
|
|
1047
1103
|
|
|
1048
1104
|
function formatModelInputGuideOutput(data = {}) {
|
|
1049
1105
|
const lines = ['ok model input-guide'];
|
|
1050
|
-
lines
|
|
1106
|
+
pushSectionCount(lines, 'commonFields', Array.isArray(data.commonFields) ? data.commonFields.length : 0);
|
|
1051
1107
|
lines.push(...formatGuideTableRows(data.commonFields));
|
|
1052
|
-
lines
|
|
1108
|
+
pushSectionCount(lines, 'resourceFields', Array.isArray(data.resourceFields) ? data.resourceFields.length : 0);
|
|
1053
1109
|
lines.push(...formatGuideTableRows(data.resourceFields));
|
|
1054
1110
|
const rules = Array.isArray(data.resourceRules) ? data.resourceRules : [];
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
for (const [index, rule] of rules.entries()) lines.push(`rule[${index}]=${rule}`);
|
|
1058
|
-
}
|
|
1111
|
+
pushSectionCount(lines, 'resourceRules', rules.length);
|
|
1112
|
+
for (const [index, rule] of rules.entries()) pushSectionItem(lines, index, rule);
|
|
1059
1113
|
const referenceKeyGuide = Array.isArray(data.referenceKeyGuide) ? data.referenceKeyGuide : [];
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
}
|
|
1114
|
+
pushSectionCount(lines, 'referenceKey', referenceKeyGuide.length);
|
|
1115
|
+
for (const [index, item] of referenceKeyGuide.entries()) pushSectionItem(lines, index, item);
|
|
1116
|
+
lines.push('next:');
|
|
1117
|
+
pushSectionKeyValue(lines, 'imageModels', `${commandPrefix()} model image-models --model <keyword>`);
|
|
1118
|
+
pushSectionKeyValue(lines, 'videoModels', `${commandPrefix()} model video-models --model <keyword>`);
|
|
1119
|
+
pushSectionKeyValue(lines, 'options', `${commandPrefix()} model options --model-group-code <modelGroupCode>`);
|
|
1064
1120
|
return `${lines.join('\n')}\n`;
|
|
1065
1121
|
}
|
|
1066
1122
|
|
|
@@ -1072,9 +1128,17 @@ function modelListNextCommand(commandName) {
|
|
|
1072
1128
|
if (commandName === 'model image-models' || commandName === 'model video-models') {
|
|
1073
1129
|
return `${commandPrefix()} model options --model-group-code <modelGroupCode>`;
|
|
1074
1130
|
}
|
|
1131
|
+
if (commandName === 'model asset-review-models') {
|
|
1132
|
+
return `${commandPrefix()} create asset-groups --platform <platform> --name "<keyword>"`;
|
|
1133
|
+
}
|
|
1075
1134
|
return null;
|
|
1076
1135
|
}
|
|
1077
1136
|
|
|
1137
|
+
function modelListAgentHint(commandName) {
|
|
1138
|
+
if (commandName !== 'model image-models' && commandName !== 'model video-models') return null;
|
|
1139
|
+
return '对每个候选运行 model options,并把候选模型、参数取值、默认值和资源能力展示给用户后再推荐或进入 fee/dry-run。';
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1078
1142
|
function statusNextCommand(commandName, normalized) {
|
|
1079
1143
|
if (!isPlainObject(normalized) || normalized.isTerminal !== false || !normalized.taskId) return null;
|
|
1080
1144
|
const taskType = normalized.taskType || (commandName === 'task video-status' ? 'VIDEO_GROUP' : 'IMAGE_CREATE');
|
|
@@ -1117,10 +1181,8 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
1117
1181
|
'taskType',
|
|
1118
1182
|
'taskStatus',
|
|
1119
1183
|
'modelCode',
|
|
1120
|
-
'resolvedModelCode',
|
|
1121
|
-
'resolvedFrom',
|
|
1122
|
-
'resolvedFromValue',
|
|
1123
1184
|
'modelGroupCode',
|
|
1185
|
+
'platform',
|
|
1124
1186
|
'projectGroupNo',
|
|
1125
1187
|
'projectId',
|
|
1126
1188
|
'groupId',
|
|
@@ -1208,6 +1270,8 @@ export function formatTextOutput(commandName, data, context = {}) {
|
|
|
1208
1270
|
if (normalized.dryRun && !context.confirmCommand && context.executeCommand) lines.push(`next=${context.executeCommand}`);
|
|
1209
1271
|
const modelNext = modelListNextCommand(commandName);
|
|
1210
1272
|
if (modelNext) lines.push(`next=${modelNext}`);
|
|
1273
|
+
const modelHint = modelListAgentHint(commandName);
|
|
1274
|
+
if (modelHint) lines.push(`agentHint=${shortValue(modelHint)}`);
|
|
1211
1275
|
const waitNext = statusNextCommand(commandName, normalized);
|
|
1212
1276
|
if (waitNext) lines.push(`next=${waitNext}`);
|
|
1213
1277
|
const subtitleNext = subtitleRemoveNextCommand(commandName, normalized);
|