undefined fix on types
This commit is contained in:
parent
de69b70688
commit
1be12a3c32
3 changed files with 38 additions and 53 deletions
|
|
@ -244,12 +244,6 @@ class VerticesOrderResponse(BaseModel):
|
||||||
run_id: UUID
|
run_id: UUID
|
||||||
vertices_to_run: List[str]
|
vertices_to_run: List[str]
|
||||||
|
|
||||||
|
|
||||||
class Log(TypedDict):
|
|
||||||
message: Union[dict, str]
|
|
||||||
type: str
|
|
||||||
|
|
||||||
|
|
||||||
class ResultDataResponse(BaseModel):
|
class ResultDataResponse(BaseModel):
|
||||||
results: Optional[Any] = Field(default_factory=dict)
|
results: Optional[Any] = Field(default_factory=dict)
|
||||||
logs: List[Log | None] = Field(default_factory=list)
|
logs: List[Log | None] = Field(default_factory=list)
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,9 @@ import useFetchDataOnMount from "../../../hooks/use-fetch-data-on-mount";
|
||||||
import useHandleOnNewValue from "../../../hooks/use-handle-new-value";
|
import useHandleOnNewValue from "../../../hooks/use-handle-new-value";
|
||||||
import useHandleNodeClass from "../../../hooks/use-handle-node-class";
|
import useHandleNodeClass from "../../../hooks/use-handle-node-class";
|
||||||
import useHandleRefreshButtonPress from "../../../hooks/use-handle-refresh-buttons";
|
import useHandleRefreshButtonPress from "../../../hooks/use-handle-refresh-buttons";
|
||||||
|
import OutputModal from "../outputModal";
|
||||||
import TooltipRenderComponent from "../tooltipRenderComponent";
|
import TooltipRenderComponent from "../tooltipRenderComponent";
|
||||||
import { TEXT_FIELD_TYPES } from "./constants";
|
import { TEXT_FIELD_TYPES } from "./constants";
|
||||||
import OutputModal from "../outputModal";
|
|
||||||
|
|
||||||
export default function ParameterComponent({
|
export default function ParameterComponent({
|
||||||
left,
|
left,
|
||||||
|
|
@ -98,7 +98,7 @@ export default function ParameterComponent({
|
||||||
debouncedHandleUpdateValues,
|
debouncedHandleUpdateValues,
|
||||||
setNode,
|
setNode,
|
||||||
renderTooltips,
|
renderTooltips,
|
||||||
setIsLoading,
|
setIsLoading
|
||||||
);
|
);
|
||||||
|
|
||||||
const { handleNodeClass: handleNodeClassHook } = useHandleNodeClass(
|
const { handleNodeClass: handleNodeClassHook } = useHandleNodeClass(
|
||||||
|
|
@ -107,7 +107,7 @@ export default function ParameterComponent({
|
||||||
takeSnapshot,
|
takeSnapshot,
|
||||||
setNode,
|
setNode,
|
||||||
updateNodeInternals,
|
updateNodeInternals,
|
||||||
renderTooltips,
|
renderTooltips
|
||||||
);
|
);
|
||||||
|
|
||||||
const { handleRefreshButtonPress: handleRefreshButtonPressHook } =
|
const { handleRefreshButtonPress: handleRefreshButtonPressHook } =
|
||||||
|
|
@ -116,7 +116,7 @@ export default function ParameterComponent({
|
||||||
let disabled =
|
let disabled =
|
||||||
edges.some(
|
edges.some(
|
||||||
(edge) =>
|
(edge) =>
|
||||||
edge.targetHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id),
|
edge.targetHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id)
|
||||||
) ?? false;
|
) ?? false;
|
||||||
|
|
||||||
const handleRefreshButtonPress = async (name, data) => {
|
const handleRefreshButtonPress = async (name, data) => {
|
||||||
|
|
@ -129,12 +129,12 @@ export default function ParameterComponent({
|
||||||
handleUpdateValues,
|
handleUpdateValues,
|
||||||
setNode,
|
setNode,
|
||||||
renderTooltips,
|
renderTooltips,
|
||||||
setIsLoading,
|
setIsLoading
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleOnNewValue = async (
|
const handleOnNewValue = async (
|
||||||
newValue: string | string[] | boolean | Object[],
|
newValue: string | string[] | boolean | Object[],
|
||||||
skipSnapshot: boolean | undefined = false,
|
skipSnapshot: boolean | undefined = false
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
handleOnNewValueHook(newValue, skipSnapshot);
|
handleOnNewValueHook(newValue, skipSnapshot);
|
||||||
};
|
};
|
||||||
|
|
@ -216,7 +216,7 @@ export default function ParameterComponent({
|
||||||
className={classNames(
|
className={classNames(
|
||||||
left ? "my-12 -ml-0.5 " : " my-12 -mr-0.5 ",
|
left ? "my-12 -ml-0.5 " : " my-12 -mr-0.5 ",
|
||||||
"h-3 w-3 rounded-full border-2 bg-background",
|
"h-3 w-3 rounded-full border-2 bg-background",
|
||||||
!showNode ? "mt-0" : "",
|
!showNode ? "mt-0" : ""
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
borderColor: color ?? nodeColors.unknown,
|
borderColor: color ?? nodeColors.unknown,
|
||||||
|
|
@ -284,7 +284,7 @@ export default function ParameterComponent({
|
||||||
"h-5 w-5 rounded-md",
|
"h-5 w-5 rounded-md",
|
||||||
displayOutputPreview && !unknownOutput
|
displayOutputPreview && !unknownOutput
|
||||||
? " hover:bg-secondary-foreground/5 hover:text-medium-indigo"
|
? " hover:bg-secondary-foreground/5 hover:text-medium-indigo"
|
||||||
: " cursor-not-allowed text-muted-foreground",
|
: " cursor-not-allowed text-muted-foreground"
|
||||||
)}
|
)}
|
||||||
name={"ScanEye"}
|
name={"ScanEye"}
|
||||||
/>
|
/>
|
||||||
|
|
@ -334,7 +334,7 @@ export default function ParameterComponent({
|
||||||
}
|
}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
left ? "-ml-0.5" : "-mr-0.5",
|
left ? "-ml-0.5" : "-mr-0.5",
|
||||||
"h-3 w-3 rounded-full border-2 bg-background",
|
"h-3 w-3 rounded-full border-2 bg-background"
|
||||||
)}
|
)}
|
||||||
style={{ borderColor: color ?? nodeColors.unknown }}
|
style={{ borderColor: color ?? nodeColors.unknown }}
|
||||||
onClick={() => setFilterEdge(groupedEdge.current)}
|
onClick={() => setFilterEdge(groupedEdge.current)}
|
||||||
|
|
|
||||||
|
|
@ -3,33 +3,29 @@ import AccordionComponent from "../../components/accordionComponent";
|
||||||
import IconComponent from "../../components/genericIconComponent";
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
import ShadTooltip from "../../components/shadTooltipComponent";
|
import ShadTooltip from "../../components/shadTooltipComponent";
|
||||||
import { Badge } from "../../components/ui/badge";
|
import { Badge } from "../../components/ui/badge";
|
||||||
|
import { Button } from "../../components/ui/button";
|
||||||
import {
|
import {
|
||||||
Tabs,
|
Tabs,
|
||||||
TabsContent,
|
TabsContent,
|
||||||
TabsList,
|
TabsList,
|
||||||
TabsTrigger,
|
TabsTrigger,
|
||||||
} from "../../components/ui/tabs";
|
} from "../../components/ui/tabs";
|
||||||
import {
|
import { CHAT_FORM_DIALOG_SUBTITLE } from "../../constants/constants";
|
||||||
CHAT_FORM_DIALOG_SUBTITLE,
|
|
||||||
OUTPUTS_MODAL_TITLE,
|
|
||||||
TEXT_INPUT_MODAL_TITLE,
|
|
||||||
} from "../../constants/constants";
|
|
||||||
import { InputOutput } from "../../constants/enums";
|
import { InputOutput } from "../../constants/enums";
|
||||||
|
import { getMessagesTable } from "../../controllers/API";
|
||||||
|
import useAlertStore from "../../stores/alertStore";
|
||||||
import useFlowStore from "../../stores/flowStore";
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
|
import { useMessagesStore } from "../../stores/messagesStore";
|
||||||
import { IOModalPropsType } from "../../types/components";
|
import { IOModalPropsType } from "../../types/components";
|
||||||
import { NodeDataType, NodeType } from "../../types/flow";
|
import { NodeDataType, NodeType } from "../../types/flow";
|
||||||
import { updateVerticesOrder } from "../../utils/buildUtils";
|
import { updateVerticesOrder } from "../../utils/buildUtils";
|
||||||
import { cn } from "../../utils/utils";
|
import { cn } from "../../utils/utils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
import IOFieldView from "./components/IOFieldView";
|
import IOFieldView from "./components/IOFieldView";
|
||||||
import ChatView from "./components/chatView";
|
|
||||||
import { getMessagesTable } from "../../controllers/API";
|
|
||||||
import { useMessagesStore } from "../../stores/messagesStore";
|
|
||||||
import SessionView from "./components/SessionView";
|
import SessionView from "./components/SessionView";
|
||||||
import useRemoveSession from "./components/SessionView/hooks";
|
import useRemoveSession from "./components/SessionView/hooks";
|
||||||
import useAlertStore from "../../stores/alertStore";
|
import ChatView from "./components/chatView";
|
||||||
import { Button } from "../../components/ui/button";
|
|
||||||
|
|
||||||
export default function IOModal({
|
export default function IOModal({
|
||||||
children,
|
children,
|
||||||
|
|
@ -40,25 +36,25 @@ export default function IOModal({
|
||||||
const allNodes = useFlowStore((state) => state.nodes);
|
const allNodes = useFlowStore((state) => state.nodes);
|
||||||
const setMessages = useMessagesStore((state) => state.setMessages);
|
const setMessages = useMessagesStore((state) => state.setMessages);
|
||||||
const inputs = useFlowStore((state) => state.inputs).filter(
|
const inputs = useFlowStore((state) => state.inputs).filter(
|
||||||
(input) => input.type !== "ChatInput",
|
(input) => input.type !== "ChatInput"
|
||||||
);
|
);
|
||||||
const chatInput = useFlowStore((state) => state.inputs).find(
|
const chatInput = useFlowStore((state) => state.inputs).find(
|
||||||
(input) => input.type === "ChatInput",
|
(input) => input.type === "ChatInput"
|
||||||
);
|
);
|
||||||
const outputs = useFlowStore((state) => state.outputs).filter(
|
const outputs = useFlowStore((state) => state.outputs).filter(
|
||||||
(output) => output.type !== "ChatOutput",
|
(output) => output.type !== "ChatOutput"
|
||||||
);
|
);
|
||||||
const chatOutput = useFlowStore((state) => state.outputs).find(
|
const chatOutput = useFlowStore((state) => state.outputs).find(
|
||||||
(output) => output.type === "ChatOutput",
|
(output) => output.type === "ChatOutput"
|
||||||
);
|
);
|
||||||
const nodes = useFlowStore((state) => state.nodes).filter(
|
const nodes = useFlowStore((state) => state.nodes).filter(
|
||||||
(node) =>
|
(node) =>
|
||||||
inputs.some((input) => input.id === node.id) ||
|
inputs.some((input) => input.id === node.id) ||
|
||||||
outputs.some((output) => output.id === node.id),
|
outputs.some((output) => output.id === node.id)
|
||||||
);
|
);
|
||||||
const haveChat = chatInput || chatOutput;
|
const haveChat = chatInput || chatOutput;
|
||||||
const [selectedTab, setSelectedTab] = useState(
|
const [selectedTab, setSelectedTab] = useState(
|
||||||
inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0,
|
inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0
|
||||||
);
|
);
|
||||||
const setErrorData = useAlertStore((state) => state.setErrorData);
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
||||||
|
|
@ -93,12 +89,6 @@ export default function IOModal({
|
||||||
return updateVerticesOrder(currentFlow!.id, null);
|
return updateVerticesOrder(currentFlow!.id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (open) {
|
|
||||||
// updateVertices();
|
|
||||||
// }
|
|
||||||
// }, [open, currentFlow]);
|
|
||||||
|
|
||||||
async function sendMessage({
|
async function sendMessage({
|
||||||
repeat = 1,
|
repeat = 1,
|
||||||
files,
|
files,
|
||||||
|
|
@ -125,6 +115,7 @@ export default function IOModal({
|
||||||
if (chatInput) {
|
if (chatInput) {
|
||||||
setNode(chatInput.id, (node: NodeType) => {
|
setNode(chatInput.id, (node: NodeType) => {
|
||||||
const newNode = { ...node };
|
const newNode = { ...node };
|
||||||
|
|
||||||
newNode.data.node!.template["input_value"].value = chatValue;
|
newNode.data.node!.template["input_value"].value = chatValue;
|
||||||
return newNode;
|
return newNode;
|
||||||
});
|
});
|
||||||
|
|
@ -133,7 +124,7 @@ export default function IOModal({
|
||||||
|
|
||||||
const { handleRemoveSession } = useRemoveSession(
|
const { handleRemoveSession } = useRemoveSession(
|
||||||
setSuccessData,
|
setSuccessData,
|
||||||
setErrorData,
|
setErrorData
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -194,7 +185,7 @@ export default function IOModal({
|
||||||
<div className="flex-max-width h-full">
|
<div className="flex-max-width h-full">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"mr-6 flex h-full w-2/6 flex-shrink-0 flex-col justify-start transition-all duration-300",
|
"mr-6 flex h-full w-2/6 flex-shrink-0 flex-col justify-start transition-all duration-300"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
|
|
@ -221,11 +212,11 @@ export default function IOModal({
|
||||||
<TabsContent value={"1"} className="api-modal-tabs-content">
|
<TabsContent value={"1"} className="api-modal-tabs-content">
|
||||||
{nodes
|
{nodes
|
||||||
.filter((node) =>
|
.filter((node) =>
|
||||||
inputs.some((input) => input.id === node.id),
|
inputs.some((input) => input.id === node.id)
|
||||||
)
|
)
|
||||||
.map((node, index) => {
|
.map((node, index) => {
|
||||||
const input = inputs.find(
|
const input = inputs.find(
|
||||||
(input) => input.id === node.id,
|
(input) => input.id === node.id
|
||||||
)!;
|
)!;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
@ -286,11 +277,11 @@ export default function IOModal({
|
||||||
<TabsContent value={"2"} className="api-modal-tabs-content">
|
<TabsContent value={"2"} className="api-modal-tabs-content">
|
||||||
{nodes
|
{nodes
|
||||||
.filter((node) =>
|
.filter((node) =>
|
||||||
outputs.some((output) => output.id === node.id),
|
outputs.some((output) => output.id === node.id)
|
||||||
)
|
)
|
||||||
.map((node, index) => {
|
.map((node, index) => {
|
||||||
const output = outputs.find(
|
const output = outputs.find(
|
||||||
(output) => output.id === node.id,
|
(output) => output.id === node.id
|
||||||
)!;
|
)!;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
@ -390,7 +381,7 @@ export default function IOModal({
|
||||||
content={
|
content={
|
||||||
flow_sessions.some(
|
flow_sessions.some(
|
||||||
(f_session) =>
|
(f_session) =>
|
||||||
f_session?.session_id === session,
|
f_session?.session_id === session
|
||||||
)
|
)
|
||||||
? "Active Session"
|
? "Active Session"
|
||||||
: "Inactive Session"
|
: "Inactive Session"
|
||||||
|
|
@ -401,10 +392,10 @@ export default function IOModal({
|
||||||
"h-2 w-2 rounded-full",
|
"h-2 w-2 rounded-full",
|
||||||
flow_sessions.some(
|
flow_sessions.some(
|
||||||
(f_session) =>
|
(f_session) =>
|
||||||
f_session?.session_id === session,
|
f_session?.session_id === session
|
||||||
)
|
)
|
||||||
? "bg-status-green"
|
? "bg-status-green"
|
||||||
: "bg-slate-500",
|
: "bg-slate-500"
|
||||||
)}
|
)}
|
||||||
></div>
|
></div>
|
||||||
</ShadTooltip>
|
</ShadTooltip>
|
||||||
|
|
@ -422,7 +413,7 @@ export default function IOModal({
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-full w-full flex-col items-start gap-4 pt-4",
|
"flex h-full w-full flex-col items-start gap-4 pt-4",
|
||||||
!selectedViewField ? "hidden" : "",
|
!selectedViewField ? "hidden" : ""
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="font-xl flex items-center justify-center gap-3 font-semibold">
|
<div className="font-xl flex items-center justify-center gap-3 font-semibold">
|
||||||
|
|
@ -441,7 +432,7 @@ export default function IOModal({
|
||||||
</div>
|
</div>
|
||||||
<div className="h-full w-full">
|
<div className="h-full w-full">
|
||||||
{inputs.some(
|
{inputs.some(
|
||||||
(input) => input.id === selectedViewField.id,
|
(input) => input.id === selectedViewField.id
|
||||||
) && (
|
) && (
|
||||||
<IOFieldView
|
<IOFieldView
|
||||||
type={InputOutput.INPUT}
|
type={InputOutput.INPUT}
|
||||||
|
|
@ -451,7 +442,7 @@ export default function IOModal({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{outputs.some(
|
{outputs.some(
|
||||||
(output) => output.id === selectedViewField.id,
|
(output) => output.id === selectedViewField.id
|
||||||
) && (
|
) && (
|
||||||
<IOFieldView
|
<IOFieldView
|
||||||
type={InputOutput.OUTPUT}
|
type={InputOutput.OUTPUT}
|
||||||
|
|
@ -461,12 +452,12 @@ export default function IOModal({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{sessions.some(
|
{sessions.some(
|
||||||
(session) => session === selectedViewField.id,
|
(session) => session === selectedViewField.id
|
||||||
) && (
|
) && (
|
||||||
<SessionView
|
<SessionView
|
||||||
rows={messages.filter(
|
rows={messages.filter(
|
||||||
(message) =>
|
(message) =>
|
||||||
message.session_id === selectedViewField.id,
|
message.session_id === selectedViewField.id
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
@ -476,7 +467,7 @@ export default function IOModal({
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-full w-full",
|
"flex h-full w-full",
|
||||||
selectedViewField ? "hidden" : "",
|
selectedViewField ? "hidden" : ""
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{haveChat ? (
|
{haveChat ? (
|
||||||
|
|
@ -508,7 +499,7 @@ export default function IOModal({
|
||||||
"h-4 w-4",
|
"h-4 w-4",
|
||||||
isBuilding
|
isBuilding
|
||||||
? "animate-spin"
|
? "animate-spin"
|
||||||
: "fill-current text-medium-indigo",
|
: "fill-current text-medium-indigo"
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue