mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 20:27:45 +00:00
18 lines
540 B
TypeScript
18 lines
540 B
TypeScript
import { SystemInputEnum } from '@/constants/app';
|
|
import type { ChatItemType } from '@fastgpt/global/core/chat/type.d';
|
|
import type { ModuleDispatchProps } from '@/types/core/chat/type';
|
|
export type HistoryProps = ModuleDispatchProps<{
|
|
maxContext: number;
|
|
[SystemInputEnum.history]: ChatItemType[];
|
|
}>;
|
|
|
|
export const dispatchHistory = (props: Record<string, any>) => {
|
|
const {
|
|
inputs: { maxContext = 5, history = [] }
|
|
} = props as HistoryProps;
|
|
|
|
return {
|
|
history: maxContext > 0 ? history.slice(-maxContext) : []
|
|
};
|
|
};
|