mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 20:58:12 +00:00
monorepo packages (#344)
This commit is contained in:
18
projects/app/src/service/moduleDispatch/init/history.tsx
Normal file
18
projects/app/src/service/moduleDispatch/init/history.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import { SystemInputEnum } from '@/constants/app';
|
||||
import { ChatItemType } from '@/types/chat';
|
||||
import type { ModuleDispatchProps } from '@/types/core/modules';
|
||||
|
||||
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) : []
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user