perf: completion dispatch
This commit is contained in:
15
client/src/service/moduleDispatch/init/history.tsx
Normal file
15
client/src/service/moduleDispatch/init/history.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { SystemInputEnum } from '@/constants/app';
|
||||
import { ChatItemType } from '@/types/chat';
|
||||
|
||||
export type HistoryProps = {
|
||||
maxContext: number;
|
||||
[SystemInputEnum.history]: ChatItemType[];
|
||||
};
|
||||
|
||||
export const dispatchHistory = (props: Record<string, any>) => {
|
||||
const { maxContext = 5, history = [] } = props as HistoryProps;
|
||||
|
||||
return {
|
||||
history: history.slice(-maxContext)
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user