add warning to components with old codes
This commit is contained in:
parent
f4ddc60d2a
commit
07de1d6674
4 changed files with 20 additions and 1 deletions
|
|
@ -47,7 +47,7 @@ export default function NoticeAlert({
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-3 flex-1 md:flex md:justify-between">
|
<div className="ml-3 flex-1 md:flex md:justify-between">
|
||||||
<p className="line-clamp-2 text-sm text-info-foreground word-break-break-word">
|
<p className="text-sm text-info-foreground word-break-break-word">
|
||||||
{title}
|
{title}
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-3 text-sm md:ml-6 md:mt-0">
|
<p className="mt-3 text-sm md:ml-6 md:mt-0">
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import { useTypesStore } from "../../../../stores/typesStore";
|
||||||
import { APIClassType } from "../../../../types/api";
|
import { APIClassType } from "../../../../types/api";
|
||||||
import { FlowType, NodeType } from "../../../../types/flow";
|
import { FlowType, NodeType } from "../../../../types/flow";
|
||||||
import {
|
import {
|
||||||
|
checkOldComponents,
|
||||||
generateFlow,
|
generateFlow,
|
||||||
generateNodeFromFlow,
|
generateNodeFromFlow,
|
||||||
getNodeId,
|
getNodeId,
|
||||||
|
|
@ -97,6 +98,7 @@ export default function Page({
|
||||||
const onConnect = useFlowStore((state) => state.onConnect);
|
const onConnect = useFlowStore((state) => state.onConnect);
|
||||||
const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
|
const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
|
||||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
|
const setNoticeData = useAlertStore((state) => state.setNoticeData);
|
||||||
const [selectionMenuVisible, setSelectionMenuVisible] = useState(false);
|
const [selectionMenuVisible, setSelectionMenuVisible] = useState(false);
|
||||||
const edgeUpdateSuccessful = useRef(true);
|
const edgeUpdateSuccessful = useRef(true);
|
||||||
|
|
||||||
|
|
@ -170,6 +172,12 @@ export default function Page({
|
||||||
}
|
}
|
||||||
}, [currentFlowId, reactFlowInstance]);
|
}, [currentFlowId, reactFlowInstance]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(checkOldComponents({nodes:flow?.data?.nodes ?? []})){
|
||||||
|
setNoticeData({title:"Components created before Langflow 1.0 may be unstable. Ensure components are up to date."})
|
||||||
|
}
|
||||||
|
},[])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
cleanFlow();
|
cleanFlow();
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import { FlowStoreType, VertexLayerElementType } from "../types/zustand/flow";
|
||||||
import { buildVertices } from "../utils/buildUtils";
|
import { buildVertices } from "../utils/buildUtils";
|
||||||
import {
|
import {
|
||||||
checkChatInput,
|
checkChatInput,
|
||||||
|
checkOldComponents,
|
||||||
cleanEdges,
|
cleanEdges,
|
||||||
getHandleId,
|
getHandleId,
|
||||||
getNodeId,
|
getNodeId,
|
||||||
|
|
@ -240,6 +241,11 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(selection.nodes){
|
||||||
|
if(checkOldComponents({nodes:selection.nodes ?? []})){
|
||||||
|
useAlertStore.getState().setNoticeData({title:"Components created before Langflow 1.0 may be unstable. Ensure components are up to date."})
|
||||||
|
}
|
||||||
|
}
|
||||||
let minimumX = Infinity;
|
let minimumX = Infinity;
|
||||||
let minimumY = Infinity;
|
let minimumY = Infinity;
|
||||||
let idsMap = {};
|
let idsMap = {};
|
||||||
|
|
|
||||||
|
|
@ -1511,3 +1511,8 @@ export function getGroupOutputNodeId(
|
||||||
}
|
}
|
||||||
return { id: node.id, outputName: p_name };
|
return { id: node.id, outputName: p_name };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function checkOldComponents({nodes}:{nodes:any[]}) {
|
||||||
|
return nodes.some((node) => node.data.node?.template.code && (node.data.node?.template.code.value as string).includes("(CustomComponent):"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue