mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-22 01:38:47 +00:00
feat(ui): add necessary utils
This commit is contained in:
9
ui/lib/utils/formatHistory.ts
Normal file
9
ui/lib/utils/formatHistory.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { BaseMessage } from '@langchain/core/messages';
|
||||
|
||||
const formatChatHistoryAsString = (history: BaseMessage[]) => {
|
||||
return history
|
||||
.map((message) => `${message._getType()}: ${message.content}`)
|
||||
.join('\n');
|
||||
};
|
||||
|
||||
export default formatChatHistoryAsString;
|
Reference in New Issue
Block a user