From b1e69e154ba066d44092c148845f5baaefb38fa7 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Mon, 22 Dec 2025 14:29:53 +0800 Subject: [PATCH] feat(web): node show id; update reflection engine example --- web/src/i18n/en.ts | 94 +++++++++---------- web/src/i18n/zh.ts | 82 ++++++++-------- .../views/Workflow/components/Chat/Chat.tsx | 29 ++++-- .../Workflow/components/Properties/index.tsx | 6 +- 4 files changed, 115 insertions(+), 96 deletions(-) diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index 9d6c2f04..f9f85d1a 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -1304,20 +1304,21 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re inner: 'Built-in Tools', custom: 'Custom Tools', mcpSearchPlaceholder: 'Search MCP services...', + innerSearchPlaceholder: 'Search tools...', + customSearchPlaceholder: 'Search custom tools...', addService: 'Add MCP Service', addServiceSuccess: 'Service added successfully', - serviceAddress: 'Service Address', + server_url: 'Service URL', lastConnection: 'Last Connection', responseTime: 'Response Time', status: { - running: 'Running', - stopped: 'Stopped', - abnormal: 'Abnormal', - unknown: 'Unknown' + active: 'Active', + inactive: 'Inactive', }, + testConnectionSuccess: 'Connection test successful', serviceEndpoint: 'Service Endpoint URL', - serviceEndpointPlaceholder: 'Service endpoint URL', - serviceEndpointExtra: 'Complete access address for MCP service', + serviceEndpointPlaceholder: 'URL of the service endpoint', + serviceEndpointExtra: 'Complete access address of the MCP service', nameAndIcon: 'Name and Icon', namePlaceholder: 'Name your MCP service', serverIdentifier: 'Server Identifier', @@ -1344,27 +1345,25 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re sseReadTimeout: 'SSE Read Timeout (seconds)', saveAndTest: 'Save and Test', - innerSearchPlaceholder: 'Search built-in tools', - timeFormat: 'Time Formatting', timeZoneConversion: 'Time Zone Conversion', timestampConversion: 'Timestamp Conversion', timeCalculation: 'Time Calculation', - time_desc: 'Date and time processing', - time_features: 'Provides time format conversion, time zone conversion, timestamp calculation and other functions', + time_desc: 'Date and Time Processing', + DateTimeTool_features: 'Provides time format conversion, time zone conversion, timestamp calculation and other functions', currentTime: 'Current Time', timestamp: 'Timestamp', localTime: 'Local Time', utcTime: 'UTC Time', secondsTimestamp: 'Timestamp (seconds)', millisecondsTimestamp: 'Timestamp (milliseconds)', - enterTimestamp: 'Enter timestamp', + enterTimestamp: 'Enter Timestamp', conversion: 'Conversion', conversionResult: 'Conversion Result', chooseFormatType: 'Choose Format', - json_desc: 'Data format conversion', - json_features: 'JSON formatting, compression, validation and conversion functions', + JsonTool_desc: 'Data Format Conversion', + JsonTool_features: 'JSON formatting, compression, validation and conversion functions', jsonFormat: 'JSON Formatting', jsonGzip: 'JSON Compression', jsonCheck: 'JSON Validation', @@ -1375,14 +1374,14 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re clear: 'Clear', parse: 'Paste', format: 'Format', - gzip: 'Compress', - check: 'Validate', - escape: 'Escape', + minify: 'Minify', + validate: 'Validate', + convert: 'Escape', outputResult: 'Output Result', validJosn: 'JSON format is correct, validation passed!', - baidu_desc: 'Search engine service', - baidu_features: 'Integrated Baidu Search API, providing web search, news search and other functions', + BaiduSearchTool_desc: 'Search Engine Service', + BaiduSearchTool_features: 'Integrated Baidu Search API, providing web search, news search and other functions', webSearch: 'Web Search', newsSearch: 'News Search', imageSearch: 'Image Search', @@ -1391,51 +1390,51 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re hasApiKey: 'API configured and enabled', needApiKey: 'Need to configure API Key', - minerU_desc: 'PDF parsing tool', - minerU_features: 'High-precision PDF document parsing tool, supports text, table, and image extraction', + MinerUTool_desc: 'PDF Parsing Tool', + MinerUTool_features: 'High-precision PDF document parsing tool, supports text, table, and image extraction', pdfParser: 'PDF Parser', tableExtraction: 'Table Extraction', imageRecognition: 'Image Recognition', textExtraction: 'Text Extraction', - textIn_desc: 'OCR text recognition', - textIn_features: 'Intelligent OCR text recognition service, supports multilingual and handwriting recognition', + TextInTool_desc: 'OCR Text Recognition', + TextInTool_features: 'Intelligent OCR text recognition service, supports multi-language and handwriting recognition', universalOCR: 'Universal OCR', handwritingRecognition: 'Handwriting Recognition', - multilingualSupport: 'Multilingual Support', + multilingualSupport: 'Multi-language Support', highPrecisionRecognition: 'High Precision Recognition', configDesc: 'Configuration Description', - baidu_config_desc: 'To use Baidu Search API, you need to apply for API Key and Secret Key on Baidu Open Platform first.', - minerU_config_desc: 'MinerU is a high-precision PDF document parsing tool that requires an API Key to use.', - textIn_config_desc: 'TextIn provides intelligent OCR text recognition service with multilingual support.', - link: 'Application Link', + BaiduSearchTool_config_desc: 'To use Baidu Search API, you need to apply for API Key and Secret Key on Baidu Open Platform first.', + MinerUTool_config_desc: 'MinerU is a high-precision PDF document parsing tool that requires an API Key to use.', + TextInTool_config_desc: 'TextIn provides intelligent OCR text recognition service with multi-language support.', + link: 'Application URL', api_key: 'API Key', - baidu_api_key_desc: 'API Key obtained from Baidu Open Platform', - minerU_api_key_desc: 'API Key obtained from MinerU platform', + BaiduSearchTool_api_key_desc: 'API Key obtained from Baidu Open Platform', + MinerUTool_api_key_desc: 'API Key obtained from MinerU platform', secret_key: 'Secret Key', - baidu_secret_key_desc: 'Secret Key obtained from Baidu Open Platform', - textIn_secret_key_desc: 'Secret Key obtained from TextIn platform', - search_type: 'Search Type', + BaiduSearchTool_secret_key_desc: 'Secret Key obtained from Baidu Open Platform', + TextInTool_secret_key_desc: 'Secret Key obtained from TextIn platform', + type: 'Search Type', pagesize: 'Results Per Page', - pagesize_desc: 'Number of results returned per search (1-50)', - baidu_enable: 'Enable Baidu Search', - baidu_safe_enable: 'Enable Safe Search', - baidu_safe_enable_desc: 'Filter inappropriate content', + pagesize_desc: 'Number of results returned per search ({{count1}}-{{count2}})', + BaiduSearchTool_enable: 'Enable Baidu Search', + BaiduSearchTool_safe_enable: 'Enable Safe Search', + BaiduSearchTool_safe_enable_desc: 'Filter inappropriate content', api_address: 'API Address', - minerU_api_address_desc: 'Default uses official API address, can be modified for private deployment', - textIn_api_address_desc: 'Default uses official API address', + MinerUTool_api_address_desc: 'Uses official API address by default, can be modified if privately deployed', + TextInTool_api_address_desc: 'Uses official API address by default', parsing_mode: 'Parsing Mode', auto_recognition: 'Auto Recognition', pure_text_mode: 'Pure Text Mode', table_priority: 'Table Priority', image_priority: 'Image Priority', - minerU_timeout_desc: 'PDF parsing timeout (10-300 seconds)', - minerU_enable: 'Enable MinerU', - minerU_extract_images_enable: 'Extract Images', - minerU_extract_images_enable_desc: 'Whether to extract image content from PDF', + MinerUTool_timeout_desc: 'PDF parsing timeout (10-300 seconds)', + MinerUTool_enable: 'Enable MinerU', + MinerUTool_extract_images_enable: 'Extract Images', + MinerUTool_extract_images_enable_desc: 'Whether to extract image content from PDF', app_id: 'APP ID', - textIn_app_id_desc: 'App ID obtained from TextIn platform', + TextInTool_app_id_desc: 'App ID obtained from TextIn platform', language_identification: 'Recognition Language', automatic_detection: 'Automatic Detection', simplified_chinese: 'Simplified Chinese', @@ -1448,7 +1447,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re high_precision_identification: 'High Precision Recognition', handwriting_recognition: 'Handwriting Recognition', formula_recognition: 'Formula Recognition', - textIn_enable: 'Enable TextIn', + TextInTool_enable: 'Enable TextIn', return_text_position_enable: 'Return Text Position Info', return_text_position_enable_desc: 'Whether to return coordinate positions of recognized text', @@ -1550,7 +1549,8 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re run: 'Run', save: 'Save', export: 'Export', - variableConfig: 'Variable Configuration' + variableConfig: 'Variable Configuration', + variableRequired: 'required', }, emotionEngine: { emotionEngineConfig: 'Emotion Engine Configuration', @@ -1661,7 +1661,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re daily: 'Daily', run: 'Run Debug', example: 'Raw Data', - exampleText: 'My sister was born in 2025, oh wait, I remembered wrong, she was actually born in 2024. By the way, my ID number is 33252218293749845X.', + exampleText: 'I went to Beijing for work in the spring of 2023, and have basically been working in Beijing ever since, without changing cities much. However, due to company restructuring, I was transferred to Shanghai for about half a year in the first half of 2024, during which time I checked in at the Shanghai office every day. At that time, my employment records still used my previous identity information, with ID number 11010119950308123X and bank card 6222023847595898, which have never changed. By the way, I have actually been living in Beijing since 2023 and have never left Beijing for long periods. The Shanghai period was more like remote collaboration.', runTitle: 'Reflection Test Run', status: 'Status', message: 'Message', diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.ts index 84dbd47c..6aa6cd50 100644 --- a/web/src/i18n/zh.ts +++ b/web/src/i18n/zh.ts @@ -1393,17 +1393,18 @@ export const zh = { inner: '内置工具', custom: '自定义工具', mcpSearchPlaceholder: '搜索MCP服务...', + innerSearchPlaceholder: '搜索工具...', + customSearchPlaceholder: '搜索自定义工具...', addService: '添加MCP服务', addServiceSuccess: '服务添加成功', - serviceAddress: '服务地址', + server_url: '服务地址', lastConnection: '最后连接', responseTime: '响应时间', status: { - running: '运行中', - stopped: '已停止', - abnormal: '异常', - unknown: '未知' + active: '活跃', + inactive: '不活跃', }, + testConnectionSuccess: '测试连接成功', serviceEndpoint: '服务端点 URL', serviceEndpointPlaceholder: '服务端点的 URL', serviceEndpointExtra: 'MCP服务的完整访问地址', @@ -1432,15 +1433,13 @@ export const zh = { timeout: '超时时间(秒)', sseReadTimeout: 'SSE 读取超时时间(秒)', saveAndTest: '保存并测试', - - innerSearchPlaceholder: '搜索内置工具', timeFormat: '时间格式化', timeZoneConversion: '时区转换', timestampConversion: '时间戳转换', timeCalculation: '时间计算', time_desc: '日期时间处理', - time_features: '提供时间格式转换、时区转换、时间戳计算等功能', + DateTimeTool_features: '提供时间格式转换、时区转换、时间戳计算等功能', currentTime: '当前时间', timestamp: '时间戳', localTime: '本地时间', @@ -1452,8 +1451,8 @@ export const zh = { conversionResult: '转换结果', chooseFormatType: '选择格式', - json_desc: '数据格式转换', - json_features: 'JSON格式化、压缩、验证和转换功能', + JsonTool_desc: '数据格式转换', + JsonTool_features: 'JSON格式化、压缩、验证和转换功能', jsonFormat: 'JSON格式化', jsonGzip: 'JSON压缩', jsonCheck: 'JSON验证', @@ -1464,14 +1463,14 @@ export const zh = { clear: '清空', parse: '粘贴', format: '格式化', - gzip: '压缩', - check: '验证', - escape: '转义', + minify: '压缩', + validate: '验证', + convert: '转义', outputResult: '输出结果', validJosn: 'JSON格式正确,验证通过!', - baidu_desc: '搜索引擎服务', - baidu_features: '集成百度搜索API,提供网页搜索、新闻搜索等功能', + BaiduSearchTool_desc: '搜索引擎服务', + BaiduSearchTool_features: '集成百度搜索API,提供网页搜索、新闻搜索等功能', webSearch: '网页搜索', newsSearch: '新闻搜索', imageSearch: '图片搜索', @@ -1480,51 +1479,51 @@ export const zh = { hasApiKey: 'API 已配置并启用', needApiKey: '需要配置API Key', - minerU_desc: 'PDF解析工具', - minerU_features: '高精度PDF文档解析工具,支持文字、表格、图片提取', + MinerUTool_desc: 'PDF解析工具', + MinerUTool_features: '高精度PDF文档解析工具,支持文字、表格、图片提取', pdfParser: 'PDF解析', tableExtraction: '表格提取', imageRecognition: '图片识别', textExtraction: '文本提取', - textIn_desc: 'OCR文字识别', - textIn_features: '智能OCR文字识别服务,支持多语言、手写体识别', + TextInTool_desc: 'OCR文字识别', + TextInTool_features: '智能OCR文字识别服务,支持多语言、手写体识别', universalOCR: '通用OCR', handwritingRecognition: '手写识别', multilingualSupport: '多语言支持', highPrecisionRecognition: '高精度识别', configDesc: '配置说明', - baidu_config_desc: '使用百度搜索API需要先在百度开放平台申请API Key和Secret Key。', - minerU_config_desc: 'MinerU是高精度PDF文档解析工具,需要API Key才能使用。', - textIn_config_desc: 'TextIn提供智能OCR文字识别服务,支持多语言识别。', + BaiduSearchTool_config_desc: '使用百度搜索API需要先在百度开放平台申请API Key和Secret Key。', + MinerUTool_config_desc: 'MinerU是高精度PDF文档解析工具,需要API Key才能使用。', + TextInTool_config_desc: 'TextIn提供智能OCR文字识别服务,支持多语言识别。', link: '申请地址', api_key: 'API Key', - baidu_api_key_desc: '从百度开放平台获取的API Key', - minerU_api_key_desc: '从MinerU平台获取的API Key', + BaiduSearchTool_api_key_desc: '从百度开放平台获取的API Key', + MinerUTool_api_key_desc: '从MinerU平台获取的API Key', secret_key: 'Secret Key', - baidu_secret_key_desc: '从百度开放平台获取的Secret Key', - textIn_secret_key_desc: '从TextIn平台获取的Secret Key', - search_type: '搜索类型', + BaiduSearchTool_secret_key_desc: '从百度开放平台获取的Secret Key', + TextInTool_secret_key_desc: '从TextIn平台获取的Secret Key', + type: '搜索类型', pagesize: '每页结果数', - pagesize_desc: '每次搜索返回的结果数量(1-50)', - baidu_enable: '启用百度搜索', - baidu_safe_enable: '启用安全搜索', - baidu_safe_enable_desc: '过滤不适宜内容', + pagesize_desc: '每次搜索返回的结果数量({{count1}}-{{count2}})', + BaiduSearchTool_enable: '启用百度搜索', + BaiduSearchTool_safe_enable: '启用安全搜索', + BaiduSearchTool_safe_enable_desc: '过滤不适宜内容', api_address: 'API地址', - minerU_api_address_desc: '默认使用官方API地址,如有私有部署可修改', - textIn_api_address_desc: '默认使用官方API地址', + MinerUTool_api_address_desc: '默认使用官方API地址,如有私有部署可修改', + TextInTool_api_address_desc: '默认使用官方API地址', parsing_mode: '解析模式', auto_recognition: '自动识别', pure_text_mode: '纯文本模式', table_priority: '表格优先', image_priority: '图片优先', - minerU_timeout_desc: 'PDF解析超时时间(10-300秒)', - minerU_enable: '启用MinerU', - minerU_extract_images_enable: '提取图片', - minerU_extract_images_enable_desc: '是否提取PDF中的图片内容', + MinerUTool_timeout_desc: 'PDF解析超时时间(10-300秒)', + MinerUTool_enable: '启用MinerU', + MinerUTool_extract_images_enable: '提取图片', + MinerUTool_extract_images_enable_desc: '是否提取PDF中的图片内容', app_id: 'APP ID', - textIn_app_id_desc: '从TextIn平台获取的App ID', + TextInTool_app_id_desc: '从TextIn平台获取的App ID', language_identification: '识别语言', automatic_detection: '自动检测', simplified_chinese: '简体中文', @@ -1537,7 +1536,7 @@ export const zh = { high_precision_identification: '高精度识别', handwriting_recognition: '手写体识别', formula_recognition: '公式识别', - textIn_enable: '启用TextIn', + TextInTool_enable: '启用TextIn', return_text_position_enable: '返回文本位置信息', return_text_position_enable_desc: '是否返回识别文字的坐标位置', @@ -1639,7 +1638,8 @@ export const zh = { run: '运行', save: '保存', export: '导出', - variableConfig: '变量配置' + variableConfig: '变量配置', + variableRequired: '必填', }, emotionEngine: { emotionEngineConfig: '情感引擎配置', @@ -1750,7 +1750,7 @@ export const zh = { daily: '每天', run: '运行调试', example: '原始数据', - exampleText: '我妹妹是2025年出生的,哦不对,我记错了,她其实是2024年出生的。对了,我的身份证号码是33252218293749845X。', + exampleText: '我是 2023 年春天去北京工作的,后来基本一直都在北京上班,也没怎么换过城市。不过后来公司调整,2024 年上半年我被调到上海待了差不多半年,那段时间每天都是在上海办公室打卡。当时入职资料用的还是我之前的身份信息,身份证号是 11010119950308123X,银行卡是 6222023847595898,这些一直没变。对了,其实我 从 2023 年开始就一直在北京生活,从来没有长期离开过北京,上海那段更多算是远程配合', runTitle: '反思试运行', status: '状态', message: '消息', diff --git a/web/src/views/Workflow/components/Chat/Chat.tsx b/web/src/views/Workflow/components/Chat/Chat.tsx index d907fdfc..09e47f61 100644 --- a/web/src/views/Workflow/components/Chat/Chat.tsx +++ b/web/src/views/Workflow/components/Chat/Chat.tsx @@ -1,7 +1,7 @@ import { forwardRef, useImperativeHandle, useState, useRef } from 'react' import { useTranslation } from 'react-i18next' import clsx from 'clsx' -import { Input, Form } from 'antd' +import { Input, Form, App } from 'antd' import { Space, Button } from 'antd' import ChatIcon from '@/assets/images/application/chat.png' @@ -18,6 +18,7 @@ import { type SSEMessage } from '@/utils/stream' const Chat = forwardRef(({ appId, graphRef }, ref) => { const { t } = useTranslation() + const { message: messageApi } = App.useApp() const [form] = Form.useForm<{ message: string }>() const variableConfigModalRef = useRef(null) const [open, setOpen] = useState(false) @@ -60,6 +61,26 @@ const Chat = forwardRef(({ appId } const handleClusterSend = () => { if (loading || !appId) return + let isCanSend = true + const params: Record = {} + if (variables.length > 0) { + const needRequired: string[] = [] + variables.forEach(vo => { + params[vo.name] = vo.value ?? vo.defaultValue + + if (vo.required && (params[vo.name] === null || params[vo.name] === undefined || params[vo.name] === '')) { + isCanSend = false + needRequired.push(vo.name) + } + }) + + if (needRequired.length) { + messageApi.error(`${needRequired.join(',')} ${t('workflow.variableRequired')}`) + } + } + if (!isCanSend) { + return + } setLoading(true) const message = form.getFieldValue('message') @@ -98,12 +119,6 @@ const Chat = forwardRef(({ appId } }) }; - const params: Record = {} - if (variables.length > 0) { - variables.forEach(vo => { - params[vo.name] = vo.value ?? vo.defaultValue - }) - } form.setFieldValue('message', undefined) draftRun(appId, { message: message, diff --git a/web/src/views/Workflow/components/Properties/index.tsx b/web/src/views/Workflow/components/Properties/index.tsx index 97b6a6e4..bc9a7113 100644 --- a/web/src/views/Workflow/components/Properties/index.tsx +++ b/web/src/views/Workflow/components/Properties/index.tsx @@ -125,7 +125,10 @@ const Properties: FC = ({ updateNodeLabel(e.target.value); }} /> - + + + + {configs && Object.keys(configs).length > 0 && Object.keys(configs).map((key) => { const config = configs[key] || {} @@ -207,6 +210,7 @@ const Properties: FC = ({ ? : config.type === 'customSelect' ?