feat: add pip modules when selecting custom_nodes
This commit is contained in:
parent
78721b3129
commit
2bace09f5e
@ -157,6 +157,7 @@ type CustomNodeList = {
|
|||||||
author: string;
|
author: string;
|
||||||
title: string;
|
title: string;
|
||||||
reference: string;
|
reference: string;
|
||||||
|
pip: string[];
|
||||||
files: string[];
|
files: string[];
|
||||||
install_type: string;
|
install_type: string;
|
||||||
description: string;
|
description: string;
|
||||||
@ -237,13 +238,23 @@ function CustomNodesSelector({
|
|||||||
key={index}
|
key={index}
|
||||||
value={framework.reference}
|
value={framework.reference}
|
||||||
onSelect={async (currentValue) => {
|
onSelect={async (currentValue) => {
|
||||||
|
let nodeList: Record<
|
||||||
|
string,
|
||||||
|
{
|
||||||
|
hash: string;
|
||||||
|
disabled: boolean;
|
||||||
|
pip?: string[]
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
const x = customNodeList;
|
||||||
|
|
||||||
|
if (x[currentValue]) {
|
||||||
|
const newNodeList = { ...x };
|
||||||
|
delete newNodeList[currentValue];
|
||||||
|
nodeList = newNodeList;
|
||||||
|
} else {
|
||||||
const repoName = extractRepoName(currentValue);
|
const repoName = extractRepoName(currentValue);
|
||||||
|
|
||||||
console.log(repoName);
|
|
||||||
|
|
||||||
const id = toast.loading(`Fetching repo info...`);
|
const id = toast.loading(`Fetching repo info...`);
|
||||||
// toast.info("hi");
|
|
||||||
|
|
||||||
const repo = await fetch(
|
const repo = await fetch(
|
||||||
`https://api.github.com/repos/${repoName}`
|
`https://api.github.com/repos/${repoName}`
|
||||||
)
|
)
|
||||||
@ -261,9 +272,7 @@ function CustomNodesSelector({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!repo) return;
|
if (!repo) return;
|
||||||
|
|
||||||
const branch = repo.default_branch;
|
const branch = repo.default_branch;
|
||||||
|
|
||||||
const branchInfo = await fetch(
|
const branchInfo = await fetch(
|
||||||
`https://api.github.com/repos/${repoName}/branches/${branch}`
|
`https://api.github.com/repos/${repoName}/branches/${branch}`
|
||||||
)
|
)
|
||||||
@ -282,24 +291,11 @@ function CustomNodesSelector({
|
|||||||
|
|
||||||
if (!branchInfo) return;
|
if (!branchInfo) return;
|
||||||
|
|
||||||
let nodeList: Record<
|
|
||||||
string,
|
|
||||||
{
|
|
||||||
hash: string;
|
|
||||||
disabled: boolean;
|
|
||||||
}
|
|
||||||
>;
|
|
||||||
const x = customNodeList;
|
|
||||||
|
|
||||||
if (x[currentValue]) {
|
|
||||||
const newNodeList = { ...x };
|
|
||||||
delete newNodeList[currentValue];
|
|
||||||
nodeList = newNodeList;
|
|
||||||
} else {
|
|
||||||
nodeList = {
|
nodeList = {
|
||||||
[currentValue]: {
|
[currentValue]: {
|
||||||
hash: branchInfo?.commit.sha,
|
hash: branchInfo?.commit.sha,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
pip: framework.pip
|
||||||
},
|
},
|
||||||
...x,
|
...x,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user