Skip to content

feat: Support hidden global variables #4950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/global/core/app/type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export type VariableItemType = {
required: boolean;
description: string;
valueType?: WorkflowIOValueTypeEnum;
hidden?: boolean;
defaultValue?: any;

// input
Expand Down
1 change: 1 addition & 0 deletions packages/web/i18n/en/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"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.",
"field_name_already_exists": "Field name already exists",
"field_required": "Required",
"field_hidden": "Hidden",
"field_used_as_tool_input": "Used as Tool Call Parameter",
"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}",
"find_tip": "Find node ctrl f",
Expand Down
1 change: 1 addition & 0 deletions packages/web/i18n/zh-CN/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"field_description_placeholder": "描述该输入字段的功能,如果为工具调用参数,则该描述会影响模型生成的质量",
"field_name_already_exists": "字段名已经存在",
"field_required": "必填",
"field_hidden": "隐藏",
"field_used_as_tool_input": "作为工具调用参数",
"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}",
"find_tip": "查找节点 ctrl f",
Expand Down
1 change: 1 addition & 0 deletions packages/web/i18n/zh-Hant/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"field_description_placeholder": "描述這個輸入欄位的功能,如果是工具呼叫參數,這個描述會影響模型產生的品質",
"field_name_already_exists": "欄位名稱已存在",
"field_required": "必填",
"field_hidden": "隱藏",
"field_used_as_tool_input": "作為工具呼叫參數",
"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}",
"find_tip": "查找節點 ctrl f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ const ChatBox = ({

const externalVariableList = useMemo(() => {
if ([ChatTypeEnum.log, ChatTypeEnum.chat].includes(chatType)) {
return allVariableList.filter((item) => item.type === VariableInputEnum.custom);
return allVariableList.filter(
(item) => item.type === VariableInputEnum.custom && !item.hidden
);
}
return [];
}, [allVariableList, chatType]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ const InputTypeConfig = ({
return !list.includes(inputType);
}, [inputType]);

const showHidden = inputType === VariableInputEnum.custom;

const showMaxLenInput = useMemo(() => {
const list = [FlowNodeInputTypeEnum.input];
return list.includes(inputType as FlowNodeInputTypeEnum);
Expand Down Expand Up @@ -231,6 +233,14 @@ const InputTypeConfig = ({
<Switch {...register('required')} />
</Flex>
)}
{showHidden && (
<Flex alignItems={'center'} minH={'40px'}>
<FormLabel flex={'0 0 132px'} fontWeight={'medium'}>
{t('workflow:field_hidden')}
</FormLabel>
<Switch {...register('hidden')} />
</Flex>
)}
{/* reference */}
{showIsToolInput && (
<>
Expand Down
Loading