MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / convertBaseMessagetoIMessage

Function convertBaseMessagetoIMessage

packages/components/src/utils.ts:932–953  ·  view source on GitHub ↗
(messages: BaseMessage[])

Source from the content-addressed store, hash-verified

930 * @returns {IMessage[]}
931 */
932export const convertBaseMessagetoIMessage = (messages: BaseMessage[]): IMessage[] => {
933 const formatmessages: IMessage[] = []
934 for (const m of messages) {
935 if (m._getType() === 'human') {
936 formatmessages.push({
937 message: m.content as string,
938 type: 'userMessage'
939 })
940 } else if (m._getType() === 'ai') {
941 formatmessages.push({
942 message: m.content as string,
943 type: 'apiMessage'
944 })
945 } else if (m._getType() === 'system') {
946 formatmessages.push({
947 message: m.content as string,
948 type: 'apiMessage'
949 })
950 }
951 }
952 return formatmessages
953}
954
955/**
956 * Convert MultiOptions String to String Array

Callers 7

getChatMessagesMethod · 0.90
getChatMessagesMethod · 0.90
getChatMessagesMethod · 0.90
getChatMessagesMethod · 0.90
getChatMessagesMethod · 0.90
getChatMessagesMethod · 0.90
getStandaloneQuestionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected