Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feat: Fixed the issue where the newly created agent begin node displayed "undefined". #10427 (#12348)

balibabua07e947644a8
diff --git a/web/src/constants/agent.tsx b/web/src/constants/agent.tsx
index de712040c7..631f52ec22 100644
--- a/web/src/constants/agent.tsx
+++ b/web/src/constants/agent.tsx
@@ -211,3 +211,14 @@ export const WebhookJWTAlgorithmList = [
'ps512',
'none',
] as const;
+
+export enum AgentDialogueMode {
+ Conversational = 'conversational',
+ Task = 'task',
+ Webhook = 'Webhook',
+}
+
+export const initialBeginValues = {
+ mode: AgentDialogueMode.Conversational,
+ prologue: `Hi! I'm your assistant. What can I do for you?`,
+};
diff --git a/web/src/hooks/use-agent-request.ts b/web/src/hooks/use-agent-request.ts
index 06400d11bf..810cf40733 100644
--- a/web/src/hooks/use-agent-request.ts
+++ b/web/src/hooks/use-agent-request.ts
@@ -1,7 +1,7 @@
import { FileUploadProps } from '@/components/file-upload';
import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit';
import message from '@/components/ui/message';
-import { AgentGlobals } from '@/constants/agent';
+import { AgentGlobals, initialBeginValues } from '@/constants/agent';
import {
IAgentLogsRequest,
IAgentLogsResponse,
@@ -76,6 +76,7 @@ export const EmptyDsl = {
data: {
label: 'Begin',
name: 'begin',
+ form: initialBeginValues,
},
sourcePosition: 'left',
targetPosition: 'right',
diff --git a/web/src/pages/agent/canvas/node/begin-node.tsx b/web/src/pages/agent/canvas/node/begin-node.tsx
index 00eb415138..9a08975fc2 100644
--- a/web/src/pages/agent/canvas/node/begin-node.tsx
+++ b/web/src/pages/agent/canvas/node/begin-node.tsx
@@ -13,6 +13,7 @@ import {
} from '../../constant';
import { BeginFormSchemaType } from '../../form/begin-form/schema';
import { useBuildWebhookUrl } from '../../hooks/use-build-webhook-url';
+import { useIsPipeline } from '../../hooks/use-is-pipeline';
import OperatorIcon from '../../operator-icon';
import { LabelCard } from './card';
import { CommonHandle } from './handle';
@@ -34,6 +35,8 @@ function InnerBeginNode({
const url = useBuildWebhookUrl();
+ const isPipeline = useIsPipeline();
+
return (
<NodeWrapper selected={selected} id={id}>
<CommonHandle
@@ -45,15 +48,17 @@ function InnerBeginNode({
id={NodeHandleId.Start}
></CommonHandle>
- <section className="flex items-center gap-2">
+ <section className="flex items-center gap-2">
<OperatorIcon name={data.label as Operator}></OperatorIcon>
<div className="truncate text-center font-semibold text-sm">
{t(`flow.begin`)}
</div>
</section>
- <div className="text-accent-primary mt-2 p-1 bg-bg-accent w-fit rounded-sm text-xs">
- {t(`flow.${isWebhookMode ? 'webhook.name' : mode}`)}
- </div>
+ {isPipeline || (
+ <div className="text-accent-primary mt-2 p-1 bg-bg-accent w-fit rounded-sm text-xs">
+ {t(`flow.${isWebhookMode ? 'webhook.name' : mode}`)}
+ </div>
+ )}
{isWebhookMode ? (
<LabelCard className="mt-2 flex gap-1 items-center">
<span className="font-bold">URL</span>
diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx
index 5f840d0d0d..845450ab3e 100644
--- a/web/src/pages/agent/constant/index.tsx
+++ b/web/src/pages/agent/constant/index.tsx
@@ -15,19 +15,15 @@ import {
initialLlmBaseValues,
} from '@/constants/agent';
export {
+ AgentDialogueMode,
AgentStructuredOutputField,
JsonSchemaDataType,
Operator,
+ initialBeginValues,
} from '@/constants/agent';
export * from './pipeline';
-export enum AgentDialogueMode {
- Conversational = 'conversational',
- Task = 'task',
- Webhook = 'Webhook',
-}
-
import { ModelVariableType } from '@/constants/knowledge';
import { t } from 'i18next';
@@ -109,11 +105,6 @@ export const initialRetrievalValues = {
},
};
-export const initialBeginValues = {
- mode: AgentDialogueMode.Conversational,
- prologue: `Hi! I'm your assistant. What can I do for you?`,
-};
-
export const initialRewriteQuestionValues = {
...initialLlmBaseValues,
language: '',
@@ -750,6 +741,8 @@ export const NodeMap = {
[Operator.Loop]: 'loopNode',
[Operator.LoopStart]: 'loopStartNode',
[Operator.ExitLoop]: 'exitLoopNode',
+ [Operator.ExcelProcessor]: 'ragNode',
+ [Operator.PDFGenerator]: 'ragNode',
};
export enum BeginQueryType {
diff --git a/web/src/pages/agent/hooks/use-add-node.ts b/web/src/pages/agent/hooks/use-add-node.ts
index 43db495ee5..53f99e51ca 100644
--- a/web/src/pages/agent/hooks/use-add-node.ts
+++ b/web/src/pages/agent/hooks/use-add-node.ts
@@ -179,6 +179,8 @@ export const useInitializeOperatorParams = () => {
[Operator.Loop]: initialLoopValues,
[Operator.LoopStart]: {},
[Operator.ExitLoop]: {},
+ [Operator.PDFGenerator]: {},
+ [Operator.ExcelProcessor]: {},
};
}, [llmId]);