Skip to content

Commit b619eb0

Browse files
committed
feat: Support hidden global variables
1 parent b974574 commit b619eb0

File tree

7 files changed

+18
-2
lines changed

7 files changed

+18
-2
lines changed

packages/global/core/app/type.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export type VariableItemType = {
155155
required: boolean;
156156
description: string;
157157
valueType?: WorkflowIOValueTypeEnum;
158+
hidden?: boolean;
158159
defaultValue?: any;
159160

160161
// input

packages/web/i18n/en/workflow.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"field_description_placeholder": "Describe the function of this input field. If it is a tool call parameter, this description will affect the quality of the model generation.",
6262
"field_name_already_exists": "Field name already exists",
6363
"field_required": "Required",
64+
"field_hidden": "Hidden",
6465
"field_used_as_tool_input": "Used as Tool Call Parameter",
6566
"filter_description": "Currently supports filtering by tags and creation time. Fill in the format as follows:\n{\n \"tags\": {\n \"$and\": [\"Tag 1\",\"Tag 2\"],\n \"$or\": [\"When there are $and tags, and is effective, or is not effective\"]\n },\n \"createTime\": {\n \"$gte\": \"YYYY-MM-DD HH:mm format, collection creation time greater than this time\",\n \"$lte\": \"YYYY-MM-DD HH:mm format, collection creation time less than this time, can be used with $gte\"\n }\n}",
6667
"find_tip": "Find node ctrl f",

packages/web/i18n/zh-CN/workflow.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"field_description_placeholder": "描述该输入字段的功能,如果为工具调用参数,则该描述会影响模型生成的质量",
6262
"field_name_already_exists": "字段名已经存在",
6363
"field_required": "必填",
64+
"field_hidden": "隐藏",
6465
"field_used_as_tool_input": "作为工具调用参数",
6566
"filter_description": "目前支持标签和创建时间过滤,需按照以下格式填写:\n{\n \"tags\": {\n \"$and\": [\"标签 1\",\"标签 2\"],\n \"$or\": [\"有 $and 标签时,and 生效,or 不生效\"]\n },\n \"createTime\": {\n \"$gte\": \"YYYY-MM-DD HH:mm 格式即可,集合的创建时间大于该时间\",\n \"$lte\": \"YYYY-MM-DD HH:mm 格式即可,集合的创建时间小于该时间,可和 $gte 共同使用\"\n }\n}",
6667
"find_tip": "查找节点 ctrl f",

packages/web/i18n/zh-Hant/workflow.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"field_description_placeholder": "描述這個輸入欄位的功能,如果是工具呼叫參數,這個描述會影響模型產生的品質",
6262
"field_name_already_exists": "欄位名稱已存在",
6363
"field_required": "必填",
64+
"field_hidden": "隱藏",
6465
"field_used_as_tool_input": "作為工具呼叫參數",
6566
"filter_description": "目前支援標籤和建立時間篩選,需按照以下格式填寫:\n{\n \"tags\": {\n \"$and\": [\"標籤 1\",\"標籤 2\"],\n \"$or\": [\"當有 $and 標籤時,$and 才會生效,$or 不會生效\"]\n },\n \"createTime\": {\n \"$gte\": \"YYYY-MM-DD HH:mm 格式,資料集的建立時間大於這個時間\",\n \"$lte\": \"YYYY-MM-DD HH:mm 格式,資料集的建立時間小於這個時間,可以和 $gte 一起使用\"\n }\n}",
6667
"find_tip": "查找節點 ctrl f",

projects/app/src/components/core/chat/ChatContainer/ChatBox/components/VariableInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const VariableInput = ({
204204
const externalVariableList = useMemo(
205205
() =>
206206
allVariableList.filter((item) =>
207-
showExternalVariables ? item.type === VariableInputEnum.custom : false
207+
showExternalVariables ? item.type === VariableInputEnum.custom && !item.hidden : false
208208
),
209209
[allVariableList, showExternalVariables]
210210
);

projects/app/src/components/core/chat/ChatContainer/ChatBox/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ const ChatBox = ({
156156

157157
const externalVariableList = useMemo(() => {
158158
if (chatType === 'chat') {
159-
return allVariableList.filter((item) => item.type === VariableInputEnum.custom);
159+
return allVariableList.filter(
160+
(item) => item.type === VariableInputEnum.custom && !item.hidden
161+
);
160162
}
161163
return [];
162164
}, [allVariableList, chatType]);

projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/NodePluginIO/InputTypeConfig.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ const InputTypeConfig = ({
127127
return !list.includes(inputType);
128128
}, [inputType]);
129129

130+
const showHidden = inputType === VariableInputEnum.custom;
131+
130132
const showMaxLenInput = useMemo(() => {
131133
const list = [FlowNodeInputTypeEnum.input];
132134
return list.includes(inputType as FlowNodeInputTypeEnum);
@@ -231,6 +233,14 @@ const InputTypeConfig = ({
231233
<Switch {...register('required')} />
232234
</Flex>
233235
)}
236+
{showHidden && (
237+
<Flex alignItems={'center'} minH={'40px'}>
238+
<FormLabel flex={'0 0 132px'} fontWeight={'medium'}>
239+
{t('workflow:field_hidden')}
240+
</FormLabel>
241+
<Switch {...register('hidden')} />
242+
</Flex>
243+
)}
234244
{/* reference */}
235245
{showIsToolInput && (
236246
<>

0 commit comments

Comments
 (0)