-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #455 from kreneskyp/nested_run_log_nodes
Run log can now load missing nodes.
- Loading branch information
Showing
9 changed files
with
163 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
import React from "react"; | ||
import { LLM_NAME_MAP } from "chains/constants"; | ||
export const addType = (type, setTypes) => { | ||
setTypes((prev) => { | ||
if (!prev.some((t) => t.id === type.id)) { | ||
return [...prev, type]; | ||
} | ||
return prev; | ||
}); | ||
}; | ||
|
||
export function llm_name(classPath) { | ||
if (classPath === undefined) { | ||
return <i>inherited</i>; | ||
} | ||
export const addTypes = (types, setTypes) => { | ||
setTypes((prev) => { | ||
const new_types = types.filter( | ||
(type) => !prev.some((t) => t.id === type.id) | ||
); | ||
return [...prev, ...new_types]; | ||
}); | ||
}; | ||
|
||
// lookup LLM name, default to class name if classPath isn't mapped with a label | ||
return LLM_NAME_MAP[classPath] || classPath.split(".").pop(); | ||
} | ||
export const addNode = (node, setNodes) => { | ||
setNodes((prevNodes) => { | ||
return { ...prevNodes, [node.id]: node }; | ||
}); | ||
}; | ||
|
||
export const addNodes = (newNodes, setNodes) => { | ||
setNodes((prevNodes) => { | ||
const updatedNodes = { ...prevNodes }; | ||
newNodes.forEach((node) => { | ||
if (!prevNodes[node.id]) { | ||
updatedNodes[node.id] = node; | ||
} | ||
}); | ||
return updatedNodes; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters