format: run make format
This commit is contained in:
parent
08f04d11d0
commit
c7cbb40c36
14 changed files with 88 additions and 77 deletions
|
|
@ -35,7 +35,9 @@ export const CardComponent = ({
|
||||||
gradients[parseInt(flow.id.slice(0, 12), 16) % gradients.length]
|
gradients[parseInt(flow.id.slice(0, 12), 16) % gradients.length]
|
||||||
}
|
}
|
||||||
></span>
|
></span>
|
||||||
<span className="flex-1 w-full inline-block truncate-doubleline break-words">{flow.name}</span>
|
<span className="flex-1 w-full inline-block truncate-doubleline break-words">
|
||||||
|
{flow.name}
|
||||||
|
</span>
|
||||||
{onDelete && (
|
{onDelete && (
|
||||||
<button className="flex self-start" onClick={onDelete}>
|
<button className="flex self-start" onClick={onDelete}>
|
||||||
<Trash2 className="w-4 h-4 text-primary opacity-0 group-hover:opacity-100 transition-all" />
|
<Trash2 className="w-4 h-4 text-primary opacity-0 group-hover:opacity-100 transition-all" />
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ export default function BuildTrigger({
|
||||||
setIsBuilt: any;
|
setIsBuilt: any;
|
||||||
isBuilt: boolean;
|
isBuilt: boolean;
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const { updateSSEData, isBuilding, setIsBuilding } = useSSE();
|
const { updateSSEData, isBuilding, setIsBuilding } = useSSE();
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
const { setErrorData } = useContext(alertContext);
|
const { setErrorData } = useContext(alertContext);
|
||||||
|
|
@ -48,7 +47,9 @@ export default function BuildTrigger({
|
||||||
if (!allNodesValid) {
|
if (!allNodesValid) {
|
||||||
setErrorData({
|
setErrorData({
|
||||||
title: "Oops! Looks like you missed something",
|
title: "Oops! Looks like you missed something",
|
||||||
list: ["Check components and retry. Hover over component status icon 🔴 to inspect."],
|
list: [
|
||||||
|
"Check components and retry. Hover over component status icon 🔴 to inspect.",
|
||||||
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ export default function ChatTrigger({ open, setOpen, isBuilt }) {
|
||||||
leaveFrom="translate-y-0"
|
leaveFrom="translate-y-0"
|
||||||
leaveTo="translate-y-96"
|
leaveTo="translate-y-96"
|
||||||
>
|
>
|
||||||
|
|
||||||
<div className="absolute bottom-4 right-3">
|
<div className="absolute bottom-4 right-3">
|
||||||
<div
|
<div
|
||||||
className="flex justify-center align-center py-1 px-3 w-12 h-12 rounded-full shadow-md shadow-[#0000002a] hover:shadow-[#00000032]
|
className="flex justify-center align-center py-1 px-3 w-12 h-12 rounded-full shadow-md shadow-[#0000002a] hover:shadow-[#00000032]
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ export default function Chat({ flow }: ChatType) {
|
||||||
const handleKeyDown = (event: KeyboardEvent) => {
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
if (
|
if (
|
||||||
(event.key === "K" || event.key === "k") &&
|
(event.key === "K" || event.key === "k") &&
|
||||||
(event.metaKey || event.ctrlKey) && isBuilt
|
(event.metaKey || event.ctrlKey) &&
|
||||||
|
isBuilt
|
||||||
) {
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setOpen((oldState) => !oldState);
|
setOpen((oldState) => !oldState);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
"use client"
|
"use client";
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from "react";
|
||||||
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
||||||
import { cn } from "../../utils"
|
import { cn } from "../../utils";
|
||||||
|
|
||||||
const Tabs = TabsPrimitive.Root
|
const Tabs = TabsPrimitive.Root;
|
||||||
|
|
||||||
const TabsList = React.forwardRef<
|
const TabsList = React.forwardRef<
|
||||||
React.ElementRef<typeof TabsPrimitive.List>,
|
React.ElementRef<typeof TabsPrimitive.List>,
|
||||||
|
|
@ -18,8 +18,8 @@ const TabsList = React.forwardRef<
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
))
|
));
|
||||||
TabsList.displayName = TabsPrimitive.List.displayName
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
||||||
|
|
||||||
const TabsTrigger = React.forwardRef<
|
const TabsTrigger = React.forwardRef<
|
||||||
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
||||||
|
|
@ -33,8 +33,8 @@ const TabsTrigger = React.forwardRef<
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
))
|
));
|
||||||
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
||||||
|
|
||||||
const TabsContent = React.forwardRef<
|
const TabsContent = React.forwardRef<
|
||||||
React.ElementRef<typeof TabsPrimitive.Content>,
|
React.ElementRef<typeof TabsPrimitive.Content>,
|
||||||
|
|
@ -48,7 +48,7 @@ const TabsContent = React.forwardRef<
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
))
|
));
|
||||||
TabsContent.displayName = TabsPrimitive.Content.displayName
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
||||||
|
|
||||||
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ export function SSEProvider({ children }) {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SSEContext.Provider value={{ sseData, updateSSEData,isBuilding,setIsBuilding }}>
|
<SSEContext.Provider
|
||||||
|
value={{ sseData, updateSSEData, isBuilding, setIsBuilding }}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</SSEContext.Provider>
|
</SSEContext.Provider>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,18 @@ export function TypesProvider({ children }: { children: ReactNode }) {
|
||||||
// Set the types by reducing over the keys of the result data and updating the accumulator.
|
// Set the types by reducing over the keys of the result data and updating the accumulator.
|
||||||
setTypes(
|
setTypes(
|
||||||
// Reverse the keys so the tool world does not overlap
|
// Reverse the keys so the tool world does not overlap
|
||||||
Object.keys(result.data).reverse().reduce((acc, curr) => {
|
Object.keys(result.data)
|
||||||
Object.keys(result.data[curr]).forEach((c: keyof APIKindType) => {
|
.reverse()
|
||||||
|
.reduce((acc, curr) => {
|
||||||
|
Object.keys(result.data[curr]).forEach(
|
||||||
|
(c: keyof APIKindType) => {
|
||||||
acc[c] = curr;
|
acc[c] = curr;
|
||||||
// Add the base classes to the accumulator as well.
|
// Add the base classes to the accumulator as well.
|
||||||
result.data[curr][c].base_classes?.forEach((b) => {
|
result.data[curr][c].base_classes?.forEach((b) => {
|
||||||
acc[b] = curr;
|
acc[b] = curr;
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
);
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { validateNodes } from "../../utils";
|
||||||
import { typesContext } from "../../contexts/typesContext";
|
import { typesContext } from "../../contexts/typesContext";
|
||||||
import ChatMessage from "./chatMessage";
|
import ChatMessage from "./chatMessage";
|
||||||
import { Eraser } from "lucide-react";
|
import { Eraser } from "lucide-react";
|
||||||
import {X} from "lucide-react"
|
import { X } from "lucide-react";
|
||||||
import { sendAllProps } from "../../types/api";
|
import { sendAllProps } from "../../types/api";
|
||||||
import { ChatMessageType } from "../../types/chat";
|
import { ChatMessageType } from "../../types/chat";
|
||||||
import ChatInput from "./chatInput";
|
import ChatInput from "./chatInput";
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ export default function FlowSettingsModal() {
|
||||||
const { closePopUp } = useContext(PopUpContext);
|
const { closePopUp } = useContext(PopUpContext);
|
||||||
const { setErrorData, setSuccessData } = useContext(alertContext);
|
const { setErrorData, setSuccessData } = useContext(alertContext);
|
||||||
const ref = useRef();
|
const ref = useRef();
|
||||||
const { flows, tabId, updateFlow, setTabsState, saveFlow } = useContext(TabsContext);
|
const { flows, tabId, updateFlow, setTabsState, saveFlow } =
|
||||||
|
useContext(TabsContext);
|
||||||
const maxLength = 50;
|
const maxLength = 50;
|
||||||
const [name, setName] = useState(flows.find((f) => f.id === tabId).name);
|
const [name, setName] = useState(flows.find((f) => f.id === tabId).name);
|
||||||
const [description, setDescription] = useState(
|
const [description, setDescription] = useState(
|
||||||
|
|
@ -37,7 +38,7 @@ export default function FlowSettingsModal() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handleClick() {
|
function handleClick() {
|
||||||
let savedFlow = flows.find((f) => f.id === tabId)
|
let savedFlow = flows.find((f) => f.id === tabId);
|
||||||
savedFlow.name = name;
|
savedFlow.name = name;
|
||||||
savedFlow.description = description;
|
savedFlow.description = description;
|
||||||
saveFlow(savedFlow);
|
saveFlow(savedFlow);
|
||||||
|
|
@ -67,10 +68,7 @@ export default function FlowSettingsModal() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button
|
<Button onClick={handleClick} type="submit">
|
||||||
onClick={handleClick}
|
|
||||||
type="submit"
|
|
||||||
>
|
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,11 @@ export default function CommunityPage() {
|
||||||
Community Examples
|
Community Examples
|
||||||
</span>
|
</span>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<a href="https://github.com/logspace-ai/langflow_examples" target="_blank" rel="noreferrer">
|
<a
|
||||||
|
href="https://github.com/logspace-ai/langflow_examples"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
<Button variant="primary">
|
<Button variant="primary">
|
||||||
<GithubIcon className="w-4 mr-2" />
|
<GithubIcon className="w-4 mr-2" />
|
||||||
Add Your Example
|
Add Your Example
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export default function Page({ flow }: { flow: FlowType }) {
|
||||||
tabsState,
|
tabsState,
|
||||||
saveFlow,
|
saveFlow,
|
||||||
setTabsState,
|
setTabsState,
|
||||||
tabId
|
tabId,
|
||||||
} = useContext(TabsContext);
|
} = useContext(TabsContext);
|
||||||
const { types, reactFlowInstance, setReactFlowInstance, templates } =
|
const { types, reactFlowInstance, setReactFlowInstance, templates } =
|
||||||
useContext(typesContext);
|
useContext(typesContext);
|
||||||
|
|
@ -281,10 +281,10 @@ export default function Page({ flow }: { flow: FlowType }) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
if (tabsState && tabsState[flow.id]?.isPending) {
|
if (tabsState && tabsState[flow.id]?.isPending) {
|
||||||
saveFlow(flow)
|
saveFlow(flow);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
},[])
|
}, []);
|
||||||
|
|
||||||
const onDelete = useCallback(
|
const onDelete = useCallback(
|
||||||
(mynodes) => {
|
(mynodes) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue