import { Badge } from "@/components/ui/badge"; import { ProviderIconType, RenderProviderIcon } from "@/lib/constants/icons"; import { getProviderLabel } from "@/lib/constants/logs"; import { RoutingRule } from "@/lib/types/routingRules"; import { Position } from "@xyflow/react"; import { Link2 } from "lucide-react"; import { useState } from "react"; import { RULE_W, SCOPE_CONFIG, type ScopeKey } from "../constants"; import { RFEdgeHandle } from "./rfEdgeHandle"; export function RFRuleNode({ data }: { data: any }) { const rule = data.rule as RoutingRule; const scopeColor = data.scopeColor as string; const cfg = SCOPE_CONFIG[rule.scope as ScopeKey]; const multi = rule.targets.length > 1; const [hovered, setHovered] = useState(false); return (
{rule.name}
{rule.priority > 0 &&Priority {rule.priority}
}{cfg?.label ?? rule.scope}:{" "} {rule.scope_id}
Chain rule — resolved provider/model feeds back as the new input and the full scope chain re-evaluates.
{rule.chain_rule ? "Resolved target (new input)" : "Targets"}
{rule.targets.map((t, i) => { const isPassthrough = !t.provider && !t.model; return ({isPassthrough ? "Passthrough" : t.provider ? getProviderLabel(t.provider) : t.model}
{t.model && t.provider &&{t.model}
} {isPassthrough &&original provider & model
}