) {
const edges = useGraphStore((state) => state.edges);
+ const { t } = useTranslation();
const isHeadAgent = useMemo(() => {
return !isBottomSubAgent(edges, id);
@@ -87,9 +89,9 @@ function InnerAgentNode({
{(isGotoMethod ||
exceptionMethod === AgentExceptionMethod.Comment) && (
- Abnormal
-
- {isGotoMethod ? 'Exception branch' : 'Output default value'}
+ On Failure
+
+ {t(`flow.${exceptionMethod}`)}
)}
diff --git a/web/src/pages/agent/constant.tsx b/web/src/pages/agent/constant.tsx
index fe3255d17..6f82c5d5d 100644
--- a/web/src/pages/agent/constant.tsx
+++ b/web/src/pages/agent/constant.tsx
@@ -645,15 +645,23 @@ export const initialAgentValues = {
...initialLlmBaseValues,
description: '',
user_prompt: '',
- sys_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.
+`,
prompts: [{ role: PromptRole.User, content: `{${AgentGlobals.SysQuery}}` }],
message_history_window_size: 12,
max_retries: 3,
delay_after_error: 1,
visual_files_var: '',
max_rounds: 5,
- exception_method: null,
- exception_comment: '',
+ exception_method: '',
exception_goto: [],
exception_default_value: '',
tools: [],
@@ -944,5 +952,4 @@ export enum VariableType {
export enum AgentExceptionMethod {
Comment = 'comment',
Goto = 'goto',
- Null = 'null',
}
diff --git a/web/src/pages/agent/form/agent-form/index.tsx b/web/src/pages/agent/form/agent-form/index.tsx
index c12b992c9..72cb6200b 100644
--- a/web/src/pages/agent/form/agent-form/index.tsx
+++ b/web/src/pages/agent/form/agent-form/index.tsx
@@ -6,6 +6,7 @@ import {
} from '@/components/large-model-form-field';
import { LlmSettingSchema } from '@/components/llm-setting-items/next';
import { MessageHistoryWindowSizeFormField } from '@/components/message-history-window-size-item';
+import { SelectWithSearch } from '@/components/originui/select-with-search';
import {
Form,
FormControl,
@@ -14,10 +15,8 @@ import {
FormLabel,
} from '@/components/ui/form';
import { Input, NumberInput } from '@/components/ui/input';
-import { RAGFlowSelect } from '@/components/ui/select';
import { LlmModelType } from '@/constants/knowledge';
import { useFindLlmByUuid } from '@/hooks/use-llm-request';
-import { buildOptions } from '@/utils/form';
import { zodResolver } from '@hookform/resolvers/zod';
import { memo, useEffect, useMemo } from 'react';
import { useForm, useWatch } from 'react-hook-form';
@@ -42,8 +41,6 @@ import { AgentTools, Agents } from './agent-tools';
import { useValues } from './use-values';
import { useWatchFormChange } from './use-watch-change';
-const exceptionMethodOptions = buildOptions(AgentExceptionMethod);
-
const FormSchema = z.object({
sys_prompt: z.string(),
description: z.string().optional(),
@@ -70,8 +67,7 @@ const FormSchema = z.object({
delay_after_error: z.coerce.number().optional(),
visual_files_var: z.string().optional(),
max_rounds: z.coerce.number().optional(),
- exception_method: z.string().nullable(),
- exception_comment: z.string().optional(),
+ exception_method: z.string().optional(),
exception_goto: z.array(z.string()).optional(),
exception_default_value: z.string().optional(),
...LargeModelFilterFormSchema,
@@ -87,6 +83,13 @@ function AgentForm({ node }: INextOperatorForm) {
const defaultValues = useValues(node);
+ const ExceptionMethodOptions = Object.values(AgentExceptionMethod).map(
+ (x) => ({
+ label: t(`flow.${x}`),
+ value: x,
+ }),
+ );
+
const isSubAgent = useMemo(() => {
return isBottomSubAgent(edges, node?.id);
}, [edges, node?.id]);
@@ -224,38 +227,29 @@ function AgentForm({ node }: INextOperatorForm) {
Exception method
-
)}
/>
- (
-
- Exception default value
-
-
-
-
- )}
- />
- (
-
- Exception comment
-
-
-
-
- )}
- />
+ {exceptionMethod === AgentExceptionMethod.Comment && (
+ (
+
+ Exception default value
+
+
+
+
+ )}
+ />
+ )}
diff --git a/web/src/pages/agent/form/agent-form/use-values.ts b/web/src/pages/agent/form/agent-form/use-values.ts
index 21addb892..b2d61dc9f 100644
--- a/web/src/pages/agent/form/agent-form/use-values.ts
+++ b/web/src/pages/agent/form/agent-form/use-values.ts
@@ -2,7 +2,7 @@ import { useFetchModelId } from '@/hooks/logic-hooks';
import { RAGFlowNodeType } from '@/interfaces/database/flow';
import { get, isEmpty } from 'lodash';
import { useMemo } from 'react';
-import { AgentExceptionMethod, initialAgentValues } from '../../constant';
+import { initialAgentValues } from '../../constant';
export function useValues(node?: RAGFlowNodeType) {
const llmId = useFetchModelId();
@@ -26,10 +26,6 @@ export function useValues(node?: RAGFlowNodeType) {
return {
...formData,
prompts: get(formData, 'prompts.0.content', ''),
- exception_method:
- formData.exception_method === null
- ? AgentExceptionMethod.Null
- : formData.exception_method,
};
}, [defaultValues, node?.data?.form]);
diff --git a/web/src/pages/agent/form/agent-form/use-watch-change.ts b/web/src/pages/agent/form/agent-form/use-watch-change.ts
index 97c2cb437..98b0ecf31 100644
--- a/web/src/pages/agent/form/agent-form/use-watch-change.ts
+++ b/web/src/pages/agent/form/agent-form/use-watch-change.ts
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
import { UseFormReturn, useWatch } from 'react-hook-form';
-import { AgentExceptionMethod, PromptRole } from '../../constant';
+import { PromptRole } from '../../constant';
import useGraphStore from '../../store';
export function useWatchFormChange(id?: string, form?: UseFormReturn) {
@@ -14,10 +14,6 @@ export function useWatchFormChange(id?: string, form?: UseFormReturn) {
let nextValues: any = {
...values,
prompts: [{ role: PromptRole.User, content: values.prompts }],
- exception_method:
- values.exception_method === AgentExceptionMethod.Null
- ? null
- : values.exception_method,
};
updateNodeForm(id, nextValues);