Merge branch 'dev' of https://github.com/logspace-ai/langflow into dev
This commit is contained in:
commit
13fae3875b
6 changed files with 40 additions and 9 deletions
|
|
@ -52,7 +52,7 @@ const TabsContextInitialValue: TabsContextType = {
|
|||
isBuilt: false,
|
||||
setIsBuilt: (state: boolean) => {},
|
||||
hardReset: () => {},
|
||||
saveFlow: async (flow: FlowType) => {},
|
||||
saveFlow: async (flow: FlowType, silent?: boolean) => {},
|
||||
lastCopiedSelection: null,
|
||||
setLastCopiedSelection: (selection: any) => {},
|
||||
tabsState: {},
|
||||
|
|
@ -588,13 +588,15 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
});
|
||||
}
|
||||
|
||||
async function saveFlow(newFlow: FlowType) {
|
||||
async function saveFlow(newFlow: FlowType, silent?: boolean) {
|
||||
try {
|
||||
// updates flow in db
|
||||
const updatedFlow = await updateFlowInDatabase(newFlow);
|
||||
if (updatedFlow) {
|
||||
// updates flow in state
|
||||
setSuccessData({ title: "Changes saved successfully" });
|
||||
if (!silent) {
|
||||
setSuccessData({ title: "Changes saved successfully" });
|
||||
}
|
||||
setFlows((prevState) => {
|
||||
const newFlows = [...prevState];
|
||||
const index = newFlows.findIndex((flow) => flow.id === newFlow.id);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ interface BaseModalProps {
|
|||
| "medium-h-full";
|
||||
|
||||
disable?: boolean;
|
||||
onChangeOpenModal?: (open: boolean) => void;
|
||||
onChangeOpenModal?: (open?: boolean) => void;
|
||||
}
|
||||
function BaseModal({
|
||||
open,
|
||||
|
|
|
|||
|
|
@ -160,6 +160,27 @@ export default function Page({
|
|||
setExtraNavigation({ title: "Components" });
|
||||
}, [setExtraComponent, setExtraNavigation]);
|
||||
|
||||
const [seconds, setSeconds] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setSeconds((prevSeconds) => {
|
||||
let updatedSeconds = prevSeconds + 1;
|
||||
|
||||
if (updatedSeconds % 30 === 0) {
|
||||
saveFlow(flow, true);
|
||||
updatedSeconds = 0;
|
||||
}
|
||||
|
||||
return updatedSeconds;
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const onEdgesChangeMod = useCallback(
|
||||
(change: EdgeChange[]) => {
|
||||
onEdgesChange(change);
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ export default function NodeToolbarComponent({
|
|||
setShowNode((prev) => !prev);
|
||||
updateNodeInternals(data.id);
|
||||
}
|
||||
if(event.includes("disabled")){
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -153,8 +156,8 @@ export default function NodeToolbarComponent({
|
|||
</SelectTrigger>
|
||||
</ShadTooltip>
|
||||
<SelectContent>
|
||||
<SelectItem value={getRandomKeyByssmm() + "advanced"}>
|
||||
<div className="flex">
|
||||
<SelectItem value={getRandomKeyByssmm() + (nodeLength==0?"disabled":"advanced")}>
|
||||
<div className={"flex "+(nodeLength==0?"text-muted-foreground":"text-primary")}>
|
||||
<IconComponent
|
||||
name="Settings2"
|
||||
className="relative top-0.5 mr-2 h-4 w-4"
|
||||
|
|
@ -179,6 +182,7 @@ export default function NodeToolbarComponent({
|
|||
<ShadTooltip content="Edit" side="top">
|
||||
<div>
|
||||
<button
|
||||
disabled={nodeLength === 0}
|
||||
onClick={() => setShowModalAdvanced(true)}
|
||||
className={classNames(
|
||||
"relative -ml-px inline-flex items-center rounded-r-md bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10" +
|
||||
|
|
|
|||
|
|
@ -41,12 +41,16 @@ export default function HomePage(): JSX.Element {
|
|||
|
||||
const dragOver = (e) => {
|
||||
e.preventDefault();
|
||||
setIsDragging(true);
|
||||
if(e.dataTransfer.types.some((types) => types === "Files")){
|
||||
setIsDragging(true);
|
||||
}
|
||||
};
|
||||
|
||||
const dragEnter = (e) => {
|
||||
if(e.dataTransfer.types.some((types) => types === "Files")){
|
||||
setIsDragging(true);
|
||||
}
|
||||
e.preventDefault();
|
||||
setIsDragging(true);
|
||||
};
|
||||
|
||||
const dragLeave = () => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { tweakType } from "../components";
|
|||
import { FlowType } from "../flow";
|
||||
|
||||
export type TabsContextType = {
|
||||
saveFlow: (flow: FlowType) => Promise<void>;
|
||||
saveFlow: (flow: FlowType, silent?: boolean) => Promise<void>;
|
||||
save: () => void;
|
||||
tabId: string;
|
||||
isLoading: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue