mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix(i18n): Added new translations #3221 - Added and updated internationalization translations in multiple components ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
@ -89,7 +89,7 @@ function InnerAgentNode({
|
||||
{(isGotoMethod ||
|
||||
exceptionMethod === AgentExceptionMethod.Comment) && (
|
||||
<div className="bg-bg-card rounded-sm p-1 flex justify-between gap-2">
|
||||
<span className="text-text-secondary">On Failure</span>
|
||||
<span className="text-text-secondary">{t('flow.onFailure')}</span>
|
||||
<span className="truncate flex-1 text-right">
|
||||
{t(`flow.${exceptionMethod}`)}
|
||||
</span>
|
||||
|
||||
@ -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']}
|
||||
>
|
||||
<AccordionItem value="item-1">
|
||||
<AccordionTrigger className="text-xl">Foundation</AccordionTrigger>
|
||||
<AccordionTrigger className="text-xl">
|
||||
{t('flow.foundation')}
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="flex flex-col gap-4 text-balance">
|
||||
<OperatorItemList
|
||||
operators={[Operator.Agent, Operator.Retrieval]}
|
||||
@ -138,7 +141,9 @@ function AccordionOperators({
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
<AccordionItem value="item-2">
|
||||
<AccordionTrigger className="text-xl">Dialogue </AccordionTrigger>
|
||||
<AccordionTrigger className="text-xl">
|
||||
{t('flow.dialog')}
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="flex flex-col gap-4 text-balance">
|
||||
<OperatorItemList
|
||||
operators={[Operator.Message, Operator.UserFillUp]}
|
||||
@ -148,7 +153,9 @@ function AccordionOperators({
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
<AccordionItem value="item-3">
|
||||
<AccordionTrigger className="text-xl">Flow</AccordionTrigger>
|
||||
<AccordionTrigger className="text-xl">
|
||||
{t('flow.flow')}
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="flex flex-col gap-4 text-balance">
|
||||
<OperatorItemList
|
||||
operators={[
|
||||
@ -163,7 +170,7 @@ function AccordionOperators({
|
||||
</AccordionItem>
|
||||
<AccordionItem value="item-4">
|
||||
<AccordionTrigger className="text-xl">
|
||||
Data Manipulation
|
||||
{t('flow.dataManipulation')}
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="flex flex-col gap-4 text-balance">
|
||||
<OperatorItemList
|
||||
@ -174,7 +181,9 @@ function AccordionOperators({
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
<AccordionItem value="item-5">
|
||||
<AccordionTrigger className="text-xl">Tools</AccordionTrigger>
|
||||
<AccordionTrigger className="text-xl">
|
||||
{t('flow.tools')}
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="flex flex-col gap-4 text-balance">
|
||||
<OperatorItemList
|
||||
operators={[
|
||||
@ -244,7 +253,7 @@ export function InnerNextStepDropdown({
|
||||
>
|
||||
<div className="w-[300px] font-semibold bg-bg-base border border-border rounded-md shadow-lg">
|
||||
<div className="px-3 py-2 border-b border-border">
|
||||
<div className="text-sm font-medium">Next Step</div>
|
||||
<div className="text-sm font-medium">{t('flow.nextStep')}</div>
|
||||
</div>
|
||||
<HideModalContext.Provider value={hideModal}>
|
||||
<OnNodeCreatedContext.Provider value={onNodeCreated}>
|
||||
@ -273,7 +282,7 @@ export function InnerNextStepDropdown({
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="w-[300px] font-semibold"
|
||||
>
|
||||
<DropdownMenuLabel>Next Step</DropdownMenuLabel>
|
||||
<DropdownMenuLabel>{t('flow.nextStep')}</DropdownMenuLabel>
|
||||
<HideModalContext.Provider value={hideModal}>
|
||||
<AccordionOperators></AccordionOperators>
|
||||
</HideModalContext.Provider>
|
||||
|
||||
@ -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: `<role>
|
||||
You are {{agent_name}}, an AI assistant specialized in {{domain_or_task}}.
|
||||
</role>
|
||||
<instructions>
|
||||
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.
|
||||
</instructions>`,
|
||||
sys_prompt: t('flow.sysPromptDefultValue'),
|
||||
prompts: [{ role: PromptRole.User, content: `{${AgentGlobals.SysQuery}}` }],
|
||||
message_history_window_size: 12,
|
||||
max_retries: 3,
|
||||
|
||||
@ -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 (
|
||||
<section className="space-y-2.5">
|
||||
<span className="text-text-secondary">Tools</span>
|
||||
<span className="text-text-secondary">{t('flow.tools')}</span>
|
||||
<ul className="space-y-2">
|
||||
{toolNames.map((x) => (
|
||||
<ToolCard key={x}>
|
||||
@ -133,7 +134,7 @@ export function AgentTools() {
|
||||
))}
|
||||
</ul>
|
||||
<ToolPopover>
|
||||
<BlockButton>Add Tool</BlockButton>
|
||||
<BlockButton>{t('flow.addTools')}</BlockButton>
|
||||
</ToolPopover>
|
||||
</section>
|
||||
);
|
||||
@ -160,7 +161,7 @@ export function Agents({ node }: INextOperatorForm) {
|
||||
|
||||
return (
|
||||
<section className="space-y-2.5">
|
||||
<span className="text-text-secondary">Agents</span>
|
||||
<span className="text-text-secondary">{t('flow.agent')}</span>
|
||||
<ul className="space-y-2">
|
||||
{subBottomAgentNodeIds.map((id) => {
|
||||
const currentNode = getNode(id);
|
||||
@ -183,7 +184,7 @@ export function Agents({ node }: INextOperatorForm) {
|
||||
position: Position.Bottom,
|
||||
})}
|
||||
>
|
||||
Add Agent
|
||||
{t('flow.addAgent')}
|
||||
</BlockButton>
|
||||
</section>
|
||||
);
|
||||
|
||||
@ -144,7 +144,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
name={`sys_prompt`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>System Prompt</FormLabel>
|
||||
<FormLabel>{t('flow.systemPrompt')}</FormLabel>
|
||||
<FormControl>
|
||||
<PromptEditor
|
||||
{...field}
|
||||
@ -164,7 +164,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
name={`prompts`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>User Prompt</FormLabel>
|
||||
<FormLabel>{t('flow.userPrompt')}</FormLabel>
|
||||
<FormControl>
|
||||
<section>
|
||||
<PromptEditor
|
||||
@ -183,7 +183,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
<AgentTools></AgentTools>
|
||||
<Agents node={node}></Agents>
|
||||
</FormContainer>
|
||||
<Collapse title={<div>Advanced Settings</div>}>
|
||||
<Collapse title={<div>{t('flow.advancedSettings')}</div>}>
|
||||
<FormContainer>
|
||||
<MessageHistoryWindowSizeFormField></MessageHistoryWindowSizeFormField>
|
||||
<FormField
|
||||
@ -208,7 +208,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
name={`max_retries`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>Max retries</FormLabel>
|
||||
<FormLabel>{t('flow.maxRetries')}</FormLabel>
|
||||
<FormControl>
|
||||
<NumberInput {...field} max={8}></NumberInput>
|
||||
</FormControl>
|
||||
@ -220,7 +220,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
name={`delay_after_error`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>Delay after error</FormLabel>
|
||||
<FormLabel>{t('flow.delayEfterError')}</FormLabel>
|
||||
<FormControl>
|
||||
<NumberInput {...field} max={5} step={0.1}></NumberInput>
|
||||
</FormControl>
|
||||
@ -232,7 +232,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
name={`max_rounds`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>Max rounds</FormLabel>
|
||||
<FormLabel>{t('flow.maxRounds')}</FormLabel>
|
||||
<FormControl>
|
||||
<NumberInput {...field}></NumberInput>
|
||||
</FormControl>
|
||||
@ -244,7 +244,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
name={`exception_method`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>Exception method</FormLabel>
|
||||
<FormLabel>{t('flow.exceptionMethod')}</FormLabel>
|
||||
<FormControl>
|
||||
<SelectWithSearch
|
||||
{...field}
|
||||
@ -261,7 +261,7 @@ function AgentForm({ node }: INextOperatorForm) {
|
||||
name={`exception_default_value`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>Exception default value</FormLabel>
|
||||
<FormLabel>{t('flow.ExceptionDefaultValue')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
|
||||
@ -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) {
|
||||
<PopoverContent className="w-80 p-4">
|
||||
<Tabs defaultValue={ToolType.Common}>
|
||||
<TabsList>
|
||||
<TabsTrigger value={ToolType.Common}>Built-in</TabsTrigger>
|
||||
<TabsTrigger value={ToolType.MCP}>MCP</TabsTrigger>
|
||||
<TabsTrigger value={ToolType.Common} className="bg-bg-card">
|
||||
{t('flow.builtIn')}
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value={ToolType.MCP} className="bg-bg-card">
|
||||
MCP
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value={ToolType.Common}>
|
||||
<ToolCommand
|
||||
|
||||
@ -12,13 +12,14 @@ import { useListMcpServer } from '@/hooks/use-mcp-request';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Operator } from '@/pages/agent/constant';
|
||||
import OperatorIcon from '@/pages/agent/operator-icon';
|
||||
import { t } from 'i18next';
|
||||
import { lowerFirst } from 'lodash';
|
||||
import { PropsWithChildren, useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const Menus = [
|
||||
{
|
||||
label: 'Search',
|
||||
label: t('flow.search'),
|
||||
list: [
|
||||
Operator.TavilySearch,
|
||||
Operator.TavilyExtract,
|
||||
@ -34,7 +35,7 @@ const Menus = [
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Communication',
|
||||
label: t('flow.communication'),
|
||||
list: [Operator.Email],
|
||||
},
|
||||
// {
|
||||
@ -42,7 +43,7 @@ const Menus = [
|
||||
// list: [],
|
||||
// },
|
||||
{
|
||||
label: 'Developer',
|
||||
label: t('flow.developer'),
|
||||
list: [Operator.GitHub, Operator.ExeSQL, Operator.Code, Operator.Retrieval],
|
||||
},
|
||||
];
|
||||
@ -116,7 +117,7 @@ export function ToolCommand({ value, onChange }: ToolCommandProps) {
|
||||
|
||||
return (
|
||||
<Command>
|
||||
<CommandInput placeholder="Type a command or search..." />
|
||||
<CommandInput placeholder={t('flow.typeCommandOrsearch')} />
|
||||
<CommandList>
|
||||
<CommandEmpty>No results found.</CommandEmpty>
|
||||
{Menus.map((x) => (
|
||||
|
||||
@ -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 }) => (
|
||||
<FormItem>
|
||||
<FormLabel tooltip={t('flow.modeTip')}>Mode</FormLabel>
|
||||
<FormLabel tooltip={t('flow.modeTip')}>
|
||||
{t('flow.mode')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect
|
||||
placeholder={t('common.pleaseSelect')}
|
||||
|
||||
@ -138,7 +138,7 @@ function ParameterForm({
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Type</FormLabel>
|
||||
<FormLabel>{t('type')}</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect {...field} options={options} />
|
||||
</FormControl>
|
||||
@ -151,7 +151,7 @@ function ParameterForm({
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Key</FormLabel>
|
||||
<FormLabel>{t('key')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} autoComplete="off" onBlur={handleKeyChange} />
|
||||
</FormControl>
|
||||
@ -164,7 +164,7 @@ function ParameterForm({
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Name</FormLabel>
|
||||
<FormLabel>{t('name')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@ -177,7 +177,7 @@ function ParameterForm({
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Optional</FormLabel>
|
||||
<FormLabel>{t('optional')}</FormLabel>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={field.value}
|
||||
@ -217,7 +217,7 @@ export function ParameterDialog({
|
||||
></ParameterForm>
|
||||
<DialogFooter>
|
||||
<Button type="submit" form={FormId}>
|
||||
Confirm
|
||||
{t('modal.okText')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
@ -53,7 +53,7 @@ export function QueryTable({ data = [], deleteRecord, showModal }: IProps) {
|
||||
const columns: ColumnDef<BeginQuery>[] = [
|
||||
{
|
||||
accessorKey: 'key',
|
||||
header: 'Key',
|
||||
header: t('flow.key'),
|
||||
meta: { cellClassName: 'max-w-30' },
|
||||
cell: ({ row }) => {
|
||||
const key: string = row.getValue('key');
|
||||
|
||||
@ -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 }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Api Key</FormLabel>
|
||||
<FormLabel>{t('flow.apiKey')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" {...field} placeholder={placeholder}></Input>
|
||||
</FormControl>
|
||||
|
||||
@ -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 }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>Description</FormLabel>
|
||||
<FormLabel>{t('flow.description')}</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field}></Textarea>
|
||||
</FormControl>
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { t } from 'i18next';
|
||||
|
||||
export type OutputType = {
|
||||
title: string;
|
||||
type?: string;
|
||||
@ -17,7 +19,7 @@ export function transferOutputs(outputs: Record<string, any>) {
|
||||
export function Output({ list }: OutputProps) {
|
||||
return (
|
||||
<section className="space-y-2">
|
||||
<div>Output</div>
|
||||
<div>{t('flow.output')}</div>
|
||||
<ul>
|
||||
{list.map((x, idx) => (
|
||||
<li
|
||||
|
||||
@ -47,7 +47,7 @@ export function QueryVariable({
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
{label || (
|
||||
<FormLabel tooltip={t('chat.modelTip')}>
|
||||
<FormLabel tooltip={t('flow.queryTip')}>
|
||||
{t('flow.query')}
|
||||
</FormLabel>
|
||||
)}
|
||||
|
||||
@ -132,7 +132,7 @@ export function ExeSQLFormWidgets({ loading }: { loading: boolean }) {
|
||||
|
||||
<div className="flex justify-end">
|
||||
<ButtonLoading loading={loading} type="submit">
|
||||
Test
|
||||
{t('test')}
|
||||
</ButtonLoading>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@ -99,13 +99,13 @@ const GoogleForm = ({ node }: INextOperatorForm) => {
|
||||
<QueryVariable name="q"></QueryVariable>
|
||||
</FormContainer>
|
||||
<FormContainer>
|
||||
<ApiKeyField placeholder="YOUR_API_KEY (obtained from https://serpapi.com/manage-api-key)"></ApiKeyField>
|
||||
<ApiKeyField placeholder={t('apiKeyPlaceholder')}></ApiKeyField>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`start`}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('start')}</FormLabel>
|
||||
<FormLabel>{t('flowStart')}</FormLabel>
|
||||
<FormControl>
|
||||
<NumberInput {...field} className="w-full"></NumberInput>
|
||||
</FormControl>
|
||||
@ -118,7 +118,7 @@ const GoogleForm = ({ node }: INextOperatorForm) => {
|
||||
name={`num`}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('num')}</FormLabel>
|
||||
<FormLabel>{t('flowNum')}</FormLabel>
|
||||
<FormControl>
|
||||
<NumberInput {...field} className="w-full"></NumberInput>
|
||||
</FormControl>
|
||||
|
||||
@ -134,7 +134,7 @@ export function VariableDialog({
|
||||
></VariableForm>
|
||||
<DialogFooter>
|
||||
<Button type="submit" form={FormId}>
|
||||
Confirm
|
||||
{t('modal.okText')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
@ -61,7 +61,7 @@ export function VariableTable({
|
||||
const columns: ColumnDef<VariableFormSchemaType>[] = [
|
||||
{
|
||||
accessorKey: 'key',
|
||||
header: 'key',
|
||||
header: t('flow.key'),
|
||||
meta: { cellClassName: 'max-w-30' },
|
||||
cell: ({ row }) => {
|
||||
const key: string = row.getValue('key');
|
||||
|
||||
@ -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) {
|
||||
);
|
||||
})}
|
||||
<BlockButton onClick={() => append({ name: '', ref: undefined })}>
|
||||
Add
|
||||
{t('common.add')}
|
||||
</BlockButton>
|
||||
</div>
|
||||
);
|
||||
@ -120,7 +121,7 @@ export function VariableTitle({ title }: { title: ReactNode }) {
|
||||
export function DynamicOutput({ node }: IProps) {
|
||||
return (
|
||||
<FormContainer>
|
||||
<VariableTitle title={'Output'}></VariableTitle>
|
||||
<VariableTitle title={t('flow.output')}></VariableTitle>
|
||||
<DynamicOutputForm node={node}></DynamicOutputForm>
|
||||
</FormContainer>
|
||||
);
|
||||
|
||||
@ -104,7 +104,7 @@ function RetrievalForm({ node }: INextOperatorForm) {
|
||||
</RAGFlowFormItem>
|
||||
<KnowledgeBaseFormField showVariable></KnowledgeBaseFormField>
|
||||
</FormContainer>
|
||||
<Collapse title={<div>Advanced Settings</div>}>
|
||||
<Collapse title={<div>{t('flow.advancedSettings')}</div>}>
|
||||
<FormContainer>
|
||||
<SimilaritySliderFormField
|
||||
vectorSimilarityWeightName="keywords_similarity_weight"
|
||||
|
||||
@ -9,8 +9,9 @@ import {
|
||||
} from '@/components/ui/form';
|
||||
import { MultiSelect } from '@/components/ui/multi-select';
|
||||
import { RAGFlowSelect } from '@/components/ui/select';
|
||||
import { buildOptions } from '@/utils/form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { t } from 'i18next';
|
||||
import { toLower } from 'lodash';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
import { useForm, useWatch } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
@ -28,7 +29,7 @@ import { useValues } from './use-values';
|
||||
import { useWatchFormChange } from './use-watch-form-change';
|
||||
|
||||
const DelimiterOptions = Object.entries(StringTransformDelimiter).map(
|
||||
([key, val]) => ({ 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 }) => (
|
||||
<FormItem>
|
||||
<FormLabel>method</FormLabel>
|
||||
<FormLabel>{t('flow.method')}</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect
|
||||
{...field}
|
||||
options={buildOptions(StringTransformMethod)}
|
||||
options={Object.values(StringTransformMethod).map(
|
||||
(val) => ({ 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 }) => (
|
||||
<FormItem>
|
||||
<FormLabel>script</FormLabel>
|
||||
<FormLabel>{t('flow.script')}</FormLabel>
|
||||
<FormControl>
|
||||
<PromptEditor {...field} showToolbar={false}></PromptEditor>
|
||||
</FormControl>
|
||||
@ -125,7 +128,7 @@ function StringTransformForm({ node }: INextOperatorForm) {
|
||||
name="delimiters"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>delimiters</FormLabel>
|
||||
<FormLabel>{t('flow.delimiters')}</FormLabel>
|
||||
<FormControl>
|
||||
{isSplit ? (
|
||||
<MultiSelect
|
||||
|
||||
@ -15,6 +15,7 @@ import { Separator } from '@/components/ui/separator';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { t } from 'i18next';
|
||||
import { toLower } from 'lodash';
|
||||
import { X } from 'lucide-react';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
@ -197,7 +198,7 @@ function ConditionCards({
|
||||
className="mt-6"
|
||||
onClick={() => append({ operator: switchOperatorOptions[0].value })}
|
||||
>
|
||||
Add
|
||||
{t('common.add')}
|
||||
</BlockButton>
|
||||
</div>
|
||||
</section>
|
||||
@ -268,7 +269,7 @@ function SwitchForm({ node }: IOperatorForm) {
|
||||
className="-translate-y-1"
|
||||
onClick={() => remove(index)}
|
||||
>
|
||||
Remove <X />
|
||||
{t('common.remove')} <X />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@ -317,7 +318,7 @@ function SwitchForm({ node }: IOperatorForm) {
|
||||
})
|
||||
}
|
||||
>
|
||||
Add
|
||||
{t('common.add')}
|
||||
</BlockButton>
|
||||
</FormWrapper>
|
||||
</Form>
|
||||
|
||||
@ -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 }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Extract Depth</FormLabel>
|
||||
<FormLabel>{t('flow.extractDepth')}</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect
|
||||
placeholder="shadcn"
|
||||
{...field}
|
||||
options={buildOptions(TavilyExtractDepth)}
|
||||
options={buildOptions(TavilyExtractDepth, t, 'flow')}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
@ -96,7 +97,7 @@ function TavilyExtractForm({ node }: INextOperatorForm) {
|
||||
name="format"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Format</FormLabel>
|
||||
<FormLabel>{t('flow.format')}</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect
|
||||
placeholder="shadcn"
|
||||
|
||||
@ -7,6 +7,7 @@ import {
|
||||
FormMessage,
|
||||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { t } from 'i18next';
|
||||
import { X } from 'lucide-react';
|
||||
import { ReactNode } from 'react';
|
||||
import { useFieldArray, useFormContext } from 'react-hook-form';
|
||||
@ -51,7 +52,9 @@ export const DynamicDomain = ({ name, label }: DynamicDomainProps) => {
|
||||
))}
|
||||
</div>
|
||||
<FormMessage />
|
||||
<BlockButton onClick={() => append({ value: '' })}>Add</BlockButton>
|
||||
<BlockButton onClick={() => append({ value: '' })}>
|
||||
{t('common.add')}
|
||||
</BlockButton>
|
||||
</FormItem>
|
||||
);
|
||||
};
|
||||
|
||||
@ -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 }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Search Depth</FormLabel>
|
||||
<FormLabel>{t('flow.searchDepth')}</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect
|
||||
placeholder="shadcn"
|
||||
{...field}
|
||||
options={buildOptions(TavilySearchDepth)}
|
||||
options={buildOptions(TavilySearchDepth, t, 'flow')}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
@ -91,12 +92,12 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
name="topic"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>TavilyTopic</FormLabel>
|
||||
<FormLabel>{t('flow.tavilyTopic')}</FormLabel>
|
||||
<FormControl>
|
||||
<RAGFlowSelect
|
||||
placeholder="shadcn"
|
||||
{...field}
|
||||
options={buildOptions(TavilyTopic)}
|
||||
options={buildOptions(TavilyTopic, t, 'flow')}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
@ -108,7 +109,7 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
name="max_results"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Max Results</FormLabel>
|
||||
<FormLabel>{t('flow.maxResults')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type={'number'} {...field}></Input>
|
||||
</FormControl>
|
||||
@ -121,7 +122,7 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
name="days"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Days</FormLabel>
|
||||
<FormLabel>{t('flow.days')}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type={'number'} {...field}></Input>
|
||||
</FormControl>
|
||||
@ -134,7 +135,7 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
name="include_answer"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Include Answer</FormLabel>
|
||||
<FormLabel>{t('flow.includeAnswer')}</FormLabel>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={field.value}
|
||||
@ -150,7 +151,7 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
name="include_raw_content"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Include Raw Content</FormLabel>
|
||||
<FormLabel>{t('flow.includeRawContent')}</FormLabel>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={field.value}
|
||||
@ -166,7 +167,7 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
name="include_images"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Include Images</FormLabel>
|
||||
<FormLabel>{t('flow.includeImages')}</FormLabel>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={field.value}
|
||||
@ -182,7 +183,7 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
name="include_image_descriptions"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Include Image Descriptions</FormLabel>
|
||||
<FormLabel>{t('flow.includeImageDescriptions')}</FormLabel>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={field.value}
|
||||
@ -195,11 +196,11 @@ function TavilyForm({ node }: INextOperatorForm) {
|
||||
/>
|
||||
<DynamicDomain
|
||||
name="include_domains"
|
||||
label={'Include Domains'}
|
||||
label={t('flow.includeDomains')}
|
||||
></DynamicDomain>
|
||||
<DynamicDomain
|
||||
name="exclude_domains"
|
||||
label={'Exclude Domains'}
|
||||
label={t('flow.ExcludeDomains')}
|
||||
></DynamicDomain>
|
||||
</FormContainer>
|
||||
</FormWrapper>
|
||||
|
||||
@ -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 = () => {
|
||||
<DescriptionField></DescriptionField>
|
||||
<KnowledgeBaseFormField showVariable></KnowledgeBaseFormField>
|
||||
</FormContainer>
|
||||
<Collapse title={<div>Advanced Settings</div>}>
|
||||
<Collapse title={<div>{t('flow.advancedSettings')}</div>}>
|
||||
<FormContainer>
|
||||
<SimilaritySliderFormField
|
||||
vectorSimilarityWeightName="keywords_similarity_weight"
|
||||
|
||||
@ -86,7 +86,7 @@ function UserFillUpForm({ node }: INextOperatorForm) {
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel tooltip={t('flow.openingSwitchTip')}>
|
||||
Guiding Question
|
||||
{t('flow.guidingQuestion')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Switch
|
||||
@ -104,7 +104,9 @@ function UserFillUpForm({ node }: INextOperatorForm) {
|
||||
name={'tips'}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel tooltip={t('chat.setAnOpenerTip')}>Message</FormLabel>
|
||||
<FormLabel tooltip={t('chat.setAnOpenerTip')}>
|
||||
{t('flow.msg')}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea
|
||||
rows={5}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { useFetchModelId } from '@/hooks/logic-hooks';
|
||||
import { Connection, Node, Position, ReactFlowInstance } from '@xyflow/react';
|
||||
import humanId from 'human-id';
|
||||
import { t } from 'i18next';
|
||||
import { lowerFirst } from 'lodash';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@ -122,8 +123,8 @@ export const useInitializeOperatorParams = () => {
|
||||
if (isBottomSubAgent(operatorName, position)) {
|
||||
return {
|
||||
...initialValues,
|
||||
description: 'This is an agent for a specific task.',
|
||||
user_prompt: 'This is the order you need to send to the agent.',
|
||||
description: t('flow.descriptionMessage'),
|
||||
user_prompt: t('flow.userPromptDefaultValue'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ import { useFetchAgent } from '@/hooks/use-agent-request';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { Edge } from '@xyflow/react';
|
||||
import { DefaultOptionType } from 'antd/es/select';
|
||||
import { t } from 'i18next';
|
||||
import { isEmpty } from 'lodash';
|
||||
import get from 'lodash/get';
|
||||
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
@ -145,7 +146,7 @@ export function useBuildBeginVariableOptions() {
|
||||
const options = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
label: <span>Begin Input</span>,
|
||||
label: <span>{t('flow.beginInput')}</span>,
|
||||
title: 'Begin Input',
|
||||
options: inputs.map((x) => ({
|
||||
label: x.name,
|
||||
|
||||
@ -4,6 +4,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
||||
import { useFetchAgentListByPage } from '@/hooks/use-agent-request';
|
||||
import { t } from 'i18next';
|
||||
import { pick } from 'lodash';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { useCallback } from 'react';
|
||||
@ -41,7 +42,7 @@ export default function Agents() {
|
||||
>
|
||||
<Button onClick={navigateToAgentTemplates}>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
Create Agent
|
||||
{t('flow.createGraph')}
|
||||
</Button>
|
||||
</ListFilterBar>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user