Merge branch 'dev' of https://github.com/logspace-ai/langflow into dev
This commit is contained in:
commit
0fc7e2ee47
5 changed files with 26 additions and 29 deletions
|
|
@ -136,7 +136,7 @@ export default function ParameterComponent({
|
||||||
nodeIconsLucide[item.family] ?? nodeIconsLucide["unknown"];
|
nodeIconsLucide[item.family] ?? nodeIconsLucide["unknown"];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div key={index}>
|
||||||
{index === 0 && (
|
{index === 0 && (
|
||||||
<span>
|
<span>
|
||||||
{left
|
{left
|
||||||
|
|
@ -183,7 +183,7 @@ export default function ParameterComponent({
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -92,14 +92,22 @@ export function TypesProvider({ children }: { children: ReactNode }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteNode(idx: string) {
|
function deleteNode(idx: string | Array<string>) {
|
||||||
reactFlowInstance!.setNodes(
|
reactFlowInstance!.setNodes(
|
||||||
reactFlowInstance!.getNodes().filter((node: Node) => node.id !== idx)
|
reactFlowInstance!
|
||||||
|
.getNodes()
|
||||||
|
.filter((node: Node) =>
|
||||||
|
typeof idx === "string" ? node.id !== idx : !idx.includes(node.id)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
reactFlowInstance!.setEdges(
|
reactFlowInstance!.setEdges(
|
||||||
reactFlowInstance!
|
reactFlowInstance!
|
||||||
.getEdges()
|
.getEdges()
|
||||||
.filter((edge) => edge.source !== idx && edge.target !== idx)
|
.filter((edge) =>
|
||||||
|
typeof idx === "string"
|
||||||
|
? edge.source !== idx && edge.target !== idx
|
||||||
|
: !idx.includes(edge.source) && !idx.includes(edge.target)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,7 @@ import { alertContext } from "../../contexts/alertContext";
|
||||||
import { postValidatePrompt } from "../../controllers/API";
|
import { postValidatePrompt } from "../../controllers/API";
|
||||||
import { genericModalPropsType } from "../../types/components";
|
import { genericModalPropsType } from "../../types/components";
|
||||||
import { handleKeyDown } from "../../utils/reactflowUtils";
|
import { handleKeyDown } from "../../utils/reactflowUtils";
|
||||||
import {
|
import { classNames, varHighlightHTML } from "../../utils/utils";
|
||||||
classNames,
|
|
||||||
getRandomKeyByssmm,
|
|
||||||
varHighlightHTML,
|
|
||||||
} from "../../utils/utils";
|
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
|
|
||||||
export default function GenericModal({
|
export default function GenericModal({
|
||||||
|
|
@ -97,19 +93,6 @@ export default function GenericModal({
|
||||||
.replace(regexHighlight, varHighlightHTML({ name: "$1" }))
|
.replace(regexHighlight, varHighlightHTML({ name: "$1" }))
|
||||||
.replace(/\n/g, "<br />");
|
.replace(/\n/g, "<br />");
|
||||||
|
|
||||||
const TextAreaContentView = (): JSX.Element => {
|
|
||||||
return (
|
|
||||||
<SanitizedHTMLWrapper
|
|
||||||
className={getClassByNumberLength()}
|
|
||||||
content={coloredContent}
|
|
||||||
onClick={() => {
|
|
||||||
setIsEdit(true);
|
|
||||||
}}
|
|
||||||
suppressWarning={true}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
function getClassByNumberLength(): string {
|
function getClassByNumberLength(): string {
|
||||||
let sumOfCaracteres: number = 0;
|
let sumOfCaracteres: number = 0;
|
||||||
wordsHighlight.forEach((element) => {
|
wordsHighlight.forEach((element) => {
|
||||||
|
|
@ -224,7 +207,14 @@ export default function GenericModal({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : type === TypeModal.PROMPT && !isEdit ? (
|
) : type === TypeModal.PROMPT && !isEdit ? (
|
||||||
<TextAreaContentView />
|
<SanitizedHTMLWrapper
|
||||||
|
className={getClassByNumberLength()}
|
||||||
|
content={coloredContent}
|
||||||
|
onClick={() => {
|
||||||
|
setIsEdit(true);
|
||||||
|
}}
|
||||||
|
suppressWarning={true}
|
||||||
|
/>
|
||||||
) : type !== TypeModal.PROMPT ? (
|
) : type !== TypeModal.PROMPT ? (
|
||||||
<Textarea
|
<Textarea
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
|
@ -263,7 +253,7 @@ export default function GenericModal({
|
||||||
|
|
||||||
{wordsHighlight.map((word, index) => (
|
{wordsHighlight.map((word, index) => (
|
||||||
<ShadTooltip
|
<ShadTooltip
|
||||||
key={getRandomKeyByssmm() + index}
|
key={index}
|
||||||
content={word.replace(/[{}]/g, "")}
|
content={word.replace(/[{}]/g, "")}
|
||||||
asChild={false}
|
asChild={false}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,8 @@ export default function Page({
|
||||||
lastSelection
|
lastSelection
|
||||||
) {
|
) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
lastSelection.nodes.forEach((k) => {
|
console.log(lastSelection);
|
||||||
deleteNode(k.id);
|
deleteNode(lastSelection.nodes.map((node) => node.id));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const data: { [char: string]: string } = {};
|
||||||
export type typesContextType = {
|
export type typesContextType = {
|
||||||
reactFlowInstance: ReactFlowInstance | null;
|
reactFlowInstance: ReactFlowInstance | null;
|
||||||
setReactFlowInstance: (newState: ReactFlowInstance) => void;
|
setReactFlowInstance: (newState: ReactFlowInstance) => void;
|
||||||
deleteNode: (idx: string) => void;
|
deleteNode: (idx: string | Array<string>) => void;
|
||||||
types: typeof types;
|
types: typeof types;
|
||||||
setTypes: (newState: {}) => void;
|
setTypes: (newState: {}) => void;
|
||||||
templates: typeof template;
|
templates: typeof template;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue