Merge branch 'dev' into python_custom_node_component
This commit is contained in:
commit
d7a13755b3
8 changed files with 156 additions and 408 deletions
|
|
@ -153,6 +153,8 @@ memories:
|
|||
documentation: "https://python.langchain.com/docs/modules/memory/how_to/vectorstore_retriever_memory"
|
||||
MongoDBChatMessageHistory:
|
||||
documentation: "https://python.langchain.com/docs/modules/memory/integrations/mongodb_chat_message_history"
|
||||
MotorheadMemory:
|
||||
documentation: "https://python.langchain.com/docs/integrations/memory/motorhead_memory"
|
||||
prompts:
|
||||
ChatMessagePromptTemplate:
|
||||
documentation: "https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/msg_prompt_templates"
|
||||
|
|
|
|||
|
|
@ -94,6 +94,14 @@ class MemoryFrontendNode(FrontendNode):
|
|||
field.show = False
|
||||
field.required = False
|
||||
|
||||
if name == "MotorheadMemory":
|
||||
if field.name == "chat_memory":
|
||||
field.show = False
|
||||
field.required = False
|
||||
elif field.name == "client_id":
|
||||
field.show = True
|
||||
field.advanced = False
|
||||
|
||||
|
||||
class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode):
|
||||
name: str = "PostgresChatMessageHistory"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import {
|
|||
import { APIClassType, APITemplateType } from "../types/api";
|
||||
import { FlowType, NodeType } from "../types/flow";
|
||||
import { TabsContextType, TabsState } from "../types/tabs";
|
||||
import { updateIds, updateTemplate } from "../utils/reactflowUtils";
|
||||
import { addVersionToDuplicates, updateIds, updateTemplate } from "../utils/reactflowUtils";
|
||||
import { getRandomDescription, getRandomName } from "../utils/utils";
|
||||
import { alertContext } from "./alertContext";
|
||||
import { typesContext } from "./typesContext";
|
||||
|
|
@ -450,6 +450,10 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
processFlowEdges(newFlow);
|
||||
processFlowNodes(newFlow);
|
||||
|
||||
const flowName = addVersionToDuplicates(newFlow, flows);
|
||||
|
||||
newFlow.name = flowName;
|
||||
|
||||
try {
|
||||
const { id } = await saveFlowToDatabase(newFlow);
|
||||
// Change the id to the new id.
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ function BaseModal({
|
|||
switch (size) {
|
||||
case "smaller":
|
||||
minWidth = "min-w-[40vw]";
|
||||
height = "h-[25vh]";
|
||||
height = "h-[27vh]";
|
||||
break;
|
||||
case "small":
|
||||
minWidth = "min-w-[40vw]";
|
||||
|
|
|
|||
|
|
@ -219,3 +219,16 @@ export function validateNodes(reactFlowInstance: ReactFlowInstance) {
|
|||
.getNodes()
|
||||
.flatMap((n: NodeType) => validateNode(n, reactFlowInstance));
|
||||
}
|
||||
|
||||
export function addVersionToDuplicates(flow: FlowType, flows: FlowType[]) {
|
||||
const existingNames = flows.map((item) => item.name);
|
||||
let newName = flow.name;
|
||||
let count = 1;
|
||||
|
||||
while (existingNames.includes(newName)) {
|
||||
newName = `${flow.name} (${count})`;
|
||||
count++;
|
||||
}
|
||||
|
||||
return newName;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue