Merge branch 'zustand/io/migration' into better_io
This commit is contained in:
commit
fa4f201925
4 changed files with 71 additions and 45 deletions
|
|
@ -304,7 +304,7 @@ export default function ParameterComponent({
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={
|
className={
|
||||||
"relative mt-1 flex w-full flex-wrap items-center justify-between bg-muted px-5 py-2" +
|
"relative mt-1 flex w-full flex-wrap items-center justify-between bg-muted px-5 py-2" +
|
||||||
(name.includes("code") && type==="code" ? " hidden " : "")
|
((name==="code" && type==="code") || (name.includes("code") && proxy) ? " hidden " : "")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -141,8 +141,7 @@ export default function GenericNode({
|
||||||
const iconColor = nodeColors[types[data.type]];
|
const iconColor = nodeColors[types[data.type]];
|
||||||
const iconName =
|
const iconName =
|
||||||
iconElement || (data.node?.flow ? "group_components" : name);
|
iconElement || (data.node?.flow ? "group_components" : name);
|
||||||
const iconClassName = `generic-node-icon ${
|
const iconClassName = `generic-node-icon ${!showNode ? " absolute inset-x-6 h-12 w-12 " : ""
|
||||||
!showNode ? " absolute inset-x-6 h-12 w-12 " : ""
|
|
||||||
}`;
|
}`;
|
||||||
if (iconElement && isEmoji) {
|
if (iconElement && isEmoji) {
|
||||||
return nodeIconFragment(iconElement);
|
return nodeIconFragment(iconElement);
|
||||||
|
|
@ -393,12 +392,27 @@ export default function GenericNode({
|
||||||
})}
|
})}
|
||||||
data={data}
|
data={data}
|
||||||
color={
|
color={
|
||||||
nodeColors[
|
data.node?.template[templateField].input_types &&
|
||||||
types[data.node?.template[templateField].type!]
|
data.node?.template[templateField].input_types!
|
||||||
|
.length > 0
|
||||||
|
? nodeColors[
|
||||||
|
data.node?.template[templateField]
|
||||||
|
.input_types![data.node?.template[templateField]
|
||||||
|
.input_types!.length - 1]
|
||||||
] ??
|
] ??
|
||||||
nodeColors[
|
nodeColors[
|
||||||
|
types[
|
||||||
|
data.node?.template[templateField]
|
||||||
|
.input_types![data.node?.template[templateField]
|
||||||
|
.input_types!.length - 1]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
: nodeColors[
|
||||||
data.node?.template[templateField].type!
|
data.node?.template[templateField].type!
|
||||||
] ??
|
] ??
|
||||||
|
nodeColors[
|
||||||
|
types[data.node?.template[templateField].type!]
|
||||||
|
] ??
|
||||||
nodeColors.unknown
|
nodeColors.unknown
|
||||||
}
|
}
|
||||||
title={getFieldTitle(
|
title={getFieldTitle(
|
||||||
|
|
@ -464,12 +478,6 @@ export default function GenericNode({
|
||||||
<Button
|
<Button
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
className={"group h-9 px-1.5"}
|
className={"group h-9 px-1.5"}
|
||||||
onClick={() => {
|
|
||||||
if (buildStatus === BuildStatus.BUILDING || isBuilding)
|
|
||||||
return;
|
|
||||||
setValidationStatus(null);
|
|
||||||
buildFlow({ nodeId: data.id });
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
|
|
@ -492,7 +500,12 @@ export default function GenericNode({
|
||||||
}
|
}
|
||||||
side="bottom"
|
side="bottom"
|
||||||
>
|
>
|
||||||
<div className="generic-node-status-position flex items-center justify-center">
|
<div onClick={() => {
|
||||||
|
if (buildStatus === BuildStatus.BUILDING || isBuilding)
|
||||||
|
return;
|
||||||
|
setValidationStatus(null);
|
||||||
|
buildFlow({ nodeId: data.id });
|
||||||
|
}} className="generic-node-status-position flex items-center justify-center">
|
||||||
{renderIconStatus(buildStatus, validationStatus)}
|
{renderIconStatus(buildStatus, validationStatus)}
|
||||||
</div>
|
</div>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
|
|
@ -611,12 +624,14 @@ export default function GenericNode({
|
||||||
.length > 0
|
.length > 0
|
||||||
? nodeColors[
|
? nodeColors[
|
||||||
data.node?.template[templateField]
|
data.node?.template[templateField]
|
||||||
.input_types![0]
|
.input_types![data.node?.template[templateField]
|
||||||
|
.input_types!.length - 1]
|
||||||
] ??
|
] ??
|
||||||
nodeColors[
|
nodeColors[
|
||||||
types[
|
types[
|
||||||
data.node?.template[templateField]
|
data.node?.template[templateField]
|
||||||
.input_types![0]
|
.input_types![data.node?.template[templateField]
|
||||||
|
.input_types!.length - 1]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
: nodeColors[
|
: nodeColors[
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import NewChatView from "../newChatView";
|
||||||
import { Badge } from "../ui/badge";
|
import { Badge } from "../ui/badge";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs";
|
||||||
|
import { NodeType } from "../../types/flow";
|
||||||
|
|
||||||
export default function IOView({ children, open, setOpen }): JSX.Element {
|
export default function IOView({ children, open, setOpen }): JSX.Element {
|
||||||
const inputs = useFlowStore((state) => state.inputs).filter(
|
const inputs = useFlowStore((state) => state.inputs).filter(
|
||||||
|
|
@ -51,6 +52,7 @@ export default function IOView({ children, open, setOpen }): JSX.Element {
|
||||||
const [chatValue, setChatValue] = useState("");
|
const [chatValue, setChatValue] = useState("");
|
||||||
const isBuilding = useFlowStore((state) => state.isBuilding);
|
const isBuilding = useFlowStore((state) => state.isBuilding);
|
||||||
const currentFlow = useFlowsManagerStore((state) => state.currentFlow);
|
const currentFlow = useFlowsManagerStore((state) => state.currentFlow);
|
||||||
|
const setNode = useFlowStore((state) => state.setNode);
|
||||||
|
|
||||||
async function updateVertices() {
|
async function updateVertices() {
|
||||||
return updateVerticesOrder(currentFlow!.id, null);
|
return updateVerticesOrder(currentFlow!.id, null);
|
||||||
|
|
@ -74,6 +76,14 @@ export default function IOView({ children, open, setOpen }): JSX.Element {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setLockChat(false);
|
setLockChat(false);
|
||||||
|
if(chatInput) {
|
||||||
|
setNode(chatInput.id, (node:NodeType)=>{
|
||||||
|
|
||||||
|
const newNode = {...node}
|
||||||
|
newNode.data.node!.template["input_value"].value = chatValue;
|
||||||
|
return newNode;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,8 @@ const EditNodeModal = forwardRef(
|
||||||
)
|
)
|
||||||
) ?? false;
|
) ?? false;
|
||||||
return (
|
return (
|
||||||
<TableRow key={index} className="h-10">
|
<TableRow key={index} className={"h-10 " + ((templateParam==="code" && myData.node?.template[templateParam].type==="code") || (templateParam.includes("code") && myData.node?.template[templateParam].proxy) ? " hidden " : "")
|
||||||
|
}>
|
||||||
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
<TableCell className="truncate p-0 text-center text-sm text-foreground sm:px-3">
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
content={
|
content={
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue