diff --git a/src/backend/langflow/interface/chains/custom.py b/src/backend/langflow/interface/chains/custom.py index 01aad73c3..27ed646b2 100644 --- a/src/backend/langflow/interface/chains/custom.py +++ b/src/backend/langflow/interface/chains/custom.py @@ -67,7 +67,9 @@ Human: {input} class MidJourneyPromptChain(BaseCustomConversationChain): """MidJourneyPromptChain is a chain you can use to generate new MidJourney prompts.""" - template: Optional[str] = """I want you to act as a prompt generator for Midjourney's artificial intelligence program. + template: Optional[ + str + ] = """I want you to act as a prompt generator for Midjourney's artificial intelligence program. Your job is to provide detailed and creative descriptions that will inspire unique and interesting images from the AI. Keep in mind that the AI is capable of understanding a wide range of language and can interpret abstract concepts, so feel free to be as imaginative and descriptive as possible. For example, you could describe a scene from a futuristic city, or a surreal landscape filled with strange creatures. @@ -81,7 +83,9 @@ class MidJourneyPromptChain(BaseCustomConversationChain): class TimeTravelGuideChain(BaseCustomConversationChain): - template: Optional[str] = """I want you to act as my time travel guide. You are helpful and creative. I will provide you with the historical period or future time I want to visit and you will suggest the best events, sights, or people to experience. Provide the suggestions and any necessary information. + template: Optional[ + str + ] = """I want you to act as my time travel guide. You are helpful and creative. I will provide you with the historical period or future time I want to visit and you will suggest the best events, sights, or people to experience. Provide the suggestions and any necessary information. Current conversation: {history} Human: {input} diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index 2bbab91f7..d126f5fa9 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -23,7 +23,6 @@ import useFlowsManagerStore from "./stores/flowsManagerStore"; import { useTypesStore } from "./stores/typesStore"; export default function App() { - const errorData = useAlertStore((state) => state.errorData); const errorOpen = useAlertStore((state) => state.errorOpen); const setErrorOpen = useAlertStore((state) => state.setErrorOpen); diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 09af96c6f..9d60313b8 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -131,25 +131,24 @@ export default function ParameterComponent({ if (data.node!.template[name].value !== code) { takeSnapshot(); } - - + setNode(data.id, (oldNode) => { let newNode = cloneDeep(oldNode); - + newNode.data = { ...newNode.data, node: newNodeClass, description: newNodeClass.description ?? data.node!.description, display_name: newNodeClass.display_name ?? data.node!.display_name, }; - + newNode.data.node.template[name].value = code; - + return newNode; }); - + updateNodeInternals(data.id); - + renderTooltips(); }; @@ -273,9 +272,11 @@ export default function ParameterComponent({ (handleSelectChange(options[0])); - // if (outputTypes.includes("ChatOutput")) { - // return ; - // } - function handleSelectChange(selected: string) { - const type = extractTypeFromLongId(selected); - return - switch (type) { - case "ChatOutput": - return ; - break; - } - } + const { inputIds, outputIds, updateNodeFlowData } = useFlowIOStore(); + const { reactFlowInstance } = useFlowStore(); + const options = inputIds.concat(outputIds); + const [selectedView, setSelectedView] = useState( + handleSelectChange(options[0]) + ); + // if (outputTypes.includes("ChatOutput")) { + // return ; + // } + function handleSelectChange(selected: string) { + const type = extractTypeFromLongId(selected); + return ; + switch (type) { + case "ChatOutput": + return ; + break; + } + } - - return ( -
-
-
- - - Inputs - -
- { - inputIds.filter(input=>extractTypeFromLongId(input)!=="ChatInput").map((inputId,index) => { - const nodeData:NodeDataType = reactFlowInstance?.getNodes().find(node=>node.id===inputId)?.data; - return ( -
- - - {inputId} - -
{ - event.stopPropagation(); - }} - > -
-
- } - key={index} - keyValue={inputId} - > -
- -
- -
- ) - }) - } -
- {selectedView} - - ); + return ( +
+
+
+ + Inputs +
+ {inputIds + .filter((input) => extractTypeFromLongId(input) !== "ChatInput") + .map((inputId, index) => { + const nodeData: NodeDataType = reactFlowInstance + ?.getNodes() + .find((node) => node.id === inputId)?.data; + return ( +
+ + + {inputId} + +
{ + event.stopPropagation(); + }} + >
+
+ } + key={index} + keyValue={inputId} + > +
+ +
+ +
+ ); + })} +
+ {selectedView} + + ); } diff --git a/src/frontend/src/components/newChatView/chatInput/index.tsx b/src/frontend/src/components/newChatView/chatInput/index.tsx index 7ae0a0915..2a4d39f4b 100644 --- a/src/frontend/src/components/newChatView/chatInput/index.tsx +++ b/src/frontend/src/components/newChatView/chatInput/index.tsx @@ -5,123 +5,121 @@ import { chatInputType } from "../../../types/components"; import { classNames } from "../../../utils/utils"; export default function ChatInput({ - lockChat, - chatValue, - sendMessage, - setChatValue, - inputRef, - noInput, + lockChat, + chatValue, + sendMessage, + setChatValue, + inputRef, + noInput, }: chatInputType): JSX.Element { - const [repeate, setRepeate] = useState(1); - useEffect(() => { - if (!lockChat && inputRef.current) { - inputRef.current.focus(); - } - }, [lockChat, inputRef]); + const [repeate, setRepeate] = useState(1); + useEffect(() => { + if (!lockChat && inputRef.current) { + inputRef.current.focus(); + } + }, [lockChat, inputRef]); + function handleChange(value: number) { + console.log(value); + if (value > 0) { + setRepeate(value); + } else { + setRepeate(1); + } + } - function handleChange(value:number){ - console.log(value) - if(value>0){ - setRepeate(value); - } - else{ - setRepeate(1); - } - } + useEffect(() => { + if (inputRef.current) { + inputRef.current.style.height = "inherit"; // Reset the height + inputRef.current.style.height = `${inputRef.current.scrollHeight}px`; // Set it to the scrollHeight + } + }, [chatValue]); + return ( +
+
+ repeate + { + handleChange(parseInt(e.target.value)); + }} + className="bg-background" + type="number" + min={0} + /> +
+