mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 11:00:55 +03:00
fix chat history
This commit is contained in:
@@ -107,9 +107,12 @@ export interface INode extends INodeProperties {
|
||||
search: (nodeData: INodeData, options?: ICommonObject) => Promise<any>
|
||||
delete: (nodeData: INodeData, options?: ICommonObject) => Promise<void>
|
||||
}
|
||||
memoryMethods?: {
|
||||
clearSessionMemory: (nodeData: INodeData, options?: ICommonObject) => Promise<void>
|
||||
getChatMessages: (nodeData: INodeData, options?: ICommonObject) => Promise<string>
|
||||
}
|
||||
init?(nodeData: INodeData, input: string, options?: ICommonObject): Promise<any>
|
||||
run?(nodeData: INodeData, input: string, options?: ICommonObject): Promise<string | ICommonObject>
|
||||
clearSessionMemory?(nodeData: INodeData, options?: ICommonObject): Promise<void>
|
||||
}
|
||||
|
||||
export interface INodeData extends INodeProperties {
|
||||
|
||||
@@ -549,6 +549,18 @@ export const convertChatHistoryToText = (chatHistory: IMessage[] = []): string =
|
||||
.join('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize array chat history to string
|
||||
* @param {IMessage[]} chatHistory
|
||||
* @returns {string}
|
||||
*/
|
||||
export const serializeChatHistory = (chatHistory: string | Array<string>) => {
|
||||
if (Array.isArray(chatHistory)) {
|
||||
return chatHistory.join('\n')
|
||||
}
|
||||
return chatHistory
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert schema to zod schema
|
||||
* @param {string | object} schema
|
||||
|
||||
Reference in New Issue
Block a user