🔨 refactor(formModal): remove unused keysValue state variable to improve code cleanliness and readability
🔨 refactor(formModal): update formKeysData type in tabsState to include handle_keys array for better data structure consistency and completeness
This commit is contained in:
parent
fce7b398f7
commit
ffebce974f
2 changed files with 9 additions and 8 deletions
|
|
@ -41,7 +41,6 @@ export default function FormModal({
|
||||||
flow: FlowType;
|
flow: FlowType;
|
||||||
}) {
|
}) {
|
||||||
const [chatValue, setChatValue] = useState("");
|
const [chatValue, setChatValue] = useState("");
|
||||||
const [keysValue, setKeysValue] = useState([]);
|
|
||||||
const [chatHistory, setChatHistory] = useState<ChatMessageType[]>([]);
|
const [chatHistory, setChatHistory] = useState<ChatMessageType[]>([]);
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
const { setErrorData, setNoticeData } = useContext(alertContext);
|
const { setErrorData, setNoticeData } = useContext(alertContext);
|
||||||
|
|
@ -64,12 +63,6 @@ export default function FormModal({
|
||||||
}, [open]);
|
}, [open]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
id.current = flow.id;
|
id.current = flow.id;
|
||||||
|
|
||||||
if (tabsState[flow.id].formKeysData) {
|
|
||||||
setKeysValue(
|
|
||||||
Array(tabsState[flow.id].formKeysData.input_keys.length).fill("")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, [flow.id, tabsState[flow.id], tabsState[flow.id].formKeysData]);
|
}, [flow.id, tabsState[flow.id], tabsState[flow.id].formKeysData]);
|
||||||
|
|
||||||
var isStream = false;
|
var isStream = false;
|
||||||
|
|
@ -438,6 +431,14 @@ export default function FormModal({
|
||||||
</div>
|
</div>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
))}
|
))}
|
||||||
|
{tabsState[id.current].formKeysData.handle_keys.map((i, k) => (
|
||||||
|
<AccordionItem key={k} value={i}>
|
||||||
|
<div className="flex flex-1 items-center justify-between py-4 font-normal transition-all group text-muted-foreground text-sm">
|
||||||
|
<div className="group-hover:underline"><Badge size="md" variant="gray">{i}</Badge></div>
|
||||||
|
Value coming from Handle
|
||||||
|
</div>
|
||||||
|
</AccordionItem>
|
||||||
|
))}
|
||||||
</Accordion>
|
</Accordion>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,6 @@ export type TabsContextType = {
|
||||||
export type TabsState = {
|
export type TabsState = {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
isPending: boolean;
|
isPending: boolean;
|
||||||
formKeysData: {input_keys?: Array<string>, memory_keys?: Array<string>};
|
formKeysData: {input_keys?: Object, memory_keys?: Array<string>, handle_keys?: Array<string>};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue