Feat: Add configuration for webhook to the begin node. #10427 (#11875)

### What problem does this PR solve?

Feat: Add configuration for webhook to the begin node. #10427

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-12-10 19:13:57 +08:00
committed by GitHub
parent badf33e3b9
commit 34d29d7e8b
25 changed files with 1097 additions and 117 deletions

View File

@ -1,32 +1,14 @@
import i18n from '@/locales/config';
import { BeginId } from '@/pages/agent/constant';
import { ReactNode } from 'react';
const prefix = BeginId + '@';
interface VariableDisplayProps {
content: string;
getLabel?: (value?: string) => string | ReactNode;
}
// This component mimics the VariableNode's decorate function from PromptEditor
function VariableNodeDisplay({
value,
label,
}: {
value: string;
label: ReactNode;
}) {
function VariableNodeDisplay({ label }: { label: ReactNode }) {
let content: ReactNode = <span className="text-accent-primary">{label}</span>;
if (value.startsWith(prefix)) {
content = (
<div>
<span>{i18n.t(`flow.begin`)}</span> / {content}
</div>
);
}
return <div className="inline-flex items-center mr-1">{content}</div>;
}
@ -63,11 +45,7 @@ export function VariableDisplay({ content, getLabel }: VariableDisplayProps) {
if (label && label !== variableValue) {
// If we found a valid label, render as variable node
elements.push(
<VariableNodeDisplay
key={`variable-${index}`}
value={variableValue}
label={label}
/>,
<VariableNodeDisplay key={`variable-${index}`} label={label} />,
);
} else {
// If no label found, keep as original text