mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 05:01:10 +03:00
Merge branch 'main' into feature/ConversationRetrievalQAAgent
# Conflicts: # packages/server/src/ChildProcess.ts # packages/server/src/index.ts
This commit is contained in:
@@ -37,6 +37,16 @@ class CSV_Agents implements INode {
|
|||||||
label: 'Language Model',
|
label: 'Language Model',
|
||||||
name: 'model',
|
name: 'model',
|
||||||
type: 'BaseLanguageModel'
|
type: 'BaseLanguageModel'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'System Message',
|
||||||
|
name: 'systemMessagePrompt',
|
||||||
|
type: 'string',
|
||||||
|
rows: 4,
|
||||||
|
additionalParams: true,
|
||||||
|
optional: true,
|
||||||
|
placeholder:
|
||||||
|
'I want you to act as a document that I am having a conversation with. Your name is "AI Assistant". You will provide me with answers from the given info. If the answer is not included, say exactly "Hmm, I am not sure." and stop after that. Refuse to answer any question not about the info. Never break character.'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -49,6 +59,7 @@ class CSV_Agents implements INode {
|
|||||||
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
||||||
const csvFileBase64 = nodeData.inputs?.csvFile as string
|
const csvFileBase64 = nodeData.inputs?.csvFile as string
|
||||||
const model = nodeData.inputs?.model as BaseLanguageModel
|
const model = nodeData.inputs?.model as BaseLanguageModel
|
||||||
|
const systemMessagePrompt = nodeData.inputs?.systemMessagePrompt as string
|
||||||
|
|
||||||
const loggerHandler = new ConsoleCallbackHandler(options.logger)
|
const loggerHandler = new ConsoleCallbackHandler(options.logger)
|
||||||
const handler = new CustomChainHandler(options.socketIO, options.socketIOClientId)
|
const handler = new CustomChainHandler(options.socketIO, options.socketIOClientId)
|
||||||
@@ -127,7 +138,9 @@ json.dumps(my_dict)`
|
|||||||
if (finalResult) {
|
if (finalResult) {
|
||||||
const chain = new LLMChain({
|
const chain = new LLMChain({
|
||||||
llm: model,
|
llm: model,
|
||||||
prompt: PromptTemplate.fromTemplate(finalSystemPrompt),
|
prompt: PromptTemplate.fromTemplate(
|
||||||
|
systemMessagePrompt ? `${systemMessagePrompt}\n${finalSystemPrompt}` : finalSystemPrompt
|
||||||
|
),
|
||||||
verbose: process.env.DEBUG === 'true' ? true : false
|
verbose: process.env.DEBUG === 'true' ? true : false
|
||||||
})
|
})
|
||||||
const inputs = {
|
const inputs = {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import {
|
|||||||
getStartingNodes,
|
getStartingNodes,
|
||||||
getUserHome,
|
getUserHome,
|
||||||
replaceInputsWithConfig,
|
replaceInputsWithConfig,
|
||||||
resolveVariables
|
resolveVariables,
|
||||||
|
databaseEntities
|
||||||
} from './utils'
|
} from './utils'
|
||||||
import { DataSource } from 'typeorm'
|
import { DataSource } from 'typeorm'
|
||||||
import { ChatFlow } from './entity/ChatFlow'
|
import { ChatFlow } from './entity/ChatFlow'
|
||||||
@@ -141,7 +142,12 @@ export class ChildProcess {
|
|||||||
|
|
||||||
if (nodeToExecuteData.instance) checkMemorySessionId(nodeToExecuteData.instance, chatId)
|
if (nodeToExecuteData.instance) checkMemorySessionId(nodeToExecuteData.instance, chatId)
|
||||||
|
|
||||||
const result = await nodeInstance.run(nodeToExecuteData, incomingInput.question, { chatHistory: incomingInput.history, chatId })
|
const result = await nodeInstance.run(nodeToExecuteData, incomingInput.question, {
|
||||||
|
chatHistory: incomingInput.history,
|
||||||
|
appDataSource: childAppDataSource,
|
||||||
|
databaseEntities
|
||||||
|
})
|
||||||
|
|
||||||
logger.debug(`[server] [mode:child]: Finished running ${nodeToExecuteData.label} (${nodeToExecuteData.id})`)
|
logger.debug(`[server] [mode:child]: Finished running ${nodeToExecuteData.label} (${nodeToExecuteData.id})`)
|
||||||
|
|
||||||
await sendToParentProcess('finish', { result, addToChatFlowPool })
|
await sendToParentProcess('finish', { result, addToChatFlowPool })
|
||||||
|
|||||||
Reference in New Issue
Block a user