mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-02 18:45:29 +08:00
### 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:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user