mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-27 05:36:33 +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',
|
||||
SysConversationTurns = 'sys.conversation_turns',
|
||||
SysFiles = 'sys.files',
|
||||
SysHistory = 'sys.history',
|
||||
}
|
||||
|
||||
export const AgentGlobalsSysQueryWithBrace = `{${AgentGlobals.SysQuery}}`;
|
||||
|
||||
@ -29,7 +29,7 @@ import api from '@/utils/api';
|
||||
import { buildMessageListWithUuid } from '@/utils/chat';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { useDebounce } from 'ahooks';
|
||||
import { get, set } from 'lodash';
|
||||
import { get, isEmpty, set } from 'lodash';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useParams, useSearchParams } from 'react-router';
|
||||
import {
|
||||
@ -103,6 +103,7 @@ export const EmptyDsl = {
|
||||
[AgentGlobals.SysUserId]: '',
|
||||
[AgentGlobals.SysConversationTurns]: 0,
|
||||
[AgentGlobals.SysFiles]: [],
|
||||
[AgentGlobals.SysHistory]: [],
|
||||
},
|
||||
};
|
||||
|
||||
@ -268,6 +269,17 @@ export const useFetchAgent = (): {
|
||||
);
|
||||
set(data, 'data.dsl.messages', messageList);
|
||||
|
||||
const sysHistoryPath = [
|
||||
'data',
|
||||
'dsl',
|
||||
'globals',
|
||||
AgentGlobals.SysHistory,
|
||||
];
|
||||
|
||||
if (isEmpty(get(data, sysHistoryPath))) {
|
||||
set(data, sysHistoryPath, []);
|
||||
}
|
||||
|
||||
return data?.data ?? {};
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user