mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
10 lines
331 B
TypeScript
10 lines
331 B
TypeScript
import type { ChatItemType } from '@fastgpt/global/core/chat/type.d';
|
|
|
|
export const getHistories = (history?: ChatItemType[] | number, histories: ChatItemType[] = []) => {
|
|
if (!history) return [];
|
|
if (typeof history === 'number') return histories.slice(-history);
|
|
if (Array.isArray(history)) return history;
|
|
|
|
return [];
|
|
};
|