refactor[utils.ts]: Remove and change wrong types
This commit is contained in:
parent
af66bc6927
commit
f11c41644c
3 changed files with 7 additions and 208 deletions
|
|
@ -325,11 +325,10 @@ export default function Page({ flow }: { flow: FlowType }): JSX.Element {
|
|||
);
|
||||
|
||||
// IS THIS RIGHT?
|
||||
const onEdgeUpdateEnd = useCallback((_, edge: { id: string }): void => {
|
||||
const onEdgeUpdateEnd = useCallback((_, edge: Edge): void => {
|
||||
if (!edgeUpdateSuccessful.current) {
|
||||
setEdges((eds) => eds.filter((e) => e.id !== edge.id));
|
||||
}
|
||||
|
||||
edgeUpdateSuccessful.current = true;
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
|
|
@ -210,210 +210,8 @@ export type groupedObjType = {
|
|||
type: string;
|
||||
};
|
||||
|
||||
export type dataObjType = {
|
||||
base_classes: string[];
|
||||
custom_fields: object;
|
||||
description: string;
|
||||
display_name: string;
|
||||
documentation: string;
|
||||
output_types: Array<void | string>;
|
||||
template: object;
|
||||
};
|
||||
|
||||
export type documentloadersType = {
|
||||
AZLyricsLoader: dataObjType;
|
||||
AirbyteJSONLoader: dataObjType;
|
||||
BSHTMLLoader: dataObjType;
|
||||
CSVLoader: dataObjType;
|
||||
CoNLLULoader: dataObjType;
|
||||
CollegeConfidentialLoader: dataObjType;
|
||||
DirectoryLoader: dataObjType;
|
||||
EverNoteLoader: dataObjType;
|
||||
FacebookChatLoader: dataObjType;
|
||||
GitLoader: dataObjType;
|
||||
GitbookLoader: dataObjType;
|
||||
GutenbergLoader: dataObjType;
|
||||
HNLoader: dataObjType;
|
||||
IFixitLoader: dataObjType;
|
||||
IMSDbLoader: dataObjType;
|
||||
NotionDirectoryLoader: dataObjType;
|
||||
PyPDFDirectoryLoader: dataObjType;
|
||||
PyPDFLoader: dataObjType;
|
||||
ReadTheDocsLoader: dataObjType;
|
||||
SRTLoader: dataObjType;
|
||||
SlackDirectoryLoader: dataObjType;
|
||||
TextLoader: dataObjType;
|
||||
UnstructuredEmailLoader: dataObjType;
|
||||
UnstructuredHTMLLoader: dataObjType;
|
||||
UnstructuredMarkdownLoader: dataObjType;
|
||||
UnstructuredPowerPointLoader: dataObjType;
|
||||
UnstructuredWordDocumentLoader: dataObjType;
|
||||
WebBaseLoader: dataObjType;
|
||||
};
|
||||
|
||||
export type agentsType = {
|
||||
AgentInitializer: dataObjType;
|
||||
CSVAgent: dataObjType;
|
||||
JsonAgent: dataObjType;
|
||||
SQLAgent: dataObjType;
|
||||
VectorStoreAgent: dataObjType;
|
||||
VectorStoreRouterAgent: dataObjType;
|
||||
ZeroShotAgent: dataObjType;
|
||||
};
|
||||
|
||||
export type chainsType = {
|
||||
CombineDocsChain: dataObjType;
|
||||
ConversationChain: dataObjType;
|
||||
ConversationalRetrievalChain: dataObjType;
|
||||
LLMChain: dataObjType;
|
||||
LLMCheckerChain: dataObjType;
|
||||
LLMMathChain: dataObjType;
|
||||
MidJourneyPromptChain: dataObjType;
|
||||
RetrievalQA: dataObjType;
|
||||
RetrievalQAWithSourcesChain: dataObjType;
|
||||
SQLDatabaseChain: dataObjType;
|
||||
SeriesCharacterChain: dataObjType;
|
||||
TimeTravelGuideChain: dataObjType;
|
||||
};
|
||||
|
||||
export type embeddingsType = {
|
||||
CohereEmbeddings: dataObjType;
|
||||
HuggingFaceEmbeddings: dataObjType;
|
||||
OpenAIEmbeddings: dataObjType;
|
||||
};
|
||||
|
||||
export type llmsTypes = {
|
||||
Anthropic: dataObjType;
|
||||
CTransformers: dataObjType;
|
||||
ChatAnthropic: dataObjType;
|
||||
ChatOpenAI: dataObjType;
|
||||
Cohere: dataObjType;
|
||||
HuggingFaceHub: dataObjType;
|
||||
LlamaCpp: dataObjType;
|
||||
OpenAI: dataObjType;
|
||||
VertexAI: dataObjType;
|
||||
};
|
||||
|
||||
export type memoriesType = {
|
||||
ConversationBufferMemory: dataObjType;
|
||||
ConversationBufferWindowMemory: dataObjType;
|
||||
ConversationEntityMemory: dataObjType;
|
||||
ConversationKGMemory: dataObjType;
|
||||
ConversationSummaryMemory: dataObjType;
|
||||
MongoDBChatMessageHistory: dataObjType;
|
||||
PostgresChatMessageHistory: dataObjType;
|
||||
VectorStoreRetrieverMemory: dataObjType;
|
||||
};
|
||||
|
||||
export type outputParsersType = {
|
||||
ResponseSchema: dataObjType;
|
||||
StructuredOutputParser: dataObjType;
|
||||
};
|
||||
|
||||
export type promptsType = {
|
||||
ChatMessagePromptTemplate: dataObjType;
|
||||
ChatPromptTemplate: dataObjType;
|
||||
HumanMessagePromptTemplate: dataObjType;
|
||||
PromptTemplate: dataObjType;
|
||||
SystemMessagePromptTemplate: dataObjType;
|
||||
};
|
||||
|
||||
export type retrieversType = {
|
||||
MultiQueryRetriever: dataObjType;
|
||||
};
|
||||
|
||||
export type textSplittersType = {
|
||||
CharacterTextSplitter: dataObjType;
|
||||
RecursiveCharacterTextSplitter: dataObjType;
|
||||
};
|
||||
|
||||
export type toolkitsType = {
|
||||
JsonToolkit: dataObjType;
|
||||
OpenAPIToolkit: dataObjType;
|
||||
VectorStoreInfo: dataObjType;
|
||||
VectorStoreRouterToolkit: dataObjType;
|
||||
VectorStoreToolkit: dataObjType;
|
||||
};
|
||||
|
||||
export type toolsType = {
|
||||
BingSearchRun: dataObjType;
|
||||
Calculator: dataObjType;
|
||||
GoogleSearchResults: dataObjType;
|
||||
GoogleSearchRun: dataObjType;
|
||||
GoogleSerperRun: dataObjType;
|
||||
InfoSQLDatabaseTool: dataObjType;
|
||||
JsonGetValueTool: dataObjType;
|
||||
JsonListKeysTool: dataObjType;
|
||||
JsonSpec: dataObjType;
|
||||
ListSQLDatabaseTool: dataObjType;
|
||||
"News API": dataObjType;
|
||||
"PAL-MATH": dataObjType;
|
||||
"Podcast API": dataObjType;
|
||||
PythonAstREPLTool: dataObjType;
|
||||
PythonFunction: dataObjType;
|
||||
PythonFunctionTool: dataObjType;
|
||||
PythonREPLTool: dataObjType;
|
||||
QuerySQLDataBaseTool: dataObjType;
|
||||
RequestsDeleteTool: dataObjType;
|
||||
RequestsGetTool: dataObjType;
|
||||
RequestsPatchTool: dataObjType;
|
||||
RequestsPostTool: dataObjType;
|
||||
RequestsPutTool: dataObjType;
|
||||
Search: dataObjType;
|
||||
"TMDB API": dataObjType;
|
||||
Tool: dataObjType;
|
||||
WikipediaQueryRun: dataObjType;
|
||||
WolframAlphaQueryRun: dataObjType;
|
||||
};
|
||||
|
||||
export type utilitiesType = {
|
||||
BingSearchAPIWrapper: dataObjType;
|
||||
GoogleSearchAPIWrapper: dataObjType;
|
||||
GoogleSerperAPIWrapper: dataObjType;
|
||||
SearxSearchWrapper: dataObjType;
|
||||
SerpAPIWrapper: dataObjType;
|
||||
WikipediaAPIWrapper: dataObjType;
|
||||
WolframAlphaAPIWrapper: dataObjType;
|
||||
};
|
||||
|
||||
export type vectorStoresType = {
|
||||
Chroma: dataObjType;
|
||||
FAISS: dataObjType;
|
||||
MongoDBAtlasVectorSearch: dataObjType;
|
||||
Pinecone: dataObjType;
|
||||
Qdrant: dataObjType;
|
||||
SupabaseVectorStore: dataObjType;
|
||||
Weaviate: dataObjType;
|
||||
};
|
||||
|
||||
export type wrappersType = {
|
||||
SQLDatabase: dataObjType;
|
||||
TextRequestsWrapper: dataObjType;
|
||||
};
|
||||
|
||||
export type dataType = {
|
||||
agents?: agentsType;
|
||||
chains?: chainsType;
|
||||
documentloaders?: documentloadersType;
|
||||
embeddings?: embeddingsType;
|
||||
llms?: llmsTypes;
|
||||
memories?: memoriesType;
|
||||
output_parsers?: outputParsersType;
|
||||
prompts?: promptsType;
|
||||
retrievers?: retrieversType;
|
||||
textsplitters?: textSplittersType;
|
||||
toolkits?: toolkitsType;
|
||||
tools?: toolsType;
|
||||
utilities?: utilitiesType;
|
||||
vectorstores?: vectorStoresType;
|
||||
wrappers?: wrappersType;
|
||||
};
|
||||
|
||||
export type tweakType = {
|
||||
"ChatOpenAI-TxuiN": object;
|
||||
"LLMChain-zPC3w": object;
|
||||
"PromptTemplate-iNj5W": object;
|
||||
"ConversationBufferMemory-JnodM": object;
|
||||
[key: string]: object;
|
||||
};
|
||||
|
||||
export type nodeToolbarType = {
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ import { twMerge } from "tailwind-merge";
|
|||
import { ADJECTIVES, DESCRIPTIONS, NOUNS } from "../flow_constants";
|
||||
import {
|
||||
IVarHighlightType,
|
||||
dataType,
|
||||
groupedObjType,
|
||||
tweakType,
|
||||
} from "../types/components";
|
||||
import { FlowType } from "../types/flow";
|
||||
import { TabsState } from "../types/tabs";
|
||||
import { buildTweaks } from "./reactflowUtils";
|
||||
import { APIClassType } from "../types/api";
|
||||
|
||||
export function classNames(...classes: Array<string>): string {
|
||||
return classes.filter(Boolean).join(" ");
|
||||
|
|
@ -91,7 +91,7 @@ export function checkUpperWords(str: string): string {
|
|||
}
|
||||
|
||||
export function groupByFamily(
|
||||
data: dataType,
|
||||
data: APIClassType,
|
||||
baseClasses: string,
|
||||
left: boolean,
|
||||
type: string
|
||||
|
|
@ -210,7 +210,8 @@ export function groupByFamily(
|
|||
}
|
||||
}
|
||||
|
||||
export function buildInputs(tabsState: object, id: string): string {
|
||||
export function buildInputs(tabsState: TabsState, id: string): string {
|
||||
console.log(tabsState)
|
||||
return tabsState &&
|
||||
tabsState[id] &&
|
||||
tabsState[id].formKeysData &&
|
||||
|
|
@ -353,6 +354,7 @@ export function getCurlCode(
|
|||
tweak?: any[],
|
||||
tabsState?: TabsState
|
||||
): string {
|
||||
console.log(tweak)
|
||||
const flowId = flow.id;
|
||||
const tweaks = buildTweaks(flow);
|
||||
const inputs = buildInputs(tabsState, flow.id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue