🐛 fix(process.py): add comments to clarify the purpose of adding artifacts to inputs

✨ feat(process.py): refactor processing logic for VectorStore objects to use the search method instead of generating a result message
🐛 fix(parameterComponent/index.tsx): remove duplicate import of MAX_LENGTH_TO_SCROLL_TOOLTIP
🔧 chore(utils.ts): import HuggingFaceIcon from the correct file path
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-11 08:58:20 -03:00
commit ec478a8a5e
3 changed files with 13 additions and 6 deletions

View file

@ -95,6 +95,10 @@ def process_graph_cached(data_graph: Dict[str, Any], inputs: Optional[dict] = No
logger.debug("Loaded LangChain object") logger.debug("Loaded LangChain object")
if inputs is None: if inputs is None:
inputs = {} inputs = {}
# Add artifacts to inputs
# artifacts can be documents loaded when building
# the flow
for ( for (
key, key,
value, value,
@ -116,8 +120,7 @@ def process_graph_cached(data_graph: Dict[str, Any], inputs: Optional[dict] = No
result = get_result_and_thought(langchain_object, inputs) result = get_result_and_thought(langchain_object, inputs)
logger.debug("Generated result and thought") logger.debug("Generated result and thought")
elif isinstance(langchain_object, VectorStore): elif isinstance(langchain_object, VectorStore):
class_name = langchain_object.__class__.__name__ result = langchain_object.search(**inputs)
result = {"message": f"Processed {class_name} successfully"}
else: else:
raise ValueError( raise ValueError(
f"Unknown langchain_object type: {type(langchain_object).__name__}" f"Unknown langchain_object type: {type(langchain_object).__name__}"

View file

@ -12,6 +12,7 @@ import IntComponent from "../../../../components/intComponent";
import PromptAreaComponent from "../../../../components/promptComponent"; import PromptAreaComponent from "../../../../components/promptComponent";
import TextAreaComponent from "../../../../components/textAreaComponent"; import TextAreaComponent from "../../../../components/textAreaComponent";
import ToggleShadComponent from "../../../../components/toggleShadComponent"; import ToggleShadComponent from "../../../../components/toggleShadComponent";
import { MAX_LENGTH_TO_SCROLL_TOOLTIP } from "../../../../constants";
import { PopUpContext } from "../../../../contexts/popUpContext"; import { PopUpContext } from "../../../../contexts/popUpContext";
import { TabsContext } from "../../../../contexts/tabsContext"; import { TabsContext } from "../../../../contexts/tabsContext";
import { typesContext } from "../../../../contexts/typesContext"; import { typesContext } from "../../../../contexts/typesContext";
@ -26,7 +27,6 @@ import {
nodeIconsLucide, nodeIconsLucide,
nodeNames, nodeNames,
} from "../../../../utils"; } from "../../../../utils";
import { MAX_LENGTH_TO_SCROLL_TOOLTIP } from "../../../../constants";
export default function ParameterComponent({ export default function ParameterComponent({
left, left,
@ -94,7 +94,6 @@ export default function ParameterComponent({
); );
}, [info]); }, [info]);
useEffect(() => { useEffect(() => {
const groupedObj = groupByFamily(myData, tooltipTitle, left, data.type); const groupedObj = groupByFamily(myData, tooltipTitle, left, data.type);
@ -183,7 +182,11 @@ export default function ParameterComponent({
<></> <></>
) : ( ) : (
<ShadTooltip <ShadTooltip
styleClasses={refNumberComponents.current > MAX_LENGTH_TO_SCROLL_TOOLTIP ? "tooltip-fixed-width custom-scroll overflow-y-scroll nowheel" : "tooltip-fixed-width"} styleClasses={
refNumberComponents.current > MAX_LENGTH_TO_SCROLL_TOOLTIP
? "tooltip-fixed-width custom-scroll overflow-y-scroll nowheel"
: "tooltip-fixed-width"
}
delayDuration={0} delayDuration={0}
content={refHtml.current} content={refHtml.current}
side={left ? "left" : "right"} side={left ? "left" : "right"}

View file

@ -33,6 +33,7 @@ import { EvernoteIcon } from "./icons/Evernote";
import { FBIcon } from "./icons/FacebookMessenger"; import { FBIcon } from "./icons/FacebookMessenger";
import { GitBookIcon } from "./icons/GitBook"; import { GitBookIcon } from "./icons/GitBook";
import { GoogleIcon } from "./icons/Google"; import { GoogleIcon } from "./icons/Google";
import { HuggingFaceIcon } from "./icons/HuggingFace";
import { IFixIcon } from "./icons/IFixIt"; import { IFixIcon } from "./icons/IFixIt";
import { MetaIcon } from "./icons/Meta"; import { MetaIcon } from "./icons/Meta";
import { MidjourneyIcon } from "./icons/Midjorney"; import { MidjourneyIcon } from "./icons/Midjorney";