add descriptions to flow
This commit is contained in:
parent
a5774d23a9
commit
2224d219be
4 changed files with 8 additions and 1 deletions
|
|
@ -97,7 +97,7 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) {
|
||||||
setChatValue("");
|
setChatValue("");
|
||||||
addChatHistory(message, true);
|
addChatHistory(message, true);
|
||||||
|
|
||||||
sendAll({ ...reactFlowInstance.toObject(), message, chatHistory})
|
sendAll({ ...reactFlowInstance.toObject(), message, chatHistory,name:flow.name,description:flow.description})
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
addChatHistory(r.data.result, false, r.data.thought);
|
addChatHistory(r.data.result, false, r.data.thought);
|
||||||
setLockChat(false);
|
setLockChat(false);
|
||||||
|
|
|
||||||
|
|
@ -128,9 +128,11 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
function addFlow(flow?: FlowType) {
|
function addFlow(flow?: FlowType) {
|
||||||
// Get data from the flow or set it to null if there's no flow provided.
|
// Get data from the flow or set it to null if there's no flow provided.
|
||||||
const data = flow?.data ? flow.data : null;
|
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.
|
// Create a new flow with a default name if no flow is provided.
|
||||||
let newFlow: FlowType = {
|
let newFlow: FlowType = {
|
||||||
|
description,
|
||||||
name: "New Flow",
|
name: "New Flow",
|
||||||
id: id.toString(),
|
id: id.toString(),
|
||||||
data,
|
data,
|
||||||
|
|
@ -158,6 +160,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
const newFlows = [...prevState];
|
const newFlows = [...prevState];
|
||||||
const index = newFlows.findIndex((flow) => flow.id === newFlow.id);
|
const index = newFlows.findIndex((flow) => flow.id === newFlow.id);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
newFlows[index].description = newFlow.description??""
|
||||||
newFlows[index].data = newFlow.data;
|
newFlows[index].data = newFlow.data;
|
||||||
newFlows[index].name = newFlow.name;
|
newFlows[index].name = newFlow.name;
|
||||||
newFlows[index].chat = newFlow.chat;
|
newFlows[index].chat = newFlow.chat;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,10 @@ export type TemplateVariableType = {type:string,required:boolean,placeholder?:st
|
||||||
export type sendAllProps={
|
export type sendAllProps={
|
||||||
nodes: Node[];
|
nodes: Node[];
|
||||||
edges: Edge[];
|
edges: Edge[];
|
||||||
|
name:string,
|
||||||
|
description:string;
|
||||||
viewport: Viewport;
|
viewport: Viewport;
|
||||||
message:string;
|
message:string;
|
||||||
|
|
||||||
chatHistory:{message:string,isSend:boolean}[],
|
chatHistory:{message:string,isSend:boolean}[],
|
||||||
};
|
};
|
||||||
|
|
@ -7,6 +7,7 @@ export type FlowType = {
|
||||||
id: string;
|
id: string;
|
||||||
data: ReactFlowJsonObject;
|
data: ReactFlowJsonObject;
|
||||||
chat: Array<ChatMessageType>;
|
chat: Array<ChatMessageType>;
|
||||||
|
description:string;
|
||||||
};
|
};
|
||||||
export type NodeType = {id:string,type:string,position:XYPosition,data:NodeDataType}
|
export type NodeType = {id:string,type:string,position:XYPosition,data:NodeDataType}
|
||||||
export type NodeDataType = {type:string,node?:APIClassType,id:string,value:any}
|
export type NodeDataType = {type:string,node?:APIClassType,id:string,value:any}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue