diff --git a/web/src/components/collapse.tsx b/web/src/components/collapse.tsx
new file mode 100644
index 000000000..35e85e257
--- /dev/null
+++ b/web/src/components/collapse.tsx
@@ -0,0 +1,28 @@
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '@/components/ui/collapsible';
+import { ListCollapse } from 'lucide-react';
+import { PropsWithChildren, ReactNode } from 'react';
+
+type CollapseProps = {
+ title?: ReactNode;
+ rightContent?: ReactNode;
+} & PropsWithChildren;
+
+export function Collapse({ title, children, rightContent }: CollapseProps) {
+ return (
+
+
+
+
+ {title}
+
+ {rightContent}
+
+
+ {children}
+
+ );
+}
diff --git a/web/src/components/ui/form.tsx b/web/src/components/ui/form.tsx
index 1829ce94c..15c4596a5 100644
--- a/web/src/components/ui/form.tsx
+++ b/web/src/components/ui/form.tsx
@@ -14,8 +14,7 @@ import {
import { Label } from '@/components/ui/label';
import { cn } from '@/lib/utils';
-import { Info } from 'lucide-react';
-import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';
+import { FormTooltip } from './tooltip';
const Form = FormProvider;
@@ -104,16 +103,7 @@ const FormLabel = React.forwardRef<
{...props}
>
{props.children}
- {tooltip && (
-
-
-
-
-
- {tooltip}
-
-
- )}
+ {tooltip && }
);
});
diff --git a/web/src/components/ui/tooltip.tsx b/web/src/components/ui/tooltip.tsx
index 756900453..7668b4baf 100644
--- a/web/src/components/ui/tooltip.tsx
+++ b/web/src/components/ui/tooltip.tsx
@@ -4,6 +4,7 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
import * as React from 'react';
import { cn } from '@/lib/utils';
+import { Info } from 'lucide-react';
const TooltipProvider = TooltipPrimitive.Provider;
@@ -28,3 +29,16 @@ const TooltipContent = React.forwardRef<
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
+
+export const FormTooltip = ({ tooltip }: { tooltip: React.ReactNode }) => {
+ return (
+
+
+
+
+
+ {tooltip}
+
+
+ );
+};
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index 08b086e0f..77163b2a6 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -455,7 +455,8 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s
modelTip: 'Large language chat model',
modelMessage: 'Please select!',
modelEnabledTools: 'Enabled tools',
- modelEnabledToolsTip: 'Please select one or more tools for the chat model to use. It takes no effect for models not supporting tool call.',
+ modelEnabledToolsTip:
+ 'Please select one or more tools for the chat model to use. It takes no effect for models not supporting tool call.',
freedom: 'Freedom',
improvise: 'Improvise',
precise: 'Precise',
@@ -1268,14 +1269,22 @@ This delimiter is used to split the input text into several text pieces echo of
codeDescription: 'It allows developers to write custom Python logic.',
inputVariables: 'Input variables',
runningHintText: 'is running...🕞',
+ openingSwitch: 'Opening switch',
+ openingCopy: 'Opening copy',
+ openingSwitchTip:
+ 'Your users will see this welcome message at the beginning.',
+ modeTip: 'The mode defines how the workflow is initiated.',
+ beginInputTip:
+ 'By defining input parameters, this content can be accessed by other components in subsequent processes.',
},
llmTools: {
bad_calculator: {
- name: "Calculator",
- description: "A tool to calculate the sum of two numbers (will give wrong answer)",
+ name: 'Calculator',
+ description:
+ 'A tool to calculate the sum of two numbers (will give wrong answer)',
params: {
- a: "The first number",
- b: "The second number",
+ a: 'The first number',
+ b: 'The second number',
},
},
},
diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts
index 1278a036c..822150e94 100644
--- a/web/src/locales/zh-traditional.ts
+++ b/web/src/locales/zh-traditional.ts
@@ -1162,6 +1162,9 @@ export default {
codeDescription: '它允許開發人員編寫自訂 Python 邏輯。',
inputVariables: '輸入變數',
runningHintText: '正在運行...🕞',
+ openingSwitchTip: '您的用戶將在開始時看到此歡迎訊息。',
+ modeTip: '模式定義工作流程如何啟動。 ',
+ beginInputTip: `透過定義輸入參數,這些內容可以在後續流程中被其他元件存取。`,
},
footer: {
profile: '“保留所有權利 @ react”',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 8472c5665..10404156a 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -462,7 +462,8 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
modelTip: '大语言聊天模型',
modelMessage: '请选择',
modelEnabledTools: '可用的工具',
- modelEnabledToolsTip: '请选择一个或多个可供该模型所使用的工具。仅对支持工具调用的模型生效。',
+ modelEnabledToolsTip:
+ '请选择一个或多个可供该模型所使用的工具。仅对支持工具调用的模型生效。',
freedom: '自由度',
improvise: '即兴创作',
precise: '精确',
@@ -1224,6 +1225,11 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
inputVariables: '输入变量',
addVariable: '新增变量',
runningHintText: '正在运行中...🕞',
+ openingSwitch: '开场白开关',
+ openingCopy: '开场白文案',
+ openingSwitchTip: '您的用户将在开始时看到此欢迎消息。',
+ modeTip: '模式定义了工作流的启动方式。',
+ beginInputTip: '通过定义输入参数,此内容可以被后续流程中的其他组件访问。',
},
footer: {
profile: 'All rights reserved @ React',
@@ -1235,11 +1241,11 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
},
llmTools: {
bad_calculator: {
- name: "计算器",
- description: "用于计算两个数的和的工具(会给出错误答案)",
+ name: '计算器',
+ description: '用于计算两个数的和的工具(会给出错误答案)',
params: {
- a: "第一个数",
- b: "第二个数",
+ a: '第一个数',
+ b: '第二个数',
},
},
},
diff --git a/web/src/pages/agent/constant.tsx b/web/src/pages/agent/constant.tsx
index 9a8f83926..9f9009127 100644
--- a/web/src/pages/agent/constant.tsx
+++ b/web/src/pages/agent/constant.tsx
@@ -29,7 +29,10 @@ import { ReactComponent as WenCaiIcon } from '@/assets/svg/wencai.svg';
import { ReactComponent as YahooFinanceIcon } from '@/assets/svg/yahoo-finance.svg';
import { CodeTemplateStrMap, ProgrammingLanguage } from '@/constants/agent';
-// 邮件功能
+export enum AgentDialogueMode {
+ Conversational = 'Conversational',
+ Task = 'Task',
+}
import {
ChatVariableEnabledField,
@@ -424,6 +427,7 @@ export const initialRetrievalValues = {
};
export const initialBeginValues = {
+ mode: AgentDialogueMode.Conversational,
prologue: `Hi! I'm your assistant, what can I do for you?`,
};
@@ -3006,8 +3010,3 @@ export const NoDebugOperatorsList = [
Operator.Switch,
Operator.Iteration,
];
-
-export enum AgentDialogueMode {
- Conversational = 'Conversational',
- Task = 'Task',
-}
diff --git a/web/src/pages/agent/form-sheet/use-form-config-map.tsx b/web/src/pages/agent/form-sheet/use-form-config-map.tsx
index df9ace65c..1415510fa 100644
--- a/web/src/pages/agent/form-sheet/use-form-config-map.tsx
+++ b/web/src/pages/agent/form-sheet/use-form-config-map.tsx
@@ -49,24 +49,27 @@ export function useFormConfigMap() {
mode: AgentDialogueMode.Conversational,
},
schema: z.object({
- enablePrologue: z.boolean(),
+ enablePrologue: z.boolean().optional(),
prologue: z
.string()
.min(1, {
message: t('common.namePlaceholder'),
})
- .trim(),
+ .trim()
+ .optional(),
mode: z.string(),
- query: z.array(
- z.object({
- key: z.string(),
- type: z.string(),
- value: z.string(),
- optional: z.boolean(),
- name: z.string(),
- options: z.array(z.union([z.number(), z.string(), z.boolean()])),
- }),
- ),
+ query: z
+ .array(
+ z.object({
+ key: z.string(),
+ type: z.string(),
+ value: z.string(),
+ optional: z.boolean(),
+ name: z.string(),
+ options: z.array(z.union([z.number(), z.string(), z.boolean()])),
+ }),
+ )
+ .optional(),
}),
},
[Operator.Retrieval]: {
diff --git a/web/src/pages/agent/form/begin-form/index.tsx b/web/src/pages/agent/form/begin-form/index.tsx
index 507752ea0..46dcd7c50 100644
--- a/web/src/pages/agent/form/begin-form/index.tsx
+++ b/web/src/pages/agent/form/begin-form/index.tsx
@@ -1,4 +1,5 @@
-import { BlockButton } from '@/components/ui/button';
+import { Collapse } from '@/components/collapse';
+import { Button } from '@/components/ui/button';
import {
Form,
FormControl,
@@ -10,7 +11,9 @@ import {
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/common-util';
+import { Plus } from 'lucide-react';
import { useCallback } from 'react';
import { useWatch } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
@@ -21,13 +24,16 @@ import { QueryTable } from './query-table';
import { useEditQueryRecord } from './use-edit-query';
const ModeOptions = buildSelectOptions([
- (AgentDialogueMode.Conversational, AgentDialogueMode.Task),
+ AgentDialogueMode.Conversational,
+ AgentDialogueMode.Task,
]);
const BeginForm = ({ form, node }: INextOperatorForm) => {
const { t } = useTranslation();
const query = useWatch({ control: form.control, name: 'query' });
+ const mode = useWatch({ control: form.control, name: 'mode' });
+
const enablePrologue = useWatch({
control: form.control,
name: 'enablePrologue',
@@ -61,7 +67,7 @@ const BeginForm = ({ form, node }: INextOperatorForm) => {
name={'mode'}
render={({ field }) => (
- Mode
+ Mode
{
)}
/>
- (
-
-
- Welcome Message
-
-
-
-
-
-
- )}
- />
+ {mode === AgentDialogueMode.Conversational && (
+ (
+
+
+ {t('flow.openingSwitch')}
+
+
+
+
+
+
+ )}
+ />
+ )}
{enablePrologue && (
{
render={({ field }) => (
- {t('chat.setAnOpener')}
+ {t('flow.openingCopy')}