diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 27bf220f9..037c9cdaf 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -97,7 +97,7 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { setChatValue(""); addChatHistory(message, true); - sendAll({ ...reactFlowInstance.toObject(), message, chatHistory}) + sendAll({ ...reactFlowInstance.toObject(), message, chatHistory,name:flow.name,description:flow.description}) .then((r) => { addChatHistory(r.data.result, false, r.data.thought); setLockChat(false); diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 1bab447b8..fa52a6955 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -128,9 +128,11 @@ export function TabsProvider({ children }: { children: ReactNode }) { function addFlow(flow?: FlowType) { // Get data from the flow or set it to null if there's no flow provided. const data = flow?.data ? flow.data : null; + const description = flow?.description?flow.description:"" // Create a new flow with a default name if no flow is provided. let newFlow: FlowType = { + description, name: "New Flow", id: id.toString(), data, @@ -158,6 +160,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { const newFlows = [...prevState]; const index = newFlows.findIndex((flow) => flow.id === newFlow.id); if (index !== -1) { + newFlows[index].description = newFlow.description??"" newFlows[index].data = newFlow.data; newFlows[index].name = newFlow.name; newFlows[index].chat = newFlow.chat; diff --git a/src/frontend/src/types/api/index.ts b/src/frontend/src/types/api/index.ts index d0f8f3f87..f85605ce4 100644 --- a/src/frontend/src/types/api/index.ts +++ b/src/frontend/src/types/api/index.ts @@ -9,7 +9,10 @@ export type TemplateVariableType = {type:string,required:boolean,placeholder?:st export type sendAllProps={ nodes: Node[]; edges: Edge[]; + name:string, + description:string; viewport: Viewport; message:string; + chatHistory:{message:string,isSend:boolean}[], }; \ No newline at end of file diff --git a/src/frontend/src/types/flow/index.ts b/src/frontend/src/types/flow/index.ts index ba12291f1..50b0cab7a 100644 --- a/src/frontend/src/types/flow/index.ts +++ b/src/frontend/src/types/flow/index.ts @@ -7,6 +7,7 @@ export type FlowType = { id: string; data: ReactFlowJsonObject; chat: Array; + description:string; }; export type NodeType = {id:string,type:string,position:XYPosition,data:NodeDataType} export type NodeDataType = {type:string,node?:APIClassType,id:string,value:any} \ No newline at end of file