yuanflow-cli 0.1.16 → 0.1.17
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 +1 -1
- package/src/knowledge-tools.js +8 -6
package/package.json
CHANGED
package/src/knowledge-tools.js
CHANGED
|
@@ -70,6 +70,7 @@ export async function navigateKnowledge({ action, options }) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
function knowledgeCommand(action, description, extraOptions = []) {
|
|
73
|
+
const normalizedAction = normalizeAction(action);
|
|
73
74
|
return {
|
|
74
75
|
key: `knowledge.${action}`,
|
|
75
76
|
command: `knowledge ${action}`,
|
|
@@ -79,12 +80,12 @@ function knowledgeCommand(action, description, extraOptions = []) {
|
|
|
79
80
|
apiPath: KNOWLEDGE_NAVIGATE_PATH,
|
|
80
81
|
positionals: [],
|
|
81
82
|
options: [
|
|
82
|
-
...taskFrameOptions(),
|
|
83
|
+
...taskFrameOptions(normalizedAction),
|
|
83
84
|
...extraOptions,
|
|
84
85
|
...commonOptions(),
|
|
85
86
|
],
|
|
86
87
|
requestBody: {
|
|
87
|
-
action:
|
|
88
|
+
action: normalizedAction,
|
|
88
89
|
task_frame: '<由 task-frame 参数组装>',
|
|
89
90
|
params: '<由命令参数组装>',
|
|
90
91
|
},
|
|
@@ -92,12 +93,13 @@ function knowledgeCommand(action, description, extraOptions = []) {
|
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
function taskFrameOptions() {
|
|
96
|
+
function taskFrameOptions(action) {
|
|
97
|
+
const requiresTaskFrame = ['entry', 'packs', 'evaluate'].includes(action);
|
|
96
98
|
return [
|
|
97
99
|
{ flag: '--task-intent', name: 'taskIntent', required: false, label: '兼容旧字段;v2 接口不要求填写。' },
|
|
98
100
|
{ flag: '--output-format', name: 'outputFormat', required: false, label: '输出格式,例如 short_video_script、social_post、any。' },
|
|
99
|
-
{ flag: '--domain', name: 'domain', required:
|
|
100
|
-
{ flag: '--content-goal', name: 'contentGoal', required:
|
|
101
|
+
{ flag: '--domain', name: 'domain', required: requiresTaskFrame, label: '内容领域;等同 task_frame.domain,不能为空。' },
|
|
102
|
+
{ flag: '--content-goal', name: 'contentGoal', required: requiresTaskFrame, label: '具体创作或评估目标;等同 task_frame.content_goal,不能为空。' },
|
|
101
103
|
{ flag: '--target-audience', name: 'targetAudience', required: false, label: '目标受众,例如 创业者、宝妈、普通用户。' },
|
|
102
104
|
{ flag: '--tone', name: 'tone', required: false, label: '语气风格。' },
|
|
103
105
|
{ flag: '--communication-mode', name: 'communicationMode', required: false, label: '表达方式,例如 口播、图文、文章。' },
|
|
@@ -121,7 +123,7 @@ async function buildTaskFrame(options) {
|
|
|
121
123
|
...fromFile,
|
|
122
124
|
task_intent: pick(options, 'task-intent', fromFile.task_intent),
|
|
123
125
|
output_format: pick(options, 'output-format', fromFile.output_format || 'any'),
|
|
124
|
-
domain: pick(options, 'domain', fromFile.domain
|
|
126
|
+
domain: pick(options, 'domain', fromFile.domain),
|
|
125
127
|
content_goal: pick(options, 'content-goal', fromFile.content_goal || ''),
|
|
126
128
|
target_audience: pick(options, 'target-audience', fromFile.target_audience || ''),
|
|
127
129
|
tone: pick(options, 'tone', fromFile.tone || ''),
|