From f666f76a0267d1332a7bc2eed5234ded5082ed9f Mon Sep 17 00:00:00 2001 From: baonudesifeizhai Date: Thu, 10 Jul 2025 01:42:58 -0400 Subject: [PATCH] feat: add app configuration updates without JSON validation --- api/core/app/app_config/easy_ui_based_app/variables/manager.py | 3 ++- api/core/app/app_config/entities.py | 1 + .../app/configuration/config-var/config-modal/index.tsx | 1 + .../workflow/nodes/_base/components/input-var-type-icon.tsx | 3 ++- web/i18n/en-US/app-debug.ts | 1 + web/i18n/zh-Hans/app-debug.ts | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/core/app/app_config/easy_ui_based_app/variables/manager.py b/api/core/app/app_config/easy_ui_based_app/variables/manager.py index 2f2445a336..fbda389500 100644 --- a/api/core/app/app_config/easy_ui_based_app/variables/manager.py +++ b/api/core/app/app_config/easy_ui_based_app/variables/manager.py @@ -47,6 +47,7 @@ class BasicVariablesConfigManager: VariableEntityType.PARAGRAPH, VariableEntityType.NUMBER, VariableEntityType.SELECT, + VariableEntityType.JSON, }: variable = variables[variable_type] variable_entities.append( @@ -96,7 +97,7 @@ class BasicVariablesConfigManager: variables = [] for item in config["user_input_form"]: key = list(item.keys())[0] - if key not in {"text-input", "select", "paragraph", "number", "external_data_tool"}: + if key not in {"text-input", "select", "paragraph", "number", "external_data_tool", "json"}: raise ValueError("Keys in user_input_form list can only be 'text-input', 'paragraph' or 'select'") form_item = item[key] diff --git a/api/core/app/app_config/entities.py b/api/core/app/app_config/entities.py index 75bd2f677a..18e9fb0905 100644 --- a/api/core/app/app_config/entities.py +++ b/api/core/app/app_config/entities.py @@ -97,6 +97,7 @@ class VariableEntityType(StrEnum): EXTERNAL_DATA_TOOL = "external_data_tool" FILE = "file" FILE_LIST = "file-list" + JSON = "json" class VariableEntity(BaseModel): diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsx index 29cbc55b90..71c99cbf26 100644 --- a/web/app/components/app/configuration/config-var/config-modal/index.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx @@ -190,6 +190,7 @@ const ConfigModal: FC = ({ + {supportFile && <> diff --git a/web/app/components/workflow/nodes/_base/components/input-var-type-icon.tsx b/web/app/components/workflow/nodes/_base/components/input-var-type-icon.tsx index d3cc1dbc78..8f75273a91 100644 --- a/web/app/components/workflow/nodes/_base/components/input-var-type-icon.tsx +++ b/web/app/components/workflow/nodes/_base/components/input-var-type-icon.tsx @@ -1,7 +1,7 @@ 'use client' import type { FC } from 'react' import React from 'react' -import { RiAlignLeft, RiCheckboxMultipleLine, RiFileCopy2Line, RiFileList2Line, RiHashtag, RiTextSnippet } from '@remixicon/react' +import { RiAlignLeft, RiCheckboxMultipleLine, RiCodeBoxLine, RiFileCopy2Line, RiFileList2Line, RiHashtag, RiTextSnippet } from '@remixicon/react' import { InputVarType } from '../../../types' type Props = { @@ -17,6 +17,7 @@ const getIcon = (type: InputVarType) => { [InputVarType.number]: RiHashtag, [InputVarType.singleFile]: RiFileList2Line, [InputVarType.multiFiles]: RiFileCopy2Line, + [InputVarType.json]: RiCodeBoxLine, } as any)[type] || RiTextSnippet } diff --git a/web/i18n/en-US/app-debug.ts b/web/i18n/en-US/app-debug.ts index 349ff37118..1681222e58 100644 --- a/web/i18n/en-US/app-debug.ts +++ b/web/i18n/en-US/app-debug.ts @@ -355,6 +355,7 @@ const translation = { 'paragraph': 'Paragraph', 'select': 'Select', 'number': 'Number', + 'json': 'JSON Object', 'single-file': 'Single File', 'multi-files': 'File List', 'notSet': 'Not set, try typing {{input}} in the prefix prompt', diff --git a/web/i18n/zh-Hans/app-debug.ts b/web/i18n/zh-Hans/app-debug.ts index 4f84b396d0..594fc9cf5f 100644 --- a/web/i18n/zh-Hans/app-debug.ts +++ b/web/i18n/zh-Hans/app-debug.ts @@ -349,6 +349,7 @@ const translation = { 'paragraph': '段落', 'select': '下拉选项', 'number': '数字', + 'json': 'JSON 对象', 'single-file': '单文件', 'multi-files': '文件列表', 'notSet': '未设置,在 Prompt 中输入 {{input}} 试试',