mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-03 09:05:07 +08:00
### What problem does this PR solve? Feat: Add the history field to the agent's system variables. #7322 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -27,6 +27,7 @@ export enum AgentGlobals {
|
|||||||
SysUserId = 'sys.user_id',
|
SysUserId = 'sys.user_id',
|
||||||
SysConversationTurns = 'sys.conversation_turns',
|
SysConversationTurns = 'sys.conversation_turns',
|
||||||
SysFiles = 'sys.files',
|
SysFiles = 'sys.files',
|
||||||
|
SysHistory = 'sys.history',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AgentGlobalsSysQueryWithBrace = `{${AgentGlobals.SysQuery}}`;
|
export const AgentGlobalsSysQueryWithBrace = `{${AgentGlobals.SysQuery}}`;
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import api from '@/utils/api';
|
|||||||
import { buildMessageListWithUuid } from '@/utils/chat';
|
import { buildMessageListWithUuid } from '@/utils/chat';
|
||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
import { useDebounce } from 'ahooks';
|
import { useDebounce } from 'ahooks';
|
||||||
import { get, set } from 'lodash';
|
import { get, isEmpty, set } from 'lodash';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useParams, useSearchParams } from 'react-router';
|
import { useParams, useSearchParams } from 'react-router';
|
||||||
import {
|
import {
|
||||||
@ -103,6 +103,7 @@ export const EmptyDsl = {
|
|||||||
[AgentGlobals.SysUserId]: '',
|
[AgentGlobals.SysUserId]: '',
|
||||||
[AgentGlobals.SysConversationTurns]: 0,
|
[AgentGlobals.SysConversationTurns]: 0,
|
||||||
[AgentGlobals.SysFiles]: [],
|
[AgentGlobals.SysFiles]: [],
|
||||||
|
[AgentGlobals.SysHistory]: [],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -268,6 +269,17 @@ export const useFetchAgent = (): {
|
|||||||
);
|
);
|
||||||
set(data, 'data.dsl.messages', messageList);
|
set(data, 'data.dsl.messages', messageList);
|
||||||
|
|
||||||
|
const sysHistoryPath = [
|
||||||
|
'data',
|
||||||
|
'dsl',
|
||||||
|
'globals',
|
||||||
|
AgentGlobals.SysHistory,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isEmpty(get(data, sysHistoryPath))) {
|
||||||
|
set(data, sysHistoryPath, []);
|
||||||
|
}
|
||||||
|
|
||||||
return data?.data ?? {};
|
return data?.data ?? {};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user