Skip to content

Commit 6cd244d

Browse files
committed
feat: Support hidden global variables
1 parent d0730e6 commit 6cd244d

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export type VariableItemType = {
153153
required: boolean;
154154
description: string;
155155
valueType?: WorkflowIOValueTypeEnum;
156+
hidden?: boolean;
156157
defaultValue?: any;
157158

158159
// input

packages/web/i18n/en/workflow.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"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.",
6666
"field_name_already_exists": "Field name already exists",
6767
"field_required": "Required",
68+
"field_hidden": "Hidden",
6869
"field_used_as_tool_input": "Used as Tool Call Parameter",
6970
"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}",
7071
"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
@@ -65,6 +65,7 @@
6565
"field_description_placeholder": "描述该输入字段的功能,如果为工具调用参数,则该描述会影响模型生成的质量",
6666
"field_name_already_exists": "字段名已经存在",
6767
"field_required": "必填",
68+
"field_hidden": "隐藏",
6869
"field_used_as_tool_input": "作为工具调用参数",
6970
"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}",
7071
"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
@@ -65,6 +65,7 @@
6565
"field_description_placeholder": "描述這個輸入欄位的功能,如果是工具呼叫參數,這個描述會影響模型產生的品質",
6666
"field_name_already_exists": "欄位名稱已存在",
6767
"field_required": "必填",
68+
"field_hidden": "隱藏",
6869
"field_used_as_tool_input": "作為工具呼叫參數",
6970
"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}",
7071
"find_tip": "查找節點 ctrl f",

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 ([ChatTypeEnum.log, ChatTypeEnum.chat].includes(chatType)) {
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)