Formatting
This commit is contained in:
parent
9f7e6f0fa2
commit
2b454dc645
5 changed files with 37 additions and 27 deletions
|
|
@ -59,7 +59,7 @@ def get_memory_key(langchain_object):
|
|||
"history": "chat_history",
|
||||
}
|
||||
# Check if memory_key attribute exists
|
||||
if hasattr(langchain_object.memory, 'memory_key'):
|
||||
if hasattr(langchain_object.memory, "memory_key"):
|
||||
memory_key = langchain_object.memory.memory_key
|
||||
return mem_key_dict.get(memory_key)
|
||||
else:
|
||||
|
|
@ -90,5 +90,4 @@ def update_memory_keys(langchain_object, possible_new_mem_key):
|
|||
try:
|
||||
setattr(langchain_object.memory, attr, key)
|
||||
except ValueError as exc:
|
||||
logger.debug(
|
||||
f"{langchain_object.memory} has no attribute {attr} ({exc})")
|
||||
logger.debug(f"{langchain_object.memory} has no attribute {attr} ({exc})")
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ export const EDIT_DIALOG_SUBTITLE =
|
|||
export const CODE_PROMPT_DIALOG_SUBTITLE =
|
||||
"Edit your Python code. This code snippet accepts module import and a single function definition. Make sure that your function returns a string.";
|
||||
|
||||
|
||||
export const CODE_DICT_DIALOG_SUBTITLE =
|
||||
"Edit your dictionary. This dialog allows you to create your own customized dictionary. You can add as many key-value pairs as you want. While in edit mode, you can enter ({}) or ([]), and this will result in adding a new object or array.";
|
||||
|
||||
|
|
|
|||
|
|
@ -123,18 +123,18 @@ export type TooltipComponentType = {
|
|||
children: ReactElement;
|
||||
title: string | ReactElement;
|
||||
placement?:
|
||||
| "bottom-end"
|
||||
| "bottom-start"
|
||||
| "bottom"
|
||||
| "left-end"
|
||||
| "left-start"
|
||||
| "left"
|
||||
| "right-end"
|
||||
| "right-start"
|
||||
| "right"
|
||||
| "top-end"
|
||||
| "top-start"
|
||||
| "top";
|
||||
| "bottom-end"
|
||||
| "bottom-start"
|
||||
| "bottom"
|
||||
| "left-end"
|
||||
| "left-start"
|
||||
| "left"
|
||||
| "right-end"
|
||||
| "right-start"
|
||||
| "right"
|
||||
| "top-end"
|
||||
| "top-start"
|
||||
| "top";
|
||||
};
|
||||
|
||||
export type ProgressBarType = {
|
||||
|
|
|
|||
|
|
@ -219,21 +219,34 @@ export function validateNode(
|
|||
edge.targetHandle.split("|")[2] === node.id
|
||||
)
|
||||
) {
|
||||
errors.push(`${type} is missing ${template.display_name || toNormalCase(template[t].name)}.`);
|
||||
errors.push(
|
||||
`${type} is missing ${
|
||||
template.display_name || toNormalCase(template[t].name)
|
||||
}.`
|
||||
);
|
||||
} else if (
|
||||
(template[t].type === "dict") &&
|
||||
template[t].type === "dict" &&
|
||||
template[t].required &&
|
||||
template[t].show &&
|
||||
(template[t].value !== undefined ||
|
||||
template[t].value !== null ||
|
||||
template[t].value !== "")
|
||||
) {
|
||||
if (hasDuplicateKeys(template[t].value)) errors.push(`${type} (${template.display_name || template[t].name}) contains duplicate keys with the same values.`);
|
||||
if (hasEmptyKey(template[t].value)) errors.push(`${type} (${template.display_name || template[t].name}) field must not be empty.`);
|
||||
if (hasDuplicateKeys(template[t].value))
|
||||
errors.push(
|
||||
`${type} (${
|
||||
template.display_name || template[t].name
|
||||
}) contains duplicate keys with the same values.`
|
||||
);
|
||||
if (hasEmptyKey(template[t].value))
|
||||
errors.push(
|
||||
`${type} (${
|
||||
template.display_name || template[t].name
|
||||
}) field must not be empty.`
|
||||
);
|
||||
}
|
||||
return errors;
|
||||
}, [] as string[]);
|
||||
|
||||
}
|
||||
|
||||
export function validateNodes(reactFlowInstance: ReactFlowInstance) {
|
||||
|
|
@ -299,7 +312,6 @@ export function getConnectedNodes(
|
|||
}
|
||||
|
||||
export function convertObjToArray(singleObject) {
|
||||
|
||||
if (Array.isArray(singleObject)) return singleObject;
|
||||
|
||||
let arrConverted: any = [];
|
||||
|
|
@ -329,7 +341,7 @@ export function hasDuplicateKeys(array) {
|
|||
export function hasEmptyKey(objArray) {
|
||||
for (const obj of objArray) {
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key) && key === '') {
|
||||
if (obj.hasOwnProperty(key) && key === "") {
|
||||
return true; // Found an empty key
|
||||
}
|
||||
}
|
||||
|
|
@ -346,10 +358,10 @@ export function convertValuesToNumbers(arr) {
|
|||
if (/\s/g.test(value)) {
|
||||
value = value.trim();
|
||||
}
|
||||
newObj[key] = value === "" || isNaN(value) ? value.toString() : Number(value);
|
||||
newObj[key] =
|
||||
value === "" || isNaN(value) ? value.toString() : Number(value);
|
||||
}
|
||||
}
|
||||
return newObj;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
ArrowUpToLine,
|
||||
Bell,
|
||||
BookMarked,
|
||||
Check,
|
||||
CheckCircle2,
|
||||
ChevronDown,
|
||||
|
|
@ -78,7 +79,6 @@ import {
|
|||
X,
|
||||
XCircle,
|
||||
Zap,
|
||||
BookMarked
|
||||
} from "lucide-react";
|
||||
import { FaApple, FaGithub } from "react-icons/fa";
|
||||
import { AirbyteIcon } from "../icons/Airbyte";
|
||||
|
|
@ -309,5 +309,5 @@ export const nodeIconsLucide: iconsType = {
|
|||
Key,
|
||||
Unplug,
|
||||
BookMarked,
|
||||
ChevronUp
|
||||
ChevronUp,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue