feat: Add support for Custom Component in Langflow Interface
This commit adds support for Custom Component in the Langflow interface. It introduces a new class `CustomComponent`, which takes in a `code` as a parameter and validates it. The `CustomComponent` class also provides a method to get the function specified in the code. The commit also makes some modifications in `initialize/loading.py` file to handle the new `CustomComponent` class. It adds a new helper function `get_function_custom` which creates a function using `validate.create_function` and the `build` function name.
This commit is contained in:
parent
7d8304cb60
commit
dd009a2913
8 changed files with 228 additions and 58 deletions
|
|
@ -98,17 +98,17 @@ export default function CodeAreaModal({
|
|||
title: "There is something wrong with this code, please review it",
|
||||
});
|
||||
});
|
||||
// postCustomComponent(code, nodeClass).then((apiReturn) => {
|
||||
// const data = apiReturn.data;
|
||||
// if (data) {
|
||||
// setNodeClass(data);
|
||||
// setModalOpen(false);
|
||||
// }
|
||||
// });
|
||||
axios.get("/api/v1/custom_component_error").catch((err) => {
|
||||
console.log(err.response.data);
|
||||
setError(err.response.data);
|
||||
})
|
||||
postCustomComponent(code, nodeClass).then((apiReturn) => {
|
||||
const {data} = apiReturn;
|
||||
if (data) {
|
||||
setNodeClass(data);
|
||||
setModalOpen(false);
|
||||
}
|
||||
});
|
||||
// axios.get("/api/v1/custom_component_error").catch((err) => {
|
||||
// console.log(err.response.data);
|
||||
// setError(err.response.data);
|
||||
// })
|
||||
|
||||
}
|
||||
const tabs = [{ name: "code" }, { name: "errors" }]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue