add output keys fix
This commit is contained in:
parent
3029880967
commit
5ef0324304
|
|
@ -76,12 +76,10 @@ class ConversationalRetrievalAgent_Agents implements INode {
|
||||||
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
|
||||||
const executor = nodeData.instance as AgentExecutor
|
const executor = nodeData.instance as AgentExecutor
|
||||||
|
|
||||||
if (options && options.chatHistory) {
|
if (executor.memory) {
|
||||||
if (executor.memory) {
|
;(executor.memory as any).memoryKey = 'chat_history'
|
||||||
;(executor.memory as any).memoryKey = 'chat_history'
|
;(executor.memory as any).outputKey = 'output'
|
||||||
;(executor.memory as any).outputKey = 'output'
|
;(executor.memory as any).chatHistory = mapChatHistory(options)
|
||||||
;(executor.memory as any).chatHistory = mapChatHistory(options)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const loggerHandler = new ConsoleCallbackHandler(options.logger)
|
const loggerHandler = new ConsoleCallbackHandler(options.logger)
|
||||||
|
|
|
||||||
|
|
@ -509,7 +509,7 @@ export const getUserHome = (): string => {
|
||||||
*/
|
*/
|
||||||
export const mapChatHistory = (options: ICommonObject): ChatMessageHistory => {
|
export const mapChatHistory = (options: ICommonObject): ChatMessageHistory => {
|
||||||
const chatHistory = []
|
const chatHistory = []
|
||||||
const histories: IMessage[] = options.chatHistory
|
const histories: IMessage[] = options.chatHistory ?? []
|
||||||
|
|
||||||
for (const message of histories) {
|
for (const message of histories) {
|
||||||
if (message.type === 'apiMessage') {
|
if (message.type === 'apiMessage') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue