diff --git a/web/src/components/large-model-form-field.tsx b/web/src/components/large-model-form-field.tsx index b8322e043..49b9d4db4 100644 --- a/web/src/components/large-model-form-field.tsx +++ b/web/src/components/large-model-form-field.tsx @@ -12,6 +12,7 @@ import { FormMessage, } from '@/components/ui/form'; import { LlmModelType } from '@/constants/knowledge'; +import { t } from 'i18next'; import { Funnel } from 'lucide-react'; import { useFormContext, useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; @@ -21,15 +22,15 @@ import { Button } from './ui/button'; const ModelTypes = [ { - title: 'All Models', + title: t('flow.allModels'), value: 'all', }, { - title: 'Text-only Models', + title: t('flow.textOnlyModels'), value: LlmModelType.Chat, }, { - title: 'Multimodal Models', + title: t('flow.multimodalModels'), value: LlmModelType.Image2text, }, ]; diff --git a/web/src/components/originui/select-with-search.tsx b/web/src/components/originui/select-with-search.tsx index 495dd8634..899fb529c 100644 --- a/web/src/components/originui/select-with-search.tsx +++ b/web/src/components/originui/select-with-search.tsx @@ -145,9 +145,9 @@ export const SelectWithSearch = forwardRef< align="start" > - + - No data found. + {t('common.noDataFound')} {options.map((group, idx) => { if (group.options) { return ( diff --git a/web/src/components/table-skeleton.tsx b/web/src/components/table-skeleton.tsx index 658eb896c..e02677ec6 100644 --- a/web/src/components/table-skeleton.tsx +++ b/web/src/components/table-skeleton.tsx @@ -1,3 +1,4 @@ +import { t } from 'i18next'; import { Loader2 } from 'lucide-react'; import { PropsWithChildren } from 'react'; import { TableCell, TableRow } from './ui/table'; @@ -28,5 +29,5 @@ export function TableSkeleton({ } export function TableEmpty({ columnsLength }: { columnsLength: number }) { - return No results.; + return {t('common.noResults')}; } diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 81c0f50ab..d4d1a7f0d 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -1,6 +1,7 @@ export default { translation: { common: { + noResults: 'No results.', selectPlaceholder: 'select value', delete: 'Delete', deleteModalTitle: 'Are you sure to delete this item?', @@ -40,6 +41,9 @@ export default { previousPage: 'Previous', nextPage: 'Next', add: 'Add', + remove: 'Remove', + search: 'Search', + noDataFound: 'No data found.', promptPlaceholder: `Please input or use / to quickly insert variables.`, mcp: { namePlaceholder: 'My MCP Server', @@ -860,11 +864,85 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s pleaseUploadAtLeastOneFile: 'Please upload at least one file', }, flow: { + beginInput: 'Begin Input', + ref: 'Variable', + stockCode: 'Stock Code', + apiKeyPlaceholder: + 'YOUR_API_KEY (obtained from https://serpapi.com/manage-api-key)', + flowStart: 'Start', + flowNum: 'Num', + test: 'Test', + extractDepth: 'Extract Depth', + format: 'Format', + basic: 'basic', + advanced: 'advanced', + general: 'general', + searchDepth: 'Search Depth', + tavilyTopic: 'Tavily Topic', + maxResults: 'Max Results', + includeAnswer: 'Include Answer', + includeRawContent: 'Include Raw Content', + includeImages: 'Include Images', + includeImageDescriptions: 'Include Image Descriptions', + includeDomains: 'Include Domains', + ExcludeDomains: 'Exclude Domains', + Days: 'Days', + comma: 'Comma', + semicolon: 'Semicolon', + period: 'Period', + lineBreak: 'Line Break', + tab: 'Tab', + space: 'Space', + delimiters: 'Delimiters', + merge: 'Merge', + split: 'Split', + script: 'Script', + iterationItemDescription: + 'It represents the current element in the iteration, which can be referenced and manipulated in subsequent steps.', + guidingQuestion: 'Guidance Question', + onFailure: 'On Failure', + userPromptDefaultValue: + 'This is the order you need to send to the agent.', + search: 'Search', + communication: 'Communication', + developer: 'Developer', + typeCommandOrsearch: 'Type a command or search...', + builtIn: 'Built-in', + ExceptionDefaultValue: 'Exception default value', + exceptionMethod: 'Exception method', + maxRounds: 'Max rounds', + delayEfterError: 'Delay after error', + maxRetries: 'Max retries', + advancedSettings: 'Advanced Settings', + addTools: 'Add Tools', + sysPromptDefultValue: ` + You are {{agent_name}}, an AI assistant specialized in {{domain_or_task}}. + + + 1. Understand the user’s request. + 2. Decompose it into logical subtasks. + 3. Execute each subtask step by step, reasoning transparently. + 4. Validate accuracy and consistency. + 5. Summarize the final result clearly. +`, + singleLineText: 'Single-line text', + multimodalModels: 'Multimodal Models', + textOnlyModels: 'Text-only Models', + allModels: 'All Models', + codeExecDescription: 'Write your custom Python or Javascript logic.', + stringTransformDescription: + 'Modifies text content. Currently supports: Splitting or concatenating text.', + foundation: 'Foundation', + tools: 'Tools', + dataManipulation: 'Data Manipulation', + flow: 'Flow', + dialog: 'Dialogue', cite: 'Cite', citeTip: 'citeTip', name: 'Name', nameMessage: 'Please input name', description: 'Description', + descriptionMessage: 'This is an agent for a specific task.', examples: 'Examples', to: 'To', msg: 'Messages', @@ -1289,6 +1367,7 @@ This delimiter is used to split the input text into several text pieces echo of variableSettings: 'Variable settings', globalVariables: 'Global variables', systemPrompt: 'System prompt', + userPrompt: 'User prompt', addCategory: 'Add category', categoryName: 'Category name', nextStep: 'Next step', @@ -1352,10 +1431,15 @@ This delimiter is used to split the input text into several text pieces echo of openingSwitchTip: 'Your users will see this welcome message at the beginning.', modeTip: 'The mode defines how the workflow is initiated.', + mode: 'Mode', + conversational: 'conversational', + task: 'task', beginInputTip: 'By defining input parameters, this content can be accessed by other components in subsequent processes.', query: 'Query variables', + queryTip: 'Select the variable you want to use', agent: 'Agent', + addAgent: 'Add Agent', agentDescription: 'Builds agent components equipped with reasoning, tool usage, and multi-agent collaboration. ', maxRecords: 'Max records', diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index 34b1a3719..15f6cf121 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -69,7 +69,7 @@ export default { setting: '用戶設置', logout: '登出', fileManager: '文件管理', - flow: 'Agent', + flow: '智能體', search: '搜尋', welcome: '歡迎來到', }, @@ -764,6 +764,23 @@ export default { destinationFolder: '目標資料夾', }, flow: { + line: '單行文本', + paragraph: '段落文字', + options: '選項', + file: '文件', + integer: '數字', + boolean: '布爾值', + multimodalModels: '多模態模型', + textOnlyModels: '進文本模型', + allModels: '所有模型', + codeExecDescription: '用 Python 或者 Javascript 編寫自定義邏輯', + stringTransformDescription: + '修改文本内容,目前支持文本分割、文本拼接操作', + foundation: '基礎', + tools: '工具', + dataManipulation: '數據操控', + flow: '流程', + dialog: '對話', cite: '引用', citeTip: 'citeTip', name: '名稱', @@ -805,7 +822,7 @@ export default { promptText: `請總結以下段落。注意數字,不要胡編亂造。段落如下: {input} 以上就是你需要總結的內容。`, - createGraph: '建立 Agent', + createGraph: '創建智能體', createFromTemplates: '從模板創建', retrieval: '知識檢索', generate: '生成回答', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 1f63d23a6..81e0b08c1 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -1,6 +1,7 @@ export default { translation: { common: { + noResults: '无结果。', selectPlaceholder: '请选择', delete: '删除', deleteModalTitle: '确定删除吗?', @@ -39,6 +40,9 @@ export default { previousPage: '上一页', nextPage: '下一页', add: '添加', + remove: '移除', + search: '搜索', + noDataFound: '没有找到数据。', promptPlaceholder: '请输入或使用 / 快速插入变量。', }, login: { @@ -71,7 +75,7 @@ export default { setting: '用户设置', logout: '登出', fileManager: '文件管理', - flow: 'Agent', + flow: '智能体', search: '搜索', welcome: '欢迎来到', dataset: '数据集', @@ -814,6 +818,89 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 pleaseUploadAtLeastOneFile: '请上传至少一个文件', }, flow: { + beginInput: '开始输入', + seconds: '秒', + ref: '引用变量', + stockCode: '股票代码', + apiKeyPlaceholder: '您的API密钥(从https://serpapi.com获取)', + flowStart: '开始', + flowNum: '编号', + test: '测试', + extractDepth: '深度提取', + format: '格式', + basic: '基本', + advanced: '高级', + general: '通用', + searchDepth: '深度搜索', + tavilyTopic: 'Tavily话题', + maxResults: '最大结果数', + includeAnswer: '包含答案', + includeRawContent: '包含原始内容', + includeImages: '包含图片', + includeImageDescriptions: '包含图片描述', + includeDomains: '包含域名', + ExcludeDomains: '排除域名', + Days: 'Days', + comma: '逗号', + semicolon: '分号', + period: '句点', + linebreak: '换行符', + tab: '制表符', + space: '空格', + delimiters: '分隔符', + merge: '合并', + split: '拆分', + script: '脚本', + iterationItemDescription: + '它是迭代过程中的当前元素,可以被后续流程引用和操作。', + guidingQuestion: '引导问题', + onFailure: '异常时', + userPromptDefaultValue: + 'This is the order you need to send to the agent.', + descriptionMessage: '这是一个用于特定任务的代理。', + search: '搜索', + communication: '通信', + developer: '开发者', + typeCommandOrsearch: '输入命令或或搜索...', + builtIn: '内置', + goto: '异常分支', + comment: '默认值', + ExceptionDefaultValue: '异常处理默认值', + exceptionMethod: '异常处理方法', + maxRounds: '最大轮数', + delayEfterError: '错误后延迟', + maxRetries: '最大重试次数', + advancedSettings: '高级设置', + addTools: '添加工具', + sysPromptDefultValue: ` + 您是{{agent_name}},一位专注于{{领域_or_任务}}的AI助手。 + + + 1. 理解用户请求。 + 2. 将其分解为逻辑子任务。 + 3. 逐步执行每个子任务,并清晰地进行推理。 + 4. 验证准确性和一致性。 + 5. 清晰地总结最终结果。 + `, + line: '单行文本', + paragraph: '段落文字', + options: '选项', + file: '文件', + integer: '数字', + boolean: '布尔值', + name: '名称', + singleLineText: '单行文本', + variableSettings: '变量设置', + multimodalModels: '多模态模型', + textOnlyModels: '仅文本模型', + allModels: '所有模型', + codeExecDescription: '用 Python 或者 Javascript 编写自定义逻辑', + stringTransformDescription: + '修改文本内容,目前支持文本分割、文本拼接操作', + foundation: '基础', + tools: '工具', + dataManipulation: '数据操控', + dialog: '对话', flow: '工作流', noMoreData: '没有更多数据了', historyversion: '历史版本', @@ -823,7 +910,6 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 }, cite: '引用', citeTip: '引用', - name: '名称', nameMessage: '请输入名称', description: '描述', examples: '示例', @@ -839,7 +925,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 'loop为当前组件循环次数上限,当循环次数超过loop的值时,说明组件不能完成当前任务,请重新优化agent', yes: '是', no: '否', - key: 'key', + key: '键', componentId: '组件ID', add: '新增', operation: '操作', @@ -861,7 +947,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 promptText: `请总结以下段落。注意数字,不要胡编乱造。段落如下: {input} 以上就是你需要总结的内容。`, - createGraph: '创建 Agent', + createGraph: '创建智能体', createFromTemplates: '从模板创建', retrieval: '知识检索', generate: '生成回答', @@ -911,7 +997,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 bing: 'Bing', bingDescription: '此组件用于从 https://www.bing.com/ 获取搜索结果。通常,它作为知识库的补充。Top N 和 Bing Subscription-Key 指定您需要调整的搜索结果数量。', - apiKey: 'API KEY', + apiKey: 'API密钥', country: '国家和地区', language: '语言', googleScholar: '谷歌学术', @@ -1255,6 +1341,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 team: '团队', }, systemPrompt: '系统提示词', + userPrompt: '用户提示词', prompt: '提示词', promptMessage: '提示词是必填项', promptTip: @@ -1270,21 +1357,26 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 openingCopy: '开场白文案', openingSwitchTip: '您的用户将在开始时看到此欢迎消息。', modeTip: '模式定义了工作流的启动方式。', + mode: '模式', + conversational: '对话式', + task: '任务', beginInputTip: '通过定义输入参数,此内容可以被后续流程中的其他组件访问。', query: '查询变量', + queryTip: '选择您想要使用的变量', agent: '智能体', + addAgent: '添加智能体', agentDescription: '构建具备推理、工具调用和多智能体协同的智能体组件。', maxRecords: '最大记录数', - createAgent: 'Create Agent', + createAgent: '创建智能体', stringTransform: '文本处理', userFillUp: '等待输入', userFillUpDescription: `此组件会暂停当前的流程并等待用户发送消息,接收到消息之后再进行之后的流程。`, codeExec: '代码', - tavilySearch: 'Tavily Search', + tavilySearch: 'Tavily 搜索', tavilySearchDescription: '通过 Tavily 服务搜索结果', - tavilyExtract: 'Tavily Extract', - tavilyExtractDescription: 'Tavily Extract', + tavilyExtract: 'Tavily 提取', + tavilyExtractDescription: 'Tavily 提取', log: '日志', management: '管理', import: '导入', diff --git a/web/src/pages/agent/canvas/node/agent-node.tsx b/web/src/pages/agent/canvas/node/agent-node.tsx index 3f633a64c..42b489a41 100644 --- a/web/src/pages/agent/canvas/node/agent-node.tsx +++ b/web/src/pages/agent/canvas/node/agent-node.tsx @@ -89,7 +89,7 @@ function InnerAgentNode({ {(isGotoMethod || exceptionMethod === AgentExceptionMethod.Comment) && (
- On Failure + {t('flow.onFailure')} {t(`flow.${exceptionMethod}`)} diff --git a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx index f1ae8df1b..222d1cbc0 100644 --- a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx +++ b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx @@ -21,6 +21,7 @@ import { Operator } from '@/pages/agent/constant'; import { AgentInstanceContext, HandleContext } from '@/pages/agent/context'; import OperatorIcon from '@/pages/agent/operator-icon'; import { Position } from '@xyflow/react'; +import { t } from 'i18next'; import { lowerFirst } from 'lodash'; import { PropsWithChildren, @@ -128,7 +129,9 @@ function AccordionOperators({ defaultValue={['item-1', 'item-2', 'item-3', 'item-4', 'item-5']} > - Foundation + + {t('flow.foundation')} + - Dialogue + + {t('flow.dialog')} + - Flow + + {t('flow.flow')} + - Data Manipulation + {t('flow.dataManipulation')} - Tools + + {t('flow.tools')} +
-
Next Step
+
{t('flow.nextStep')}
@@ -273,7 +282,7 @@ export function InnerNextStepDropdown({ onClick={(e) => e.stopPropagation()} className="w-[300px] font-semibold" > - Next Step + {t('flow.nextStep')} diff --git a/web/src/pages/agent/constant.tsx b/web/src/pages/agent/constant.tsx index 46edc870e..6c3c9f434 100644 --- a/web/src/pages/agent/constant.tsx +++ b/web/src/pages/agent/constant.tsx @@ -20,6 +20,7 @@ import { import { ModelVariableType } from '@/constants/knowledge'; import i18n from '@/locales/config'; import { setInitialChatVariableEnabledFieldValue } from '@/utils/chat'; +import { t } from 'i18next'; // DuckDuckGo's channel options export enum Channel { @@ -630,16 +631,7 @@ export const initialAgentValues = { ...initialLlmBaseValues, description: '', user_prompt: '', - sys_prompt: ` - You are {{agent_name}}, an AI assistant specialized in {{domain_or_task}}. - - - 1. Understand the user’s request. - 2. Decompose it into logical subtasks. - 3. Execute each subtask step by step, reasoning transparently. - 4. Validate accuracy and consistency. - 5. Summarize the final result clearly. -`, + sys_prompt: t('flow.sysPromptDefultValue'), prompts: [{ role: PromptRole.User, content: `{${AgentGlobals.SysQuery}}` }], message_history_window_size: 12, max_retries: 3, diff --git a/web/src/pages/agent/form/agent-form/agent-tools.tsx b/web/src/pages/agent/form/agent-form/agent-tools.tsx index 54706bb96..9e5620823 100644 --- a/web/src/pages/agent/form/agent-form/agent-tools.tsx +++ b/web/src/pages/agent/form/agent-form/agent-tools.tsx @@ -6,6 +6,7 @@ import { } from '@/components/ui/tooltip'; import { cn } from '@/lib/utils'; import { Position } from '@xyflow/react'; +import { t } from 'i18next'; import { PencilLine, X } from 'lucide-react'; import { MouseEventHandler, @@ -106,7 +107,7 @@ export function AgentTools() { return (
- Tools + {t('flow.tools')}
    {toolNames.map((x) => ( @@ -133,7 +134,7 @@ export function AgentTools() { ))}
- Add Tool + {t('flow.addTools')}
); @@ -160,7 +161,7 @@ export function Agents({ node }: INextOperatorForm) { return (
- Agents + {t('flow.agent')}
    {subBottomAgentNodeIds.map((id) => { const currentNode = getNode(id); @@ -183,7 +184,7 @@ export function Agents({ node }: INextOperatorForm) { position: Position.Bottom, })} > - Add Agent + {t('flow.addAgent')}
); diff --git a/web/src/pages/agent/form/agent-form/index.tsx b/web/src/pages/agent/form/agent-form/index.tsx index 2a9a9a42f..9ca0fb69c 100644 --- a/web/src/pages/agent/form/agent-form/index.tsx +++ b/web/src/pages/agent/form/agent-form/index.tsx @@ -144,7 +144,7 @@ function AgentForm({ node }: INextOperatorForm) { name={`sys_prompt`} render={({ field }) => ( - System Prompt + {t('flow.systemPrompt')} ( - User Prompt + {t('flow.userPrompt')}
- Advanced Settings
}> + {t('flow.advancedSettings')}
}> ( - Max retries + {t('flow.maxRetries')} @@ -220,7 +220,7 @@ function AgentForm({ node }: INextOperatorForm) { name={`delay_after_error`} render={({ field }) => ( - Delay after error + {t('flow.delayEfterError')} @@ -232,7 +232,7 @@ function AgentForm({ node }: INextOperatorForm) { name={`max_rounds`} render={({ field }) => ( - Max rounds + {t('flow.maxRounds')} @@ -244,7 +244,7 @@ function AgentForm({ node }: INextOperatorForm) { name={`exception_method`} render={({ field }) => ( - Exception method + {t('flow.exceptionMethod')} ( - Exception default value + {t('flow.ExceptionDefaultValue')} diff --git a/web/src/pages/agent/form/agent-form/tool-popover/index.tsx b/web/src/pages/agent/form/agent-form/tool-popover/index.tsx index 298d929b0..84f1ed46a 100644 --- a/web/src/pages/agent/form/agent-form/tool-popover/index.tsx +++ b/web/src/pages/agent/form/agent-form/tool-popover/index.tsx @@ -8,6 +8,7 @@ import { Operator } from '@/pages/agent/constant'; import { AgentFormContext, AgentInstanceContext } from '@/pages/agent/context'; import useGraphStore from '@/pages/agent/store'; import { Position } from '@xyflow/react'; +import { t } from 'i18next'; import { PropsWithChildren, useCallback, useContext, useEffect } from 'react'; import { useGetAgentMCPIds, useGetAgentToolNames } from '../use-get-tools'; import { MCPCommand, ToolCommand } from './tool-command'; @@ -65,8 +66,12 @@ export function ToolPopover({ children }: PropsWithChildren) { - Built-in - MCP + + {t('flow.builtIn')} + + + MCP + - + No results found. {Menus.map((x) => ( diff --git a/web/src/pages/agent/form/begin-form/index.tsx b/web/src/pages/agent/form/begin-form/index.tsx index db16a780f..ad4eb9d3e 100644 --- a/web/src/pages/agent/form/begin-form/index.tsx +++ b/web/src/pages/agent/form/begin-form/index.tsx @@ -12,8 +12,8 @@ import { RAGFlowSelect } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; import { Textarea } from '@/components/ui/textarea'; import { FormTooltip } from '@/components/ui/tooltip'; -import { buildSelectOptions } from '@/utils/component-util'; import { zodResolver } from '@hookform/resolvers/zod'; +import { t } from 'i18next'; import { Plus } from 'lucide-react'; import { memo, useEffect, useRef } from 'react'; import { useForm, useWatch } from 'react-hook-form'; @@ -27,10 +27,10 @@ import { useEditQueryRecord } from './use-edit-query'; import { useValues } from './use-values'; import { useWatchFormChange } from './use-watch-change'; -const ModeOptions = buildSelectOptions([ - AgentDialogueMode.Conversational, - AgentDialogueMode.Task, -]); +const ModeOptions = [ + { value: AgentDialogueMode.Conversational, label: t('flow.conversational') }, + { value: AgentDialogueMode.Task, label: t('flow.task') }, +]; function BeginForm({ node }: INextOperatorForm) { const { t } = useTranslation(); @@ -103,7 +103,9 @@ function BeginForm({ node }: INextOperatorForm) { name={'mode'} render={({ field }) => ( - Mode + + {t('flow.mode')} + ( - Type + {t('type')} @@ -151,7 +151,7 @@ function ParameterForm({ control={form.control} render={({ field }) => ( - Key + {t('key')} @@ -164,7 +164,7 @@ function ParameterForm({ control={form.control} render={({ field }) => ( - Name + {t('name')} @@ -177,7 +177,7 @@ function ParameterForm({ control={form.control} render={({ field }) => ( - Optional + {t('optional')} diff --git a/web/src/pages/agent/form/begin-form/query-table.tsx b/web/src/pages/agent/form/begin-form/query-table.tsx index 28333c3c7..5701c49b1 100644 --- a/web/src/pages/agent/form/begin-form/query-table.tsx +++ b/web/src/pages/agent/form/begin-form/query-table.tsx @@ -53,7 +53,7 @@ export function QueryTable({ data = [], deleteRecord, showModal }: IProps) { const columns: ColumnDef[] = [ { accessorKey: 'key', - header: 'Key', + header: t('flow.key'), meta: { cellClassName: 'max-w-30' }, cell: ({ row }) => { const key: string = row.getValue('key'); diff --git a/web/src/pages/agent/form/components/api-key-field.tsx b/web/src/pages/agent/form/components/api-key-field.tsx index cebca931b..f9debfc4f 100644 --- a/web/src/pages/agent/form/components/api-key-field.tsx +++ b/web/src/pages/agent/form/components/api-key-field.tsx @@ -6,6 +6,7 @@ import { FormMessage, } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; +import { t } from 'i18next'; import { useFormContext } from 'react-hook-form'; interface IApiKeyFieldProps { @@ -19,7 +20,7 @@ export function ApiKeyField({ placeholder }: IApiKeyFieldProps) { name="api_key" render={({ field }) => ( - Api Key + {t('flow.apiKey')} diff --git a/web/src/pages/agent/form/components/description-field.tsx b/web/src/pages/agent/form/components/description-field.tsx index 81c2ae140..8fa2eef64 100644 --- a/web/src/pages/agent/form/components/description-field.tsx +++ b/web/src/pages/agent/form/components/description-field.tsx @@ -5,6 +5,7 @@ import { FormLabel, } from '@/components/ui/form'; import { Textarea } from '@/components/ui/textarea'; +import { t } from 'i18next'; import { useFormContext } from 'react-hook-form'; export function DescriptionField() { @@ -15,7 +16,7 @@ export function DescriptionField() { name={`description`} render={({ field }) => ( - Description + {t('flow.description')} diff --git a/web/src/pages/agent/form/components/output.tsx b/web/src/pages/agent/form/components/output.tsx index 8d8aabde9..c481c7a38 100644 --- a/web/src/pages/agent/form/components/output.tsx +++ b/web/src/pages/agent/form/components/output.tsx @@ -1,3 +1,5 @@ +import { t } from 'i18next'; + export type OutputType = { title: string; type?: string; @@ -17,7 +19,7 @@ export function transferOutputs(outputs: Record) { export function Output({ list }: OutputProps) { return (
-
Output
+
{t('flow.output')}
    {list.map((x, idx) => (
  • ( {label || ( - + {t('flow.query')} )} diff --git a/web/src/pages/agent/form/exesql-form/index.tsx b/web/src/pages/agent/form/exesql-form/index.tsx index a0f05a41c..5a6cb5ba6 100644 --- a/web/src/pages/agent/form/exesql-form/index.tsx +++ b/web/src/pages/agent/form/exesql-form/index.tsx @@ -132,7 +132,7 @@ export function ExeSQLFormWidgets({ loading }: { loading: boolean }) {
    - Test + {t('test')}
    diff --git a/web/src/pages/agent/form/google-form/index.tsx b/web/src/pages/agent/form/google-form/index.tsx index 01cdc3b10..cec5ae4c7 100644 --- a/web/src/pages/agent/form/google-form/index.tsx +++ b/web/src/pages/agent/form/google-form/index.tsx @@ -99,13 +99,13 @@ const GoogleForm = ({ node }: INextOperatorForm) => { - + ( - {t('start')} + {t('flowStart')} @@ -118,7 +118,7 @@ const GoogleForm = ({ node }: INextOperatorForm) => { name={`num`} render={({ field }) => ( - {t('num')} + {t('flowNum')} diff --git a/web/src/pages/agent/form/invoke-form/variable-dialog.tsx b/web/src/pages/agent/form/invoke-form/variable-dialog.tsx index 8239971c8..03c4d83b0 100644 --- a/web/src/pages/agent/form/invoke-form/variable-dialog.tsx +++ b/web/src/pages/agent/form/invoke-form/variable-dialog.tsx @@ -134,7 +134,7 @@ export function VariableDialog({ > diff --git a/web/src/pages/agent/form/invoke-form/variable-table.tsx b/web/src/pages/agent/form/invoke-form/variable-table.tsx index 9a57bd4c0..33a747670 100644 --- a/web/src/pages/agent/form/invoke-form/variable-table.tsx +++ b/web/src/pages/agent/form/invoke-form/variable-table.tsx @@ -61,7 +61,7 @@ export function VariableTable({ const columns: ColumnDef[] = [ { accessorKey: 'key', - header: 'key', + header: t('flow.key'), meta: { cellClassName: 'max-w-30' }, cell: ({ row }) => { const key: string = row.getValue('key'); diff --git a/web/src/pages/agent/form/iteration-form/dynamic-output.tsx b/web/src/pages/agent/form/iteration-form/dynamic-output.tsx index 18a71f107..c31be8fd0 100644 --- a/web/src/pages/agent/form/iteration-form/dynamic-output.tsx +++ b/web/src/pages/agent/form/iteration-form/dynamic-output.tsx @@ -12,6 +12,7 @@ import { import { Input } from '@/components/ui/input'; import { Separator } from '@/components/ui/separator'; import { RAGFlowNodeType } from '@/interfaces/database/flow'; +import { t } from 'i18next'; import { X } from 'lucide-react'; import { ReactNode, useCallback, useMemo } from 'react'; import { useFieldArray, useFormContext } from 'react-hook-form'; @@ -107,7 +108,7 @@ export function DynamicOutputForm({ node }: IProps) { ); })} append({ name: '', ref: undefined })}> - Add + {t('common.add')} ); @@ -120,7 +121,7 @@ export function VariableTitle({ title }: { title: ReactNode }) { export function DynamicOutput({ node }: IProps) { return ( - + ); diff --git a/web/src/pages/agent/form/retrieval-form/next.tsx b/web/src/pages/agent/form/retrieval-form/next.tsx index 03ae60a25..425d08e4b 100644 --- a/web/src/pages/agent/form/retrieval-form/next.tsx +++ b/web/src/pages/agent/form/retrieval-form/next.tsx @@ -104,7 +104,7 @@ function RetrievalForm({ node }: INextOperatorForm) { - Advanced Settings}> + {t('flow.advancedSettings')}}> ({ label: key, value: val }), + ([key, val]) => ({ label: t('flow.' + toLower(key)), value: val }), ); function StringTransformForm({ node }: INextOperatorForm) { @@ -84,11 +85,13 @@ function StringTransformForm({ node }: INextOperatorForm) { name="method" render={({ field }) => ( - method + {t('flow.method')} ({ label: t('flow.' + val), value: val }), + )} onChange={(value) => { handleMethodChange(value); field.onChange(value); @@ -111,7 +114,7 @@ function StringTransformForm({ node }: INextOperatorForm) { name="script" render={({ field }) => ( - script + {t('flow.script')} @@ -125,7 +128,7 @@ function StringTransformForm({ node }: INextOperatorForm) { name="delimiters" render={({ field }) => ( - delimiters + {t('flow.delimiters')} {isSplit ? ( append({ operator: switchOperatorOptions[0].value })} > - Add + {t('common.add')}
@@ -268,7 +269,7 @@ function SwitchForm({ node }: IOperatorForm) { className="-translate-y-1" onClick={() => remove(index)} > - Remove + {t('common.remove')} )} @@ -317,7 +318,7 @@ function SwitchForm({ node }: IOperatorForm) { }) } > - Add + {t('common.add')} diff --git a/web/src/pages/agent/form/tavily-extract-form/index.tsx b/web/src/pages/agent/form/tavily-extract-form/index.tsx index 87c8ae75e..45a9e0fe7 100644 --- a/web/src/pages/agent/form/tavily-extract-form/index.tsx +++ b/web/src/pages/agent/form/tavily-extract-form/index.tsx @@ -10,6 +10,7 @@ import { import { RAGFlowSelect } from '@/components/ui/select'; import { buildOptions } from '@/utils/form'; import { zodResolver } from '@hookform/resolvers/zod'; +import { t } from 'i18next'; import { memo } from 'react'; import { useForm } from 'react-hook-form'; import { z } from 'zod'; @@ -79,12 +80,12 @@ function TavilyExtractForm({ node }: INextOperatorForm) { name="extract_depth" render={({ field }) => ( - Extract Depth + {t('flow.extractDepth')} @@ -96,7 +97,7 @@ function TavilyExtractForm({ node }: INextOperatorForm) { name="format" render={({ field }) => ( - Format + {t('flow.format')} { ))} - append({ value: '' })}>Add + append({ value: '' })}> + {t('common.add')} + ); }; diff --git a/web/src/pages/agent/form/tavily-form/index.tsx b/web/src/pages/agent/form/tavily-form/index.tsx index e1acae98b..afa8d859b 100644 --- a/web/src/pages/agent/form/tavily-form/index.tsx +++ b/web/src/pages/agent/form/tavily-form/index.tsx @@ -12,6 +12,7 @@ import { RAGFlowSelect } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; import { buildOptions } from '@/utils/form'; import { zodResolver } from '@hookform/resolvers/zod'; +import { t } from 'i18next'; import { memo } from 'react'; import { useForm } from 'react-hook-form'; import { z } from 'zod'; @@ -74,12 +75,12 @@ function TavilyForm({ node }: INextOperatorForm) { name="search_depth" render={({ field }) => ( - Search Depth + {t('flow.searchDepth')} @@ -91,12 +92,12 @@ function TavilyForm({ node }: INextOperatorForm) { name="topic" render={({ field }) => ( - TavilyTopic + {t('flow.tavilyTopic')} @@ -108,7 +109,7 @@ function TavilyForm({ node }: INextOperatorForm) { name="max_results" render={({ field }) => ( - Max Results + {t('flow.maxResults')} @@ -121,7 +122,7 @@ function TavilyForm({ node }: INextOperatorForm) { name="days" render={({ field }) => ( - Days + {t('flow.days')} @@ -134,7 +135,7 @@ function TavilyForm({ node }: INextOperatorForm) { name="include_answer" render={({ field }) => ( - Include Answer + {t('flow.includeAnswer')} ( - Include Raw Content + {t('flow.includeRawContent')} ( - Include Images + {t('flow.includeImages')} ( - Include Image Descriptions + {t('flow.includeImageDescriptions')}
diff --git a/web/src/pages/agent/form/tool-form/retrieval-form/index.tsx b/web/src/pages/agent/form/tool-form/retrieval-form/index.tsx index 9ae195492..bf187a6bf 100644 --- a/web/src/pages/agent/form/tool-form/retrieval-form/index.tsx +++ b/web/src/pages/agent/form/tool-form/retrieval-form/index.tsx @@ -8,6 +8,7 @@ import { TopNFormField } from '@/components/top-n-item'; import { Form } from '@/components/ui/form'; import { UseKnowledgeGraphFormField } from '@/components/use-knowledge-graph-item'; import { zodResolver } from '@hookform/resolvers/zod'; +import { t } from 'i18next'; import { useForm } from 'react-hook-form'; import { z } from 'zod'; import { DescriptionField } from '../../components/description-field'; @@ -41,7 +42,7 @@ const RetrievalForm = () => { - Advanced Settings}> + {t('flow.advancedSettings')}}> ( - Guiding Question + {t('flow.guidingQuestion')} ( - Message + + {t('flow.msg')} +