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",
|
"history": "chat_history",
|
||||||
}
|
}
|
||||||
# Check if memory_key attribute exists
|
# 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
|
memory_key = langchain_object.memory.memory_key
|
||||||
return mem_key_dict.get(memory_key)
|
return mem_key_dict.get(memory_key)
|
||||||
else:
|
else:
|
||||||
|
|
@ -90,5 +90,4 @@ def update_memory_keys(langchain_object, possible_new_mem_key):
|
||||||
try:
|
try:
|
||||||
setattr(langchain_object.memory, attr, key)
|
setattr(langchain_object.memory, attr, key)
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
logger.debug(
|
logger.debug(f"{langchain_object.memory} has no attribute {attr} ({exc})")
|
||||||
f"{langchain_object.memory} has no attribute {attr} ({exc})")
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,6 @@ export const EDIT_DIALOG_SUBTITLE =
|
||||||
export const CODE_PROMPT_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.";
|
"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 =
|
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.";
|
"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.";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -219,21 +219,34 @@ export function validateNode(
|
||||||
edge.targetHandle.split("|")[2] === node.id
|
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 (
|
} else if (
|
||||||
(template[t].type === "dict") &&
|
template[t].type === "dict" &&
|
||||||
template[t].required &&
|
template[t].required &&
|
||||||
template[t].show &&
|
template[t].show &&
|
||||||
(template[t].value !== undefined ||
|
(template[t].value !== undefined ||
|
||||||
template[t].value !== null ||
|
template[t].value !== null ||
|
||||||
template[t].value !== "")
|
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 (hasDuplicateKeys(template[t].value))
|
||||||
if (hasEmptyKey(template[t].value)) errors.push(`${type} (${template.display_name || template[t].name}) field must not be empty.`);
|
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;
|
return errors;
|
||||||
}, [] as string[]);
|
}, [] as string[]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function validateNodes(reactFlowInstance: ReactFlowInstance) {
|
export function validateNodes(reactFlowInstance: ReactFlowInstance) {
|
||||||
|
|
@ -299,7 +312,6 @@ export function getConnectedNodes(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertObjToArray(singleObject) {
|
export function convertObjToArray(singleObject) {
|
||||||
|
|
||||||
if (Array.isArray(singleObject)) return singleObject;
|
if (Array.isArray(singleObject)) return singleObject;
|
||||||
|
|
||||||
let arrConverted: any = [];
|
let arrConverted: any = [];
|
||||||
|
|
@ -329,7 +341,7 @@ export function hasDuplicateKeys(array) {
|
||||||
export function hasEmptyKey(objArray) {
|
export function hasEmptyKey(objArray) {
|
||||||
for (const obj of objArray) {
|
for (const obj of objArray) {
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
if (obj.hasOwnProperty(key) && key === '') {
|
if (obj.hasOwnProperty(key) && key === "") {
|
||||||
return true; // Found an empty key
|
return true; // Found an empty key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -346,10 +358,10 @@ export function convertValuesToNumbers(arr) {
|
||||||
if (/\s/g.test(value)) {
|
if (/\s/g.test(value)) {
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
}
|
}
|
||||||
newObj[key] = value === "" || isNaN(value) ? value.toString() : Number(value);
|
newObj[key] =
|
||||||
|
value === "" || isNaN(value) ? value.toString() : Number(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newObj;
|
return newObj;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
ArrowUpToLine,
|
ArrowUpToLine,
|
||||||
Bell,
|
Bell,
|
||||||
|
BookMarked,
|
||||||
Check,
|
Check,
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
|
|
@ -78,7 +79,6 @@ import {
|
||||||
X,
|
X,
|
||||||
XCircle,
|
XCircle,
|
||||||
Zap,
|
Zap,
|
||||||
BookMarked
|
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { FaApple, FaGithub } from "react-icons/fa";
|
import { FaApple, FaGithub } from "react-icons/fa";
|
||||||
import { AirbyteIcon } from "../icons/Airbyte";
|
import { AirbyteIcon } from "../icons/Airbyte";
|
||||||
|
|
@ -309,5 +309,5 @@ export const nodeIconsLucide: iconsType = {
|
||||||
Key,
|
Key,
|
||||||
Unplug,
|
Unplug,
|
||||||
BookMarked,
|
BookMarked,
|
||||||
ChevronUp
|
ChevronUp,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue