Merge branch 'form_io' of personal:logspace-ai/langflow into form_io
This commit is contained in:
commit
786d089eb3
6 changed files with 22 additions and 27 deletions
|
|
@ -68,7 +68,11 @@ def instantiate_based_on_type(class_object, base_type, node_type, params):
|
|||
elif base_type == "prompts":
|
||||
return instantiate_prompt(node_type, class_object, params)
|
||||
elif base_type == "tools":
|
||||
return instantiate_tool(node_type, class_object, params)
|
||||
tool = instantiate_tool(node_type, class_object, params)
|
||||
if hasattr(tool, "name") and isinstance(tool, BaseTool):
|
||||
# tool name shouldn't contain spaces
|
||||
tool.name = tool.name.replace(" ", "_")
|
||||
return tool
|
||||
elif base_type == "toolkits":
|
||||
return instantiate_toolkit(node_type, class_object, params)
|
||||
elif base_type == "embeddings":
|
||||
|
|
@ -133,6 +137,9 @@ def instantiate_llm(node_type, class_object, params: Dict):
|
|||
def instantiate_memory(node_type, class_object, params):
|
||||
# process input_key and output_key to remove them if
|
||||
# they are empty strings
|
||||
if node_type == "ConversationEntityMemory":
|
||||
params.pop("memory_key", None)
|
||||
|
||||
for key in ["input_key", "output_key"]:
|
||||
if key in params and (params[key] == "" or not params[key]):
|
||||
params.pop(key)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,11 @@ async def get_result_and_steps(langchain_object, inputs: Union[dict, str], **kwa
|
|||
# Deactivating until we have a frontend solution
|
||||
# to display intermediate steps
|
||||
langchain_object.return_intermediate_steps = True
|
||||
try:
|
||||
fix_memory_inputs(langchain_object)
|
||||
except Exception as exc:
|
||||
logger.error(exc)
|
||||
|
||||
fix_memory_inputs(langchain_object)
|
||||
try:
|
||||
async_callbacks = [AsyncStreamingLLMCallbackHandler(**kwargs)]
|
||||
output = await langchain_object.acall(inputs, callbacks=async_callbacks)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ def fix_memory_inputs(langchain_object):
|
|||
if not hasattr(langchain_object, "memory") or langchain_object.memory is None:
|
||||
return
|
||||
try:
|
||||
if langchain_object.memory.memory_key in langchain_object.input_variables:
|
||||
if (
|
||||
hasattr(langchain_object.memory, "memory_key")
|
||||
and langchain_object.memory.memory_key in langchain_object.input_variables
|
||||
):
|
||||
return
|
||||
except AttributeError:
|
||||
input_variables = (
|
||||
|
|
|
|||
|
|
@ -90,6 +90,9 @@ class MemoryFrontendNode(FrontendNode):
|
|||
field.show = True
|
||||
if field.name == "entity_store":
|
||||
field.show = False
|
||||
if name == "ConversationEntityMemory" and field.name == "memory_key":
|
||||
field.show = False
|
||||
field.required = False
|
||||
|
||||
|
||||
class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import "ace-builds/src-noconflict/mode-python";
|
|||
import "ace-builds/src-noconflict/theme-github";
|
||||
import "ace-builds/src-noconflict/theme-twilight";
|
||||
import { TerminalSquare } from "lucide-react";
|
||||
import { useContext, useRef, useState } from "react";
|
||||
import { useContext, useState } from "react";
|
||||
import AceEditor from "react-ace";
|
||||
import { Button } from "../../components/ui/button";
|
||||
import { CODE_PROMPT_DIALOG_SUBTITLE } from "../../constants";
|
||||
|
|
@ -31,10 +31,6 @@ export default function CodeAreaModal({
|
|||
const { dark } = useContext(darkContext);
|
||||
const { closePopUp, setCloseEdit } = useContext(PopUpContext);
|
||||
const { setErrorData, setSuccessData } = useContext(alertContext);
|
||||
const [error, setError] = useState<{
|
||||
detail: { error: string; traceback: string };
|
||||
}>(null);
|
||||
const ref = useRef();
|
||||
|
||||
function setModalOpen(x: boolean) {
|
||||
if (x === false) {
|
||||
|
|
@ -113,23 +109,6 @@ export default function CodeAreaModal({
|
|||
className="h-full w-full rounded-lg border-[1px] border-gray-300 custom-scroll dark:border-gray-600"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className={
|
||||
"w-full transition-all delay-500 " +
|
||||
(error?.detail.error !== undefined ? "h-2/6" : "h-0")
|
||||
}
|
||||
>
|
||||
<div className="mt-1 h-full w-full overflow-x-clip overflow-y-scroll text-left custom-scroll">
|
||||
<h1 className="text-lg text-destructive">
|
||||
{error?.detail?.error}
|
||||
</h1>
|
||||
<div className="ml-2 w-full break-all text-sm text-status-red">
|
||||
<pre className="w-full whitespace-pre-wrap break-all">
|
||||
{error?.detail?.traceback}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex h-fit w-full justify-end">
|
||||
<Button className="mt-3" onClick={handleClick} type="submit">
|
||||
Check & Save
|
||||
|
|
|
|||
|
|
@ -338,7 +338,8 @@ export default function Page({ flow }: { flow: FlowType }) {
|
|||
const onSelectionEnd = useCallback(() => {
|
||||
setSelectionEnded(true);
|
||||
}, []);
|
||||
const onSelectionStart = useCallback(() => {
|
||||
const onSelectionStart = useCallback((event) => {
|
||||
event.preventDefault();
|
||||
setSelectionEnded(false);
|
||||
}, []);
|
||||
|
||||
|
|
@ -410,7 +411,6 @@ export default function Page({ flow }: { flow: FlowType }) {
|
|||
nodesDraggable={!disableCopyPaste}
|
||||
panOnDrag={!disableCopyPaste}
|
||||
zoomOnDoubleClick={!disableCopyPaste}
|
||||
selectNodesOnDrag={false}
|
||||
className="theme-attribution"
|
||||
minZoom={0.01}
|
||||
maxZoom={8}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue